Skip to content

Commit

Permalink
props cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gabyzif committed May 27, 2024
1 parent 70ae713 commit bfeca9b
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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')
},
Expand All @@ -500,7 +511,7 @@ export const MPThousandOrgs: Story = {
tools={mpTools}
management={mpManagement}
orgs={thousandOrgs}
minimapOptions={{ overviewHref: '/' }}
minimapOptions={{ show: false }}

Check failure on line 514 in src/components/navigation/GlobalNavigation/GlobalNavigation.stories.tsx

View workflow job for this annotation

GitHub Actions / typescript

Type '{ show: false; }' is not assignable to type 'IMinimapOptions'.
onMpHomeClick={() => {
alert('going to overview map')
}}
Expand Down
11 changes: 5 additions & 6 deletions src/components/navigation/GlobalNavigation/GlobalNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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

0 comments on commit bfeca9b

Please sign in to comment.