@@ -2,8 +2,10 @@ import * as React from "react";
22import {
33 IconBookFilled ,
44 IconBrandDiscordFilled ,
5+ IconChevronLeft ,
56 IconInfoCircle ,
67} from "@tabler/icons-react" ;
8+ import { Link , useLocation } from "@tanstack/react-router" ;
79import { useTranslation } from "react-i18next" ;
810
911import { NavMain } from "@/components/nav-main" ;
@@ -26,19 +28,22 @@ import {
2628} from "@/utils/feature-flags" ;
2729import { CommandSearchButton } from "./command-search-button" ;
2830import { CreateNoteButton } from "./create-note-button" ;
29- import { SETTINGS_NAV_ITEMS } from "../lib/settings-navigation" ;
31+ import { HOME_NAV_ITEMS , SETTINGS_NAV_ITEMS } from "../lib/settings-navigation" ;
3032
3133export function SettingsSidebar ( {
3234 ...props
3335} : React . ComponentProps < typeof Sidebar > ) {
3436 const { t } = useTranslation ( ) ;
37+ const location = useLocation ( ) ;
3538 const sidebarCtaFlag = useFeatureFlag ( SIDEBAR_CTA_FEATURE_FLAG ) ;
39+ const isHomeSidebar = location . pathname . startsWith ( "/settings/notes" ) ;
3640
3741 const sidebarCtaPayload = sidebarCtaFlag . enabled
3842 ? parseSidebarCtaPayload ( sidebarCtaFlag . payload )
3943 : null ;
4044
41- const navMain = SETTINGS_NAV_ITEMS . map ( ( { titleKey, url, icon } ) => ( {
45+ const navMainItems = isHomeSidebar ? HOME_NAV_ITEMS : SETTINGS_NAV_ITEMS ;
46+ const navMain = navMainItems . map ( ( { titleKey, url, icon } ) => ( {
4247 title : t ( titleKey ) ,
4348 url,
4449 icon : typeof icon === "string" ? undefined : icon ,
@@ -83,33 +88,59 @@ export function SettingsSidebar({
8388 className = "h-[var(--titlebar-height)] shrink-0"
8489 style = { { WebkitAppRegion : "drag" } as React . CSSProperties }
8590 />
86- < SidebarHeader className = "py-0 -mb-1" >
87- < SidebarMenu >
88- < SidebarMenuItem >
89- < SidebarMenuButton
90- asChild
91- className = "data-[slot=sidebar-menu-button]:!p-1.5"
92- >
93- < div className = "inline-flex items-center gap-2.5 font-semibold w-full" >
94- < img
95- src = "assets/logo.svg"
96- alt = { t ( "settings.sidebar.logoAlt" ) }
97- className = "!size-7"
98- />
99- < span className = "font-semibold" >
100- { t ( "settings.sidebar.brand" ) }
101- </ span >
91+ { isHomeSidebar ? (
92+ < SidebarHeader className = "py-0 -mb-1" >
93+ < SidebarMenu >
94+ < SidebarMenuItem >
95+ < SidebarMenuButton
96+ asChild
97+ className = "data-[slot=sidebar-menu-button]:!p-1.5"
98+ >
99+ < div className = "inline-flex items-center gap-2.5 font-semibold w-full" >
100+ < img
101+ src = "assets/logo.svg"
102+ alt = { t ( "settings.sidebar.logoAlt" ) }
103+ className = "!size-7"
104+ />
105+ < span className = "font-semibold" >
106+ { t ( "settings.sidebar.brand" ) }
107+ </ span >
108+ </ div >
109+ </ SidebarMenuButton >
110+ </ SidebarMenuItem >
111+ < SidebarMenuItem >
112+ < CreateNoteButton />
113+ </ SidebarMenuItem >
114+ < SidebarMenuItem >
115+ < CommandSearchButton />
116+ </ SidebarMenuItem >
117+ </ SidebarMenu >
118+ </ SidebarHeader >
119+ ) : (
120+ < SidebarHeader className = "py-0 -mb-1" >
121+ < SidebarMenu >
122+ < SidebarMenuItem >
123+ < SidebarMenuButton
124+ asChild
125+ className = "data-[slot=sidebar-menu-button]:!p-1.5"
126+ >
127+ < Link
128+ to = "/settings/notes"
129+ aria-label = { t ( "settings.sidebar.backToHome" ) }
130+ >
131+ < IconChevronLeft />
132+ < span > { t ( "settings.sidebar.backToHome" ) } </ span >
133+ </ Link >
134+ </ SidebarMenuButton >
135+ </ SidebarMenuItem >
136+ < SidebarMenuItem >
137+ < div className = "inline-flex items-center gap-2.5 w-full px-2 py-1.5 font-semibold" >
138+ { t ( "menu.settings" ) }
102139 </ div >
103- </ SidebarMenuButton >
104- </ SidebarMenuItem >
105- < SidebarMenuItem >
106- < CreateNoteButton />
107- </ SidebarMenuItem >
108- < SidebarMenuItem >
109- < CommandSearchButton />
110- </ SidebarMenuItem >
111- </ SidebarMenu >
112- </ SidebarHeader >
140+ </ SidebarMenuItem >
141+ </ SidebarMenu >
142+ </ SidebarHeader >
143+ ) }
113144 < SidebarContent >
114145 < NavMain items = { navMain } />
115146 < NavSecondary items = { navSecondary } className = "mt-auto" />
0 commit comments