From 757c147469044bdb8e63f139d0bfc05e3f47aef2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20G=C3=B3is?= Date: Wed, 18 Oct 2023 08:59:33 +0100 Subject: [PATCH 1/3] refactor: move message banner interface to common file --- .../MessageBanner/MessageBanner.tsx | 15 +-------------- frontend/src/interfaces/messageBanner.ts | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 14 deletions(-) create mode 100644 frontend/src/interfaces/messageBanner.ts diff --git a/frontend/src/component/messageBanners/MessageBanner/MessageBanner.tsx b/frontend/src/component/messageBanners/MessageBanner/MessageBanner.tsx index 150053694c31..2e7a3783291b 100644 --- a/frontend/src/component/messageBanners/MessageBanner/MessageBanner.tsx +++ b/frontend/src/component/messageBanners/MessageBanner/MessageBanner.tsx @@ -10,6 +10,7 @@ import { useNavigate } from 'react-router-dom'; import { MessageBannerDialog } from './MessageBannerDialog/MessageBannerDialog'; import { useState } from 'react'; import ReactMarkdown from 'react-markdown'; +import { BannerVariant, IMessageBanner } from 'interfaces/messageBanner'; const StyledBar = styled('aside', { shouldForwardProp: (prop) => prop !== 'variant' && prop !== 'sticky', @@ -42,20 +43,6 @@ const StyledIcon = styled('div', { color: theme.palette[variant].main, })); -type BannerVariant = 'warning' | 'info' | 'error' | 'success'; - -export interface IMessageBanner { - message: string; - variant?: BannerVariant; - sticky?: boolean; - icon?: string; - link?: string; - linkText?: string; - plausibleEvent?: string; - dialogTitle?: string; - dialog?: string; -} - interface IMessageBannerProps { messageBanner: IMessageBanner; } diff --git a/frontend/src/interfaces/messageBanner.ts b/frontend/src/interfaces/messageBanner.ts new file mode 100644 index 000000000000..819e0e292ca9 --- /dev/null +++ b/frontend/src/interfaces/messageBanner.ts @@ -0,0 +1,14 @@ +export type BannerVariant = 'warning' | 'info' | 'error' | 'success'; + +export interface IMessageBanner { + message: string; + enabled?: boolean; + variant?: BannerVariant; + sticky?: boolean; + icon?: string; + link?: string; + linkText?: string; + plausibleEvent?: string; + dialogTitle?: string; + dialog?: string; +} From 5f302c642a459ec6312e38d1f9122108e5288c90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20G=C3=B3is?= Date: Wed, 18 Oct 2023 09:09:46 +0100 Subject: [PATCH 2/3] fix: IMessageBanner import in ExternalMessageBanners --- .../externalMessageBanners/ExternalMessageBanners.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/frontend/src/component/messageBanners/externalMessageBanners/ExternalMessageBanners.tsx b/frontend/src/component/messageBanners/externalMessageBanners/ExternalMessageBanners.tsx index 49eb0a8d0c33..ee991ca89c96 100644 --- a/frontend/src/component/messageBanners/externalMessageBanners/ExternalMessageBanners.tsx +++ b/frontend/src/component/messageBanners/externalMessageBanners/ExternalMessageBanners.tsx @@ -1,9 +1,7 @@ -import { - IMessageBanner, - MessageBanner, -} from 'component/messageBanners/MessageBanner/MessageBanner'; +import { MessageBanner } from 'component/messageBanners/MessageBanner/MessageBanner'; import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig'; import { useVariant } from 'hooks/useVariant'; +import { IMessageBanner } from 'interfaces/messageBanner'; export const ExternalMessageBanners = () => { const { uiConfig } = useUiConfig(); From ba54bf1fba95168a7cda0549112ad8fa660dd26b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20G=C3=B3is?= Date: Wed, 18 Oct 2023 09:25:02 +0100 Subject: [PATCH 3/3] refactor: add interface for internal message banners --- frontend/src/interfaces/messageBanner.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/interfaces/messageBanner.ts b/frontend/src/interfaces/messageBanner.ts index 819e0e292ca9..4cd168c88a24 100644 --- a/frontend/src/interfaces/messageBanner.ts +++ b/frontend/src/interfaces/messageBanner.ts @@ -2,7 +2,6 @@ export type BannerVariant = 'warning' | 'info' | 'error' | 'success'; export interface IMessageBanner { message: string; - enabled?: boolean; variant?: BannerVariant; sticky?: boolean; icon?: string; @@ -12,3 +11,9 @@ export interface IMessageBanner { dialogTitle?: string; dialog?: string; } + +export interface IInternalMessageBanner extends IMessageBanner { + id: number; + enabled: boolean; + createdAt: string; +}