From 6534d1dc66085d4c0247c87709caf59c971df3bd Mon Sep 17 00:00:00 2001 From: Tristan d'audibert Date: Sun, 21 May 2023 21:58:45 +0200 Subject: [PATCH] fiew minor fixes --- .../src/App/NotificationsContext.ts | 2 +- .../src/components/Frame/Frame.tsx | 36 ++++++++++--------- .../src/components/NavBar/NavBar.tsx | 9 +++-- 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/hashkitty-front/src/App/NotificationsContext.ts b/hashkitty-front/src/App/NotificationsContext.ts index 4dc29de..cfbeba3 100644 --- a/hashkitty-front/src/App/NotificationsContext.ts +++ b/hashkitty-front/src/App/NotificationsContext.ts @@ -80,7 +80,7 @@ export class NotificationsContextImplementation this.removeFromListShortliveNotifications(notif.id); return notif; }); - }, 5000); + }, 3000); this.setShortLiveNotifications(prevNotifs => [ ...new Set([...prevNotifs, ...notifs]), ]); diff --git a/hashkitty-front/src/components/Frame/Frame.tsx b/hashkitty-front/src/components/Frame/Frame.tsx index d6c36bb..b6e4f87 100644 --- a/hashkitty-front/src/components/Frame/Frame.tsx +++ b/hashkitty-front/src/components/Frame/Frame.tsx @@ -1,6 +1,8 @@ -import { Alert, CircularProgress } from '@mui/material'; - import { useContext } from 'react'; +import Alert from '@mui/material/Alert'; +import Grow from '@mui/material/Grow'; +import CircularProgress from '@mui/material/CircularProgress'; + import NavBar from '../NavBar/NavBar'; import ColorModeContext from '../../App/ColorModeContext'; import NotificationsContext from '../../App/NotificationsContext'; @@ -20,21 +22,23 @@ export default function Frame({ children, isLoading }: FrameProps) { return ( <> -
+
-
- {shortLiveNotifications.map(notif => ( - deleteNotification(notif.id)} - severity={notif.status} - sx={{ - backgroundColor: colors.alerts[notif.status], - }} - className="w-full" - > - {notif.message} - +
+ {shortLiveNotifications.map(({ id, status, message }) => ( + + deleteNotification(id)} + severity={status} + sx={{ + backgroundColor: colors.alerts[status], + }} + className="w-full" + > + {message} + + ))}
diff --git a/hashkitty-front/src/components/NavBar/NavBar.tsx b/hashkitty-front/src/components/NavBar/NavBar.tsx index c75ec8d..f87d5e4 100644 --- a/hashkitty-front/src/components/NavBar/NavBar.tsx +++ b/hashkitty-front/src/components/NavBar/NavBar.tsx @@ -100,10 +100,15 @@ const NavBar = memo(() => {
handleOpenPopper(e)} style={{ backgroundColor: 'transparent' }} + disabled={notifications.length === 0} > - + span': { color: 'white' } }} + >