From 72fddda4118ca9fbbfd1ae2e32c5407053f1fad8 Mon Sep 17 00:00:00 2001 From: ajnart Date: Thu, 26 May 2022 19:14:19 +0200 Subject: [PATCH] :sparkles: Make the Footer update a notification --- src/components/layout/Footer.tsx | 87 +++++++++++++------------------- 1 file changed, 35 insertions(+), 52 deletions(-) diff --git a/src/components/layout/Footer.tsx b/src/components/layout/Footer.tsx index 87e8fb6be..29d5aae70 100644 --- a/src/components/layout/Footer.tsx +++ b/src/components/layout/Footer.tsx @@ -6,13 +6,11 @@ import { Group, ActionIcon, Footer as FooterComponent, - Alert, useMantineTheme, } from '@mantine/core'; -import { AlertCircle, BrandGithub } from 'tabler-icons-react'; +import { BrandGithub } from 'tabler-icons-react'; +import { showNotification } from '@mantine/notifications'; import { CURRENT_VERSION, REPO_URL } from '../../../data/constants'; -import { ModuleWrapper } from '../modules/moduleWrapper'; -import { DownloadsModule } from '../modules'; const useStyles = createStyles((theme) => ({ footer: { @@ -61,7 +59,7 @@ export function Footer({ links }: FooterCenteredProps) { )); - const [latestVersion, setLatestVersion] = useState(CURRENT_VERSION); + const [latestVersion, setLatestVersion] = useState('0'); const [isOpen, setOpen] = useState(true); useEffect(() => { // Fetch Data here when component first mounted @@ -74,71 +72,56 @@ export function Footer({ links }: FooterCenteredProps) { }); }); }, []); + if (update) { + showNotification({ + color: 'yellow', + autoClose: false, + title: 'New version available', + message: `Version ${latestVersion} is available, update now! 😡`, + }); + } return ( - - - setOpen(false)} - icon={} - title={`Updated version: ${latestVersion} is available. Current version: ${CURRENT_VERSION}`} - withCloseButton - radius="lg" - hidden={CURRENT_VERSION === latestVersion || !isOpen} - variant="outline" - styles={{ - root: { - backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[6] : 'white', - }, - - closeButton: { - marginLeft: '5px', - }, - }} - children={undefined} - /> - - - - component="a" href="https://github.com/ajnart/homarr" size="lg"> - - - - {CURRENT_VERSION} - - + + + component="a" href="https://github.com/ajnart/homarr" size="lg"> + + - Made with ❤️ by @ - - ajnart - + {CURRENT_VERSION} + + Made with ❤️ by @ + + ajnart + + );