From af02cf849970ef1f6a21363f567d74dcdfbcffe5 Mon Sep 17 00:00:00 2001 From: Konstantin Koval Date: Sat, 14 Dec 2024 17:25:44 +0200 Subject: [PATCH] More suggestions addressed --- ui/src/App.tsx | 4 ++-- ui/src/components/messages/Message.tsx | 10 ++++++---- ui/src/components/messages/MessageState.tsx | 2 +- ui/src/components/messages/Messages.test.tsx | 8 +++++++- ui/src/components/sidebar/SidebarDownloadMedia.tsx | 5 +++-- 5 files changed, 19 insertions(+), 10 deletions(-) diff --git a/ui/src/App.tsx b/ui/src/App.tsx index 170a68b9f..8bd9d4f5e 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -1,7 +1,7 @@ import React, { useEffect } from 'react' import { Helmet } from 'react-helmet' import Routes from './components/routes/Routes' -import Messages from './components/messages/Messages' +import MessagesWithProvider from './components/messages/Messages' import { useTranslation } from 'react-i18next' import { loadTranslations } from './localization' import { useLocation } from 'react-router' @@ -30,7 +30,7 @@ const App = () => { /> - + ) } diff --git a/ui/src/components/messages/Message.tsx b/ui/src/components/messages/Message.tsx index f3d35e6fa..b355e5c74 100644 --- a/ui/src/components/messages/Message.tsx +++ b/ui/src/components/messages/Message.tsx @@ -16,14 +16,16 @@ const Message = forwardRef( { onDismiss, header, children, content, negative, positive }: MessageProps, ref: React.ForwardedRef ) => { - let backgroundColor = 'bg-white dark:bg-dark-bg2' - if (negative) backgroundColor = 'bg-red-100 dark:bg-red-900' - if (positive) backgroundColor = 'bg-green-100 dark:bg-green-900' + const backgroundColorClass = negative + ? 'bg-red-100 dark:bg-red-900' + : positive + ? 'bg-green-100 dark:bg-green-900' + : 'bg-white dark:bg-dark-bg2' return (