-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add network checkts and small bug fixes
- Loading branch information
1 parent
1684eea
commit f6854de
Showing
11 changed files
with
218 additions
and
110 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
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
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,30 @@ | ||
import Stack from "@mui/material/Stack"; | ||
import WifiOffOutlinedIcon from "@mui/icons-material/WifiOffOutlined"; | ||
import Box from "@mui/material/Box"; | ||
import Icon from "./Icon"; | ||
|
||
export const MissingInternet = () => { | ||
return ( | ||
<Stack | ||
component="h4" | ||
sx={(theme) => ({ | ||
color: theme.palette.secondary.dark, | ||
width: "100%", | ||
height: "100%", | ||
m: "unset", | ||
})} | ||
direction="column" | ||
justifyContent="center" | ||
alignItems="center" | ||
spacing={2} | ||
> | ||
<Icon | ||
icon={WifiOffOutlinedIcon} | ||
sx={{ | ||
fontSize: 160, | ||
}} | ||
/> | ||
<Box>Please check your internet connection</Box> | ||
</Stack> | ||
); | ||
}; |
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,20 @@ | ||
import React from "react"; | ||
|
||
export const useNetwork = () => { | ||
const [isOnline, setNetwork] = React.useState(window.navigator.onLine); | ||
|
||
const updateNetwork = () => { | ||
setNetwork(window.navigator.onLine); | ||
}; | ||
|
||
React.useEffect(() => { | ||
window.addEventListener("offline", updateNetwork); | ||
window.addEventListener("online", updateNetwork); | ||
return () => { | ||
window.removeEventListener("offline", updateNetwork); | ||
window.removeEventListener("online", updateNetwork); | ||
}; | ||
}, [isOnline]); | ||
|
||
return { isNetworkAvailable: isOnline }; | ||
}; |
Oops, something went wrong.