From 6599e2a97ee9520cc4bd6eeeeeb88f80a94f3033 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Fri, 26 Sep 2025 09:41:19 -0600 Subject: [PATCH] simplify your stuff tabs --- .../SidebarPrimary/SidebarPrimary.tsx | 95 +++++++++---------- 1 file changed, 46 insertions(+), 49 deletions(-) diff --git a/apps/web/src/components/features/sidebars/SidebarPrimary/SidebarPrimary.tsx b/apps/web/src/components/features/sidebars/SidebarPrimary/SidebarPrimary.tsx index 1150deb04..141455bb3 100644 --- a/apps/web/src/components/features/sidebars/SidebarPrimary/SidebarPrimary.tsx +++ b/apps/web/src/components/features/sidebars/SidebarPrimary/SidebarPrimary.tsx @@ -42,6 +42,7 @@ import { useInviteModalStore, } from '@/context/GlobalStore/useInviteModalStore'; import { useGetSelectedAssetTypeLoose } from '@/context/Routes/useAppRoutes'; +import { useWhyDidYouUpdate } from '@/hooks/useWhyDidYouUpdate'; import { cn } from '@/lib/classMerge'; import { InvitePeopleModal } from '../../modals/InvitePeopleModal'; import { SupportModal } from '../../modals/SupportModal'; @@ -73,50 +74,49 @@ const topItems: ISidebarList = createSidebarList({ ], }); -const yourStuff = (selectedAssetType?: AssetType): ISidebarGroup => - createSidebarGroup({ - label: 'Your stuff', - id: 'your-stuff', - items: createSidebarItems( - [ - { - label: 'Metrics', - assetType: 'metric_file' satisfies AssetType, - icon: , - link: { to: '/app/metrics' }, - id: '/app/metrics', - }, - { - label: 'Dashboards', - assetType: 'dashboard_file' satisfies AssetType, - icon: , - link: { to: '/app/dashboards' }, - id: '/app/dashboards/', - }, - { - label: 'Collections', - assetType: 'collection' satisfies AssetType, - icon: , - link: { to: '/app/collections' }, - id: '/app/collections/', - }, - { - label: 'Reports', - assetType: 'report_file' satisfies AssetType, - icon: , - link: { to: '/app/reports' }, - id: '/app/reports/', - }, - ].map(({ assetType, ...item }) => ({ - ...item, - link: { - ...item.link, - activeOptions: { exact: true }, - }, - // active: selectedAssetType === assetType, - })) - ), - }); +const yourStuff: ISidebarGroup = createSidebarGroup({ + label: 'Your stuff', + id: 'your-stuff', + items: createSidebarItems( + [ + { + label: 'Metrics', + assetType: 'metric_file' satisfies AssetType, + icon: , + link: { to: '/app/metrics' }, + id: '/app/metrics', + }, + { + label: 'Dashboards', + assetType: 'dashboard_file' satisfies AssetType, + icon: , + link: { to: '/app/dashboards' }, + id: '/app/dashboards/', + }, + { + label: 'Collections', + assetType: 'collection' satisfies AssetType, + icon: , + link: { to: '/app/collections' }, + id: '/app/collections/', + }, + { + label: 'Reports', + assetType: 'report_file' satisfies AssetType, + icon: , + link: { to: '/app/reports' }, + id: '/app/reports/', + }, + ].map(({ assetType, ...item }) => ({ + ...item, + link: { + ...item.link, + activeOptions: { exact: true }, + }, + // active: selectedAssetType === assetType, + })) + ), +}); const adminTools: ISidebarGroup = createSidebarGroup({ label: 'Admin tools', @@ -167,13 +167,11 @@ const makeSidebarItems = ({ isAdmin, favoritesDropdownItems, tryGroupMemoized, - selectedAssetType, }: { isUserRegistered: boolean; isAdmin: boolean; favoritesDropdownItems: ISidebarGroup | null; tryGroupMemoized: ISidebarGroup; - selectedAssetType?: AssetType; }) => { if (!isUserRegistered) return []; @@ -183,7 +181,7 @@ const makeSidebarItems = ({ items.push(adminTools); } - items.push(yourStuff(selectedAssetType)); + items.push(yourStuff); if (favoritesDropdownItems) { items.push(favoritesDropdownItems); @@ -200,7 +198,7 @@ export const SidebarPrimary = React.memo(() => { const isUserRegistered = useIsUserRegistered(); const favoritesDropdownItems = useFavoriteSidebarPanel(); - const selectedAssetType = useGetSelectedAssetTypeLoose(); + // const selectedAssetType = useGetSelectedAssetTypeLoose(); const tryGroupMemoized = useMemo( () => tryGroup(!restrictNewUserInvitations), @@ -212,7 +210,6 @@ export const SidebarPrimary = React.memo(() => { isAdmin, favoritesDropdownItems, tryGroupMemoized, - selectedAssetType, }); return (