mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-26 21:39:43 +02:00
feat: add artifacts sidebar nav
This commit is contained in:
parent
a5be3fbcf8
commit
cc624076c9
2 changed files with 27 additions and 2 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useAtom, useAtomValue, useSetAtom } from "jotai";
|
||||
import { AlarmClock, AlertTriangle, Inbox, LibraryBig } from "lucide-react";
|
||||
import { AlarmClock, AlertTriangle, Boxes, Inbox, LibraryBig } from "lucide-react";
|
||||
import { useParams, usePathname, useRouter } from "next/navigation";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useTheme } from "next-themes";
|
||||
|
|
@ -328,6 +328,7 @@ export function LayoutDataProvider({ searchSpaceId, children }: LayoutDataProvid
|
|||
// in the sidebar (also surfaced in the icon rail's collapsed mode via this
|
||||
// list). Announcements has been moved to the avatar dropdown.
|
||||
const isAutomationsActive = pathname?.includes("/automations") === true;
|
||||
const isArtifactsActive = pathname?.endsWith("/artifacts") === true;
|
||||
const navItems: NavItem[] = useMemo(
|
||||
() =>
|
||||
(
|
||||
|
|
@ -345,6 +346,12 @@ export function LayoutDataProvider({ searchSpaceId, children }: LayoutDataProvid
|
|||
icon: AlarmClock,
|
||||
isActive: isAutomationsActive,
|
||||
},
|
||||
{
|
||||
title: "Artifacts",
|
||||
url: `/dashboard/${searchSpaceId}/artifacts`,
|
||||
icon: Boxes,
|
||||
isActive: isArtifactsActive,
|
||||
},
|
||||
isMobile
|
||||
? {
|
||||
title: "Documents",
|
||||
|
|
@ -362,6 +369,7 @@ export function LayoutDataProvider({ searchSpaceId, children }: LayoutDataProvid
|
|||
totalUnreadCount,
|
||||
searchSpaceId,
|
||||
isAutomationsActive,
|
||||
isArtifactsActive,
|
||||
]
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -145,6 +145,10 @@ export function Sidebar({
|
|||
() => navItems.find((item) => item.url.endsWith("/automations")),
|
||||
[navItems]
|
||||
);
|
||||
const artifactsItem = useMemo(
|
||||
() => navItems.find((item) => item.url.endsWith("/artifacts")),
|
||||
[navItems]
|
||||
);
|
||||
const documentsItem = useMemo(
|
||||
() => navItems.find((item) => item.url === "#documents"),
|
||||
[navItems]
|
||||
|
|
@ -153,7 +157,10 @@ export function Sidebar({
|
|||
() =>
|
||||
navItems.filter(
|
||||
(item) =>
|
||||
item.url !== "#inbox" && item.url !== "#documents" && !item.url.endsWith("/automations")
|
||||
item.url !== "#inbox" &&
|
||||
item.url !== "#documents" &&
|
||||
!item.url.endsWith("/automations") &&
|
||||
!item.url.endsWith("/artifacts")
|
||||
),
|
||||
[navItems]
|
||||
);
|
||||
|
|
@ -242,6 +249,16 @@ export function Sidebar({
|
|||
tooltipContent={isCollapsed ? automationsItem.title : undefined}
|
||||
/>
|
||||
)}
|
||||
{artifactsItem && (
|
||||
<SidebarButton
|
||||
icon={artifactsItem.icon}
|
||||
label={artifactsItem.title}
|
||||
onClick={() => onNavItemClick?.(artifactsItem)}
|
||||
isCollapsed={isCollapsed}
|
||||
isActive={artifactsItem.isActive}
|
||||
tooltipContent={isCollapsed ? artifactsItem.title : undefined}
|
||||
/>
|
||||
)}
|
||||
{documentsItem && (
|
||||
<SidebarButton
|
||||
icon={documentsItem.icon}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue