From bfeca9b146ac60c3ecb63b494b64242e13a4efd8 Mon Sep 17 00:00:00 2001 From: Gaby Zifferman Date: Mon, 27 May 2024 15:40:27 +0200 Subject: [PATCH] props cleanup --- .../GlobalNavigation.stories.tsx | 15 +++++++++++++-- .../GlobalNavigation/GlobalNavigation.tsx | 11 +++++------ .../GlobalNavigation/GlobalNavigationItems.d.ts | 16 +++++++++++++++- 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/src/components/navigation/GlobalNavigation/GlobalNavigation.stories.tsx b/src/components/navigation/GlobalNavigation/GlobalNavigation.stories.tsx index ac6a19d39..a1fdb9d15 100644 --- a/src/components/navigation/GlobalNavigation/GlobalNavigation.stories.tsx +++ b/src/components/navigation/GlobalNavigation/GlobalNavigation.stories.tsx @@ -475,7 +475,18 @@ export const MP: Story = { tools: mpTools, management: mpManagement, orgs: mpOrgs, - minimapOptions: { overviewHref: '/', show: true }, + minimapOptions: { + overviewHref: '/', + show: true, + routes: [ + { elementId: 'oversight', route: '/oversight', isAuthorized: true }, + { elementId: 'dataPlatform', route: '/data-platform', isAuthorized: false }, + { elementId: 'customer360', route: '/customer-360', isAuthorized: true }, + { elementId: 'predictions', route: '/predictions', isAuthorized: false }, + { elementId: 'analytics', route: '/analytics', isAuthorized: true }, + { elementId: 'segmentation', route: '/segmentation', isAuthorized: false }, + ], + }, onMpHomeClick: () => { alert('going to overview map') }, @@ -500,7 +511,7 @@ export const MPThousandOrgs: Story = { tools={mpTools} management={mpManagement} orgs={thousandOrgs} - minimapOptions={{ overviewHref: '/' }} + minimapOptions={{ show: false }} onMpHomeClick={() => { alert('going to overview map') }} diff --git a/src/components/navigation/GlobalNavigation/GlobalNavigation.tsx b/src/components/navigation/GlobalNavigation/GlobalNavigation.tsx index 77b32ffb9..1bb515a81 100644 --- a/src/components/navigation/GlobalNavigation/GlobalNavigation.tsx +++ b/src/components/navigation/GlobalNavigation/GlobalNavigation.tsx @@ -15,7 +15,10 @@ import { NavigationSearch } from 'src/components/navigation/GlobalNavigation/Nav import { NavigationList } from 'src/components/navigation/GlobalNavigation/NavigationList' import { NavigationCreate } from 'src/components/navigation/GlobalNavigation/NavigationCreate' import { WorkspaceSelector } from 'src/components/navigation/GlobalNavigation/WorkspaceSelector/WorkspaceSelector' -import { type IGlobalNavigationItem } from 'src/components/navigation/GlobalNavigation/GlobalNavigationItems' +import { + type IGlobalNavigationItem, + IMinimapOptions, +} from 'src/components/navigation/GlobalNavigation/GlobalNavigationItems' import { NavigationItem } from 'src/components/navigation/GlobalNavigation/NavigationItem' import { useNewExperienceReminder } from 'src/hooks/NewExperienceReminder/useNewExperienceReminder' import { HomeButton } from 'src/components/navigation/GlobalNavigation/HomeButton' @@ -37,11 +40,7 @@ export interface IGlobalNavigationProps { onClick: () => void withoutContainer?: boolean } - minimapOptions: { - overviewHref?: string - show?: boolean - routes: ISvgLink[] - } + minimapOptions: IMinimapOptions } export const GlobalNavWidth = 90 as const diff --git a/src/components/navigation/GlobalNavigation/GlobalNavigationItems.d.ts b/src/components/navigation/GlobalNavigation/GlobalNavigationItems.d.ts index bd074d2ed..1d9243818 100644 --- a/src/components/navigation/GlobalNavigation/GlobalNavigationItems.d.ts +++ b/src/components/navigation/GlobalNavigation/GlobalNavigationItems.d.ts @@ -1,6 +1,6 @@ import type { ReactNode, type MouseEvent } from 'react' import { type HrefOptions } from 'src/utils/utils' - +import { ISvgLink } from 'src/components/navigation/MiniMap/SvgLinker' export interface IBaseGlobalNavigationItem { type?: 'menu' | 'link' label: ReactNode @@ -28,3 +28,17 @@ export interface IGlobalNavigationLink extends IBaseGlobalNavigationItem { } export type IGlobalNavigationItem = IGlobalNavigationMenu | IGlobalNavigationLink + +interface IMinimapOptionsShow { + show: true + overviewHref: string + routes: ISvgLink[] +} + +interface IMinimapOptionsHide { + show: false + overviewHref: undefined + routes: [] +} + +export type IMinimapOptions = IMinimapOptionsShow | IMinimapOptionsHide