Skip to content

Commit

Permalink
Remove temp message on navigate away (#1657)
Browse files Browse the repository at this point in the history
  • Loading branch information
MiraGeowerkstatt authored Nov 18, 2024
2 parents e4dfd42 + 9858f2c commit bba6df4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/client/src/pages/detail/saveBar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useState } from "react";
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { useLocation } from "react-router-dom";
import { Box, Stack } from "@mui/material";
import { CircleCheck, CircleX } from "lucide-react";
import { theme } from "../../AppTheme.ts";
Expand All @@ -13,6 +14,12 @@ interface SaveBarProps {
export const SaveBar = ({ triggerSubmit, triggerReset, isFormDirty }: SaveBarProps) => {
const [showSaveFeedback, setShowSaveFeedback] = useState(false);
const { t } = useTranslation();
const location = useLocation();

useEffect(() => {
setShowSaveFeedback(false);
}, [location.pathname]);

const changesMessage = (
<>
<CircleX />
Expand Down Expand Up @@ -60,7 +67,7 @@ export const SaveBar = ({ triggerSubmit, triggerReset, isFormDirty }: SaveBarPro
onClick={() => {
setShowSaveFeedback(true);
triggerSubmit();
setTimeout(() => setShowSaveFeedback(false), 5000);
setTimeout(() => setShowSaveFeedback(false), 4000);
}}
/>
</Stack>
Expand Down

0 comments on commit bba6df4

Please sign in to comment.