mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-29 19:35:20 +02:00
feat(web): surface Automations in the sidebar under Inbox
Adds an "Automations" nav entry rendered explicitly between Inbox and (on mobile) Documents, mirroring how those two are pulled out of the nav list and rendered above the chat sections. The icon is Workflow to match settings/RBAC labelling. LayoutDataProvider: - Adds the entry to navItems pointing at /dashboard/[id]/automations. - Marks isActive via pathname so the row highlights on the route. - Tags /automations as a workspace-panel page so it renders in the centered settings-style viewport (same chrome as Team / settings). Sidebar: - Pulls out automationsItem alongside inboxItem and documentsItem. - Renders it between them. - Excludes its URL from footerNavItems so it doesn't double-render. Page-level RBAC still gates the actual view; the sidebar entry is always visible (consistent with Inbox/Documents which are also not gated at the nav layer). Anonymous (FreeLayoutDataProvider) intentionally not touched — automations is an authenticated feature.
This commit is contained in:
parent
fe28833ad4
commit
7bc52dcdc0
2 changed files with 50 additions and 12 deletions
|
|
@ -140,16 +140,26 @@ export function Sidebar({
|
|||
const t = useTranslations("sidebar");
|
||||
const [openDropdownChatId, setOpenDropdownChatId] = useState<number | null>(null);
|
||||
|
||||
// Inbox and Documents are rendered explicitly right below New Chat. Pull
|
||||
// them out of the nav items list so they don't also appear in the bottom
|
||||
// NavSection. Documents is only present in navItems on mobile.
|
||||
// Inbox, Automations, and Documents are rendered explicitly right below
|
||||
// New Chat. Pull them out of the nav items list so they don't also appear
|
||||
// in the bottom NavSection. Documents is only present in navItems on
|
||||
// mobile; Automations is identified by URL suffix so the same code path
|
||||
// works across search spaces.
|
||||
const inboxItem = useMemo(() => navItems.find((item) => item.url === "#inbox"), [navItems]);
|
||||
const automationsItem = useMemo(
|
||||
() => navItems.find((item) => item.url.endsWith("/automations")),
|
||||
[navItems]
|
||||
);
|
||||
const documentsItem = useMemo(
|
||||
() => navItems.find((item) => item.url === "#documents"),
|
||||
[navItems]
|
||||
);
|
||||
const footerNavItems = useMemo(
|
||||
() => navItems.filter((item) => item.url !== "#inbox" && item.url !== "#documents"),
|
||||
() =>
|
||||
navItems.filter(
|
||||
(item) =>
|
||||
item.url !== "#inbox" && item.url !== "#documents" && !item.url.endsWith("/automations")
|
||||
),
|
||||
[navItems]
|
||||
);
|
||||
|
||||
|
|
@ -227,6 +237,16 @@ export function Sidebar({
|
|||
}
|
||||
/>
|
||||
)}
|
||||
{automationsItem && (
|
||||
<SidebarButton
|
||||
icon={automationsItem.icon}
|
||||
label={automationsItem.title}
|
||||
onClick={() => onNavItemClick?.(automationsItem)}
|
||||
isCollapsed={isCollapsed}
|
||||
isActive={automationsItem.isActive}
|
||||
tooltipContent={isCollapsed ? automationsItem.title : undefined}
|
||||
/>
|
||||
)}
|
||||
{documentsItem && (
|
||||
<SidebarButton
|
||||
icon={documentsItem.icon}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue