Skip to content

Commit

Permalink
Feat: Audit clue on transaction save (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
drishit96 authored Sep 17, 2023
1 parent a081b12 commit 9c07ec4
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/entry.worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const queue = new Queue("budgetsco");
export type {};
declare let self: ServiceWorkerGlobalScope;

const STATIC_ASSETS = ["/build/", "/icons/", "/images", "/"];
const STATIC_ASSETS = ["/build/", "/icons/", "/images", "/fonts", "/sounds", "/"];

const ASSET_CACHE = "asset-cache";
const DATA_CACHE = "data-cache";
Expand Down
12 changes: 7 additions & 5 deletions app/routes/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,13 @@ export default function Index() {
}, []);

useEffect(() => {
if (
navigation.state === "submitting" &&
navigation.formData?.get("formName") === "SAVE_REGISTRATION_TOKEN"
) {
context.setSnackBarMsg("Notifications enabled");
if (navigation.state === "submitting") {
if (navigation.formData?.get("formName") === "SAVE_REGISTRATION_TOKEN") {
context.setSnackBarMsg("Notifications enabled");
} else if (navigation.formData?.get("formName") === "MARK_AS_DONE_FORM") {
const successSound = new Audio("/sounds/success.mp3");
successSound.play();
}
}
}, [navigation.state, navigation.formData, context]);

Expand Down
5 changes: 4 additions & 1 deletion app/routes/transaction/create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,11 @@ export default function Create() {
useEffect(() => {
if (actionData?.data?.isTransactionSaved) {
context.setSnackBarMsg("Transaction saved");
const successSound = new Audio("/sounds/success.mp3");
successSound.play();
history.back();
}
}, [actionData?.data?.isTransactionSaved]);
}, [actionData?.data?.isTransactionSaved, context]);

useEffect(() => {
context.showBackButton(true);
Expand Down Expand Up @@ -444,6 +446,7 @@ export default function Create() {
name="description"
className="input text-center"
placeholder="Description (optional)"
dir="auto"
/>

<Spacer size={3} />
Expand Down
4 changes: 3 additions & 1 deletion app/routes/transaction/edit/$transactionId.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,11 @@ export default function EditTransaction() {
useEffect(() => {
if (actionData?.data?.isTransactionSaved) {
context.setSnackBarMsg("Transaction saved");
const successSound = new Audio("/sounds/success.mp3");
successSound.play();
history.back();
}
}, [actionData?.data?.isTransactionSaved]);
}, [actionData?.data?.isTransactionSaved, context]);

useEffect(() => {
context.showBackButton(true);
Expand Down
1 change: 1 addition & 0 deletions prod.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ app.use("/build", express.static("public/build", { immutable: true, maxAge: "1y"
app.use("/icons", express.static("public/icons", { immutable: true, maxAge: "1y" }));
app.use("/images", express.static("public/images", { immutable: true, maxAge: "1y" }));
app.use("/fonts", express.static("public/fonts", { immutable: true, maxAge: "1y" }));
app.use("/sounds", express.static("public/sounds", { immutable: true, maxAge: "1y" }));

//cache everything else for 1 day
app.use(express.static("public", { maxAge: "1d" }));
Expand Down
Binary file added public/sounds/success.mp3
Binary file not shown.

0 comments on commit 9c07ec4

Please sign in to comment.