From 32767348c5c72abcf48a7ca05019448d8ff8f70c Mon Sep 17 00:00:00 2001 From: ajnart Date: Sat, 10 Dec 2022 23:31:22 +0900 Subject: [PATCH] Working on new update indicator --- src/components/layout/Footer.tsx | 74 -------------------------------- src/pages/api/modules/ping.ts | 4 +- 2 files changed, 2 insertions(+), 76 deletions(-) delete mode 100644 src/components/layout/Footer.tsx diff --git a/src/components/layout/Footer.tsx b/src/components/layout/Footer.tsx deleted file mode 100644 index f1b58cd2a..000000000 --- a/src/components/layout/Footer.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import React, { useEffect } from 'react'; -import { createStyles, Footer as FooterComponent } from '@mantine/core'; -import { showNotification } from '@mantine/notifications'; -import { IconAlertCircle as AlertCircle } from '@tabler/icons'; -import { CURRENT_VERSION, REPO_URL } from '../../../data/constants'; - -const useStyles = createStyles((theme) => ({ - footer: { - borderTop: `1px solid ${ - theme.colorScheme === 'dark' ? theme.colors.dark[5] : theme.colors.gray[2] - }`, - }, - - inner: { - display: 'flex', - justifyContent: 'space-between', - alignItems: 'center', - padding: `${theme.spacing.md}px ${theme.spacing.md}px`, - - [theme.fn.smallerThan('sm')]: { - flexDirection: 'column', - }, - }, - - links: { - [theme.fn.smallerThan('sm')]: { - marginTop: theme.spacing.lg, - marginBottom: theme.spacing.sm, - }, - }, -})); - -interface FooterCenteredProps { - links: { link: string; label: string }[]; -} - -export function Footer({ links }: FooterCenteredProps) { - useEffect(() => { - // Fetch Data here when component first mounted - fetch(`https://api.github.com/repos/${REPO_URL}/releases/latest`).then((res) => { - res.json().then((data) => { - if (data.tag_name > CURRENT_VERSION) { - showNotification({ - color: 'yellow', - autoClose: false, - title: 'New version available', - icon: , - message: `Version ${data.tag_name} is available, update now!`, - }); - } else if (data.tag_name < CURRENT_VERSION) { - showNotification({ - color: 'orange', - autoClose: 5000, - title: 'You are using a development version', - icon: , - message: 'This version of Homarr is still in development! Bugs are expected 🐛', - }); - } - }); - }); - }, []); - - return ( - - ); -} diff --git a/src/pages/api/modules/ping.ts b/src/pages/api/modules/ping.ts index e5f5f606b..7b0baea76 100644 --- a/src/pages/api/modules/ping.ts +++ b/src/pages/api/modules/ping.ts @@ -13,10 +13,10 @@ async function Get(req: NextApiRequest, res: NextApiResponse) { // Return 200 if the alive property is true if (response.alive) { - return res.status(200).end(); + return res.status(200).json({ alive: true }); } // Return 404 if the alive property is false - return res.status(404).end(); + return res.status(404).json({ alive: false }); } export default async (req: NextApiRequest, res: NextApiResponse) => {