-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(Match): update user match DTO * feat(Scanner): complete redesign * fix(Scanner): dynamic view height for stupid mobile browsers * fix(Scanner): only display itemStatuses once
- Loading branch information
1 parent
6ad855f
commit 7a504cf
Showing
16 changed files
with
426 additions
and
320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { LinearProgress, Box, Typography } from "@mui/material"; | ||
import { useRouter } from "next/router"; | ||
import { useEffect, useState } from "react"; | ||
|
||
const CountdownToRedirect = ({ | ||
path, | ||
seconds, | ||
}: { | ||
path: string; | ||
seconds: number; | ||
}) => { | ||
const [progress, setProgress] = useState(100); | ||
const router = useRouter(); | ||
|
||
useEffect(() => { | ||
const interval = setInterval(() => { | ||
setProgress((previousProgress) => { | ||
if (previousProgress <= 0) { | ||
clearInterval(interval); | ||
router.push(path); | ||
return 0; | ||
} | ||
return previousProgress - 10 / seconds; | ||
}); | ||
}, 100); | ||
|
||
return () => { | ||
clearInterval(interval); | ||
}; | ||
}, [path, router, seconds]); | ||
|
||
return ( | ||
<Box sx={{ width: "100%", mt: 1 }}> | ||
<Typography variant="h6" sx={{ mb: 2, textAlign: "center" }}> | ||
Du blir videresendt om {Math.ceil((progress / 100) * seconds)}{" "} | ||
sekunder... | ||
</Typography> | ||
<LinearProgress | ||
color={"success"} | ||
variant="determinate" | ||
value={progress} | ||
sx={{ height: 10, borderRadius: 5 }} | ||
/> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default CountdownToRedirect; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.