-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ability to turn of auto refresh
- Loading branch information
1 parent
4f952e7
commit 3017cbd
Showing
5 changed files
with
74 additions
and
30 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,24 @@ | ||
import DoneIcon from "@mui/icons-material/Done"; | ||
import ListItemIcon from "@mui/material/ListItemIcon"; | ||
import MenuItem from "@mui/material/MenuItem"; | ||
import { ComponentProps } from "react"; | ||
import { useLocalStorage } from "usehooks-ts"; | ||
|
||
export function AutoRefreshMenuItem(props: ComponentProps<typeof MenuItem>) { | ||
const [isAutoRefresh, setIsAutoRefresh] = useLocalStorage( | ||
"auto-refresh", | ||
true, | ||
); | ||
|
||
return ( | ||
<MenuItem | ||
{...props} | ||
onClick={() => { | ||
setIsAutoRefresh((old) => !old); | ||
}} | ||
> | ||
<ListItemIcon>{isAutoRefresh ? <DoneIcon /> : null}</ListItemIcon> | ||
Auto refresh | ||
</MenuItem> | ||
); | ||
} |
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