From 5fc1e098bd6fd5be9c054500ceff996bad48748d Mon Sep 17 00:00:00 2001 From: Ivan Gabriele Date: Thu, 2 May 2024 13:16:50 +0200 Subject: [PATCH] Limit banner children prop to string type in main window banner stack --- .../MainWindow/components/BannerStack/Item.tsx | 2 +- .../MainWindow/components/BannerStack/types.ts | 7 ------- .../MainWindow/dispatchers/addMainWindowBanner.ts | 2 +- frontend/src/features/MainWindow/slice.ts | 2 +- frontend/src/features/MainWindow/types.ts | 10 ++++++++++ 5 files changed, 13 insertions(+), 10 deletions(-) delete mode 100644 frontend/src/features/MainWindow/components/BannerStack/types.ts diff --git a/frontend/src/features/MainWindow/components/BannerStack/Item.tsx b/frontend/src/features/MainWindow/components/BannerStack/Item.tsx index 58455ae6e..d06e633d5 100644 --- a/frontend/src/features/MainWindow/components/BannerStack/Item.tsx +++ b/frontend/src/features/MainWindow/components/BannerStack/Item.tsx @@ -1,7 +1,7 @@ import { Banner, type BannerProps } from '@mtes-mct/monitor-ui' import styled from 'styled-components' -import type { BannerStackItemProps } from './types' +import type { BannerStackItemProps } from '../../types' import type { Promisable } from 'type-fest' type ItemProps = { diff --git a/frontend/src/features/MainWindow/components/BannerStack/types.ts b/frontend/src/features/MainWindow/components/BannerStack/types.ts deleted file mode 100644 index f0eeb1b61..000000000 --- a/frontend/src/features/MainWindow/components/BannerStack/types.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { BannerProps } from '@mtes-mct/monitor-ui' - -export type BannerStackItem = { - props: BannerStackItemProps - rank: number -} -export type BannerStackItemProps = Omit diff --git a/frontend/src/features/MainWindow/dispatchers/addMainWindowBanner.ts b/frontend/src/features/MainWindow/dispatchers/addMainWindowBanner.ts index 4597f5f42..05c7f7752 100644 --- a/frontend/src/features/MainWindow/dispatchers/addMainWindowBanner.ts +++ b/frontend/src/features/MainWindow/dispatchers/addMainWindowBanner.ts @@ -1,6 +1,6 @@ import { bannerStackAdapter, mainWindowActions } from '../slice' -import type { BannerStackItemProps } from '../components/BannerStack/types' +import type { BannerStackItemProps } from '../types' import type { HomeAppThunk } from '@store/index' /** diff --git a/frontend/src/features/MainWindow/slice.ts b/frontend/src/features/MainWindow/slice.ts index 77e9b5f2b..f7de2f470 100644 --- a/frontend/src/features/MainWindow/slice.ts +++ b/frontend/src/features/MainWindow/slice.ts @@ -1,6 +1,6 @@ import { createEntityAdapter, createSlice, type EntityState, type PayloadAction } from '@reduxjs/toolkit' -import type { BannerStackItem } from './components/BannerStack/types' +import type { BannerStackItem } from './types' export const bannerStackAdapter = createEntityAdapter({ selectId: (bannerStackItem: BannerStackItem) => bannerStackItem.rank, diff --git a/frontend/src/features/MainWindow/types.ts b/frontend/src/features/MainWindow/types.ts index cae3cbac7..59041095c 100644 --- a/frontend/src/features/MainWindow/types.ts +++ b/frontend/src/features/MainWindow/types.ts @@ -1,3 +1,13 @@ +import type { BannerProps } from '@mtes-mct/monitor-ui' + +export type BannerStackItem = { + props: BannerStackItemProps + rank: number +} +export type BannerStackItemProps = Omit & { + children: string +} + export enum MainWindowConfirmationModalActionType { 'DELETE_CONTROL_UNIT_CONTACT' = 'DELETE_CONTROL_UNIT_CONTACT', 'DELETE_CONTROL_UNIT_RESOURCE' = 'DELETE_CONTROL_UNIT_RESOURCE'