Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add links to the minimap #246

Merged
merged 30 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
51472e9
wip minimap svg linker
gabyzif May 21, 2024
789465a
WIP map links
gabyzif May 24, 2024
d17fef7
wip minimap linking
gabyzif May 24, 2024
b175afe
update minimap
gabyzif May 27, 2024
70ae713
add navigation to the overview map
gabyzif May 27, 2024
bfeca9b
props cleanup
gabyzif May 27, 2024
15b336c
remove the show prop. only show or hide the minimap depening on if it…
gabyzif May 27, 2024
4aca9b5
fix TS issue
gabyzif May 27, 2024
939a296
Merge branch 'main' into feat/minimap-linker
gabyzif May 27, 2024
2394207
add handle click
gabyzif May 27, 2024
aaa65f9
clean up code
gabyzif May 28, 2024
db04989
update svg to remove warnings, cleanup
gabyzif May 29, 2024
061f246
cleanup
gabyzif May 29, 2024
7d601a1
cleanup
gabyzif May 29, 2024
9bd41cc
cleanup
gabyzif May 29, 2024
8996ff0
Merge branch 'main' into feat/minimap-linker
gabyzif May 29, 2024
0a74287
Update src/components/navigation/MiniMap/MiniMap.tsx
gabyzif May 29, 2024
a2dfaa7
clean up code following styleguide
gabyzif May 29, 2024
38c19a2
commit merge
gabyzif May 29, 2024
ba828e8
replace likn
gabyzif May 29, 2024
4aea897
update types
gabyzif May 29, 2024
77441f6
replace clone element for create element (performance)
gabyzif May 30, 2024
633ae5f
chore(release): 1.15.1-minimap-linker.1 [skip ci]
mparticle-automation May 30, 2024
381541e
rename unauthorized buttons to unautorhized links
gabyzif May 30, 2024
55dd7ba
prepare feauture branch
gabyzif May 30, 2024
c8dd5ff
remove open = true in the HomeButton.tsx
gabyzif May 30, 2024
4d2e2fd
make parameter optional
gabyzif May 30, 2024
50d5474
update names
gabyzif May 30, 2024
4a12d8d
fix ts errors
gabyzif May 30, 2024
1a2ff18
replace container class for utility class
gabyzif May 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,15 @@
onMpHomeClick: () => {
alert('Going to mP!')
},
minimapOptions: {

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

View workflow job for this annotation

GitHub Actions / typescript

Type '{ routes: ({ elementId: string; route: string; isAuthorized: true; } | { elementId: string; route: string; isAuthorized: false; })[]; show: true; }' is not assignable to type 'IMinimapOptions | undefined'.
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 },
],
show: true,
},
},
Expand Down Expand Up @@ -467,12 +475,22 @@
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')
},
avatarOptions: {
// src: "https://static-qa1.qa.corp.mparticle.com/appimg/logo_af_916397d2-9732-8de6-77cc-80e3bba120ca.png",
alt: 'avatar',
},
},
Expand All @@ -493,7 +511,7 @@
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: 6 additions & 5 deletions src/components/navigation/GlobalNavigation/GlobalNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ 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,
gabyzif marked this conversation as resolved.
Show resolved Hide resolved
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'
import { ISvgLink } from 'src/components/navigation/MiniMap/SvgLinker'
gabyzif marked this conversation as resolved.
Show resolved Hide resolved

export interface IGlobalNavigationProps {
logo: IGlobalNavigationLogo
Expand All @@ -36,10 +40,7 @@ export interface IGlobalNavigationProps {
onClick: () => void
withoutContainer?: boolean
}
minimapOptions: {
overviewHref?: string
show?: boolean
}
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
gabyzif marked this conversation as resolved.
Show resolved Hide resolved
11 changes: 9 additions & 2 deletions src/components/navigation/GlobalNavigation/HomeButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react'
import { Center, IGlobalNavigationProps, Icon, Popover, Tooltip } from 'src/components'
import MiniMap from 'src/components/navigation/MiniMap/MiniMap'
import { ISvgLink } from 'src/components/navigation/MiniMap/SvgLinker'

interface MpHomeButtonProps {
onClick: () => void
Expand All @@ -9,6 +10,7 @@ interface MpHomeButtonProps {
interface MinimapWithPopoverProps {
overviewHref: string
onClick: () => void
routes: ISvgLink[]
}

interface TooltipWithButtonProps {
Expand All @@ -19,6 +21,7 @@ interface HomeButtonProps {
minimapOptions: {
overviewHref?: string
show?: boolean
routes: ISvgLink[]
}
onMpHomeClick: () => void
}
Expand All @@ -28,8 +31,11 @@ const MpHomeButton: React.FC<MpHomeButtonProps> = ({ onClick }) => (
</Center>
)

const MinimapWithPopover: React.FC<MinimapWithPopoverProps> = ({ overviewHref, onClick }) => (
<Popover content={() => <MiniMap overviewHref={overviewHref} />} placement="rightBottom" arrow={false}>
const MinimapWithPopover: React.FC<MinimapWithPopoverProps> = ({ overviewHref, onClick, routes }) => (
<Popover
content={() => <MiniMap overviewHref={overviewHref} routes={routes} />}
placement="rightBottom"
arrow={false}>
<MpHomeButton onClick={onClick} />
</Popover>
)
Expand All @@ -45,6 +51,7 @@ export const HomeButton: React.FC<HomeButtonProps> = props => {
<MinimapWithPopover
overviewHref={props.minimapOptions?.overviewHref || '/'}
onClick={props.onMpHomeClick}
routes={props.minimapOptions.routes}
/>
) : (
<TooltipWithButton onClick={props.onMpHomeClick} />
Expand Down
Loading
Loading