simplify your stuff tabs

This commit is contained in:
Nate Kelley 2025-09-26 09:41:19 -06:00
parent e621149030
commit 6599e2a97e
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
1 changed files with 46 additions and 49 deletions

View File

@ -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: <ASSET_ICONS.metrics />,
link: { to: '/app/metrics' },
id: '/app/metrics',
},
{
label: 'Dashboards',
assetType: 'dashboard_file' satisfies AssetType,
icon: <ASSET_ICONS.dashboards />,
link: { to: '/app/dashboards' },
id: '/app/dashboards/',
},
{
label: 'Collections',
assetType: 'collection' satisfies AssetType,
icon: <ASSET_ICONS.collections />,
link: { to: '/app/collections' },
id: '/app/collections/',
},
{
label: 'Reports',
assetType: 'report_file' satisfies AssetType,
icon: <ASSET_ICONS.reports />,
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: <ASSET_ICONS.metrics />,
link: { to: '/app/metrics' },
id: '/app/metrics',
},
{
label: 'Dashboards',
assetType: 'dashboard_file' satisfies AssetType,
icon: <ASSET_ICONS.dashboards />,
link: { to: '/app/dashboards' },
id: '/app/dashboards/',
},
{
label: 'Collections',
assetType: 'collection' satisfies AssetType,
icon: <ASSET_ICONS.collections />,
link: { to: '/app/collections' },
id: '/app/collections/',
},
{
label: 'Reports',
assetType: 'report_file' satisfies AssetType,
icon: <ASSET_ICONS.reports />,
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 (