Skip to content

Commit dcc6776

Browse files
authored
Add project file toggle to the sidebar (#90)
- Add a sidebar setting to hide the active project file list - Refresh project/thread sidebar styling and soften chat layout chrome
1 parent 572231b commit dcc6776

3 files changed

Lines changed: 41 additions & 12 deletions

File tree

apps/web/src/appSettings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export const AppSettingsSchema = Schema.Struct({
7474
timestampFormat: TimestampFormat.pipe(withDefaults(() => DEFAULT_TIMESTAMP_FORMAT)),
7575
windowOpacity: Schema.Number.pipe(withDefaults(() => 1)),
7676
sidebarOpacity: Schema.Number.pipe(withDefaults(() => 1)),
77+
sidebarHideFiles: Schema.Boolean.pipe(withDefaults(() => false)),
7778
customCodexModels: Schema.Array(Schema.String).pipe(withDefaults(() => [])),
7879
customClaudeModels: Schema.Array(Schema.String).pipe(withDefaults(() => [])),
7980
textGenerationModel: Schema.optional(TrimmedNonEmptyString),

apps/web/src/components/Sidebar.tsx

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import {
22
ArrowLeftIcon,
33
ArrowUpDownIcon,
44
ChevronRightIcon,
5+
EyeIcon,
6+
EyeOffIcon,
57
FolderIcon,
68
GitMergeIcon,
79
GitPullRequestIcon,
@@ -47,7 +49,7 @@ import {
4749
useAppSettings,
4850
} from "../appSettings";
4951
import { isElectron } from "../env";
50-
import { APP_STAGE_LABEL, APP_VERSION } from "../branding";
52+
import { APP_VERSION } from "../branding";
5153
import { cn, isLinuxPlatform, isMacPlatform, newCommandId, newProjectId } from "../lib/utils";
5254
import { useStore } from "../store";
5355
import { shortcutLabelForCommand } from "../keybindings";
@@ -1362,7 +1364,7 @@ export default function Sidebar() {
13621364
<SidebarMenuButton
13631365
ref={isManualProjectSorting ? dragHandleProps?.setActivatorNodeRef : undefined}
13641366
size="sm"
1365-
className={`gap-2 px-2 py-2 text-left hover:bg-accent group-hover/project-header:bg-accent group-hover/project-header:text-sidebar-accent-foreground ${
1367+
className={`gap-2 rounded-lg border border-transparent px-2.5 py-2.5 text-left bg-accent/40 hover:bg-accent/70 group-hover/project-header:bg-accent/70 group-hover/project-header:text-sidebar-accent-foreground dark:bg-accent/30 dark:hover:bg-accent/50 dark:group-hover/project-header:bg-accent/50 ${
13661368
isManualProjectSorting ? "cursor-grab active:cursor-grabbing" : "cursor-pointer"
13671369
}`}
13681370
{...(isManualProjectSorting && dragHandleProps ? dragHandleProps.attributes : {})}
@@ -1401,7 +1403,7 @@ export default function Sidebar() {
14011403
/>
14021404
)}
14031405
<ProjectFavicon cwd={project.cwd} />
1404-
<span className="flex-1 truncate text-xs font-semibold tracking-[0.01em] text-foreground">
1406+
<span className="flex-1 truncate text-[13px] font-semibold tracking-[0.01em] text-foreground">
14051407
{project.name}
14061408
</span>
14071409
</SidebarMenuButton>
@@ -1441,7 +1443,7 @@ export default function Sidebar() {
14411443
<CollapsibleContent>
14421444
<SidebarMenuSub
14431445
ref={attachThreadListAutoAnimateRef}
1444-
className="mx-1 my-0 w-full translate-x-0 gap-0.5 px-1.5 py-0"
1446+
className="relative mx-1.5 my-1 w-auto translate-x-0 gap-0.5 rounded-lg border border-border/40 bg-background/50 px-1 py-1 dark:border-border/30 dark:bg-background/30"
14451447
>
14461448
{renderedThreads.map((thread) => renderThreadRow(thread))}
14471449

@@ -1477,8 +1479,8 @@ export default function Sidebar() {
14771479
)}
14781480
</SidebarMenuSub>
14791481

1480-
{project.expanded && activeProjectThread ? (
1481-
<div className="mx-2 mt-2 border-sidebar-border/50 border-t pt-2">
1482+
{project.expanded && activeProjectThread && !appSettings.sidebarHideFiles ? (
1483+
<div className="mx-1.5 mt-1 rounded-lg border border-border/40 bg-background/50 p-2 dark:border-border/30 dark:bg-background/30">
14821484
<button
14831485
type="button"
14841486
className="mb-1.5 flex w-full items-center gap-1.5 px-2 text-[10px] uppercase tracking-[0.14em] text-muted-foreground/58 hover:text-muted-foreground/80"
@@ -1728,9 +1730,6 @@ export default function Sidebar() {
17281730
<span className="truncate text-sm font-medium tracking-tight text-muted-foreground">
17291731
Code
17301732
</span>
1731-
<span className="rounded-full bg-muted/50 px-1.5 py-0.5 text-[8px] font-medium uppercase tracking-[0.18em] text-muted-foreground/60">
1732-
{APP_STAGE_LABEL}
1733-
</span>
17341733
</div>
17351734
}
17361735
/>
@@ -1863,6 +1862,35 @@ export default function Sidebar() {
18631862
Projects
18641863
</span>
18651864
<div className="flex items-center gap-1">
1865+
<Tooltip>
1866+
<TooltipTrigger
1867+
render={
1868+
<button
1869+
type="button"
1870+
aria-label={appSettings.sidebarHideFiles ? "Show files" : "Hide files"}
1871+
aria-pressed={appSettings.sidebarHideFiles}
1872+
className={cn(
1873+
"inline-flex size-5 cursor-pointer items-center justify-center rounded-md transition-colors hover:bg-accent hover:text-foreground",
1874+
appSettings.sidebarHideFiles
1875+
? "text-muted-foreground/40"
1876+
: "text-muted-foreground/60",
1877+
)}
1878+
onClick={() =>
1879+
updateSettings({ sidebarHideFiles: !appSettings.sidebarHideFiles })
1880+
}
1881+
/>
1882+
}
1883+
>
1884+
{appSettings.sidebarHideFiles ? (
1885+
<EyeOffIcon className="size-3.5" />
1886+
) : (
1887+
<EyeIcon className="size-3.5" />
1888+
)}
1889+
</TooltipTrigger>
1890+
<TooltipPopup side="top">
1891+
{appSettings.sidebarHideFiles ? "Show files" : "Hide files"}
1892+
</TooltipPopup>
1893+
</Tooltip>
18661894
<ProjectSortMenu
18671895
projectSortOrder={appSettings.sidebarProjectSortOrder}
18681896
threadSortOrder={appSettings.sidebarThreadSortOrder}
@@ -2006,9 +2034,9 @@ export default function Sidebar() {
20062034
</SidebarMenu>
20072035
</DndContext>
20082036
) : (
2009-
<SidebarMenu ref={attachProjectListAutoAnimateRef}>
2037+
<SidebarMenu ref={attachProjectListAutoAnimateRef} className="gap-2">
20102038
{sortedProjects.map((project) => (
2011-
<SidebarMenuItem key={project.id} className="rounded-md mt-1.5 first:mt-0">
2039+
<SidebarMenuItem key={project.id} className="rounded-lg">
20122040
{renderProjectItem(project, null)}
20132041
</SidebarMenuItem>
20142042
))}

apps/web/src/routes/_chat.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ function ChatRouteLayout() {
130130
<Sidebar
131131
side="left"
132132
collapsible="offcanvas"
133-
className="border-r border-border bg-card text-foreground"
133+
className="border-r-2 border-border/60 bg-card/80 text-foreground backdrop-blur-sm shadow-[2px_0_12px_-4px_rgba(0,0,0,0.08)] dark:border-border/40 dark:bg-card/60 dark:shadow-[2px_0_16px_-4px_rgba(0,0,0,0.3)]"
134134
style={
135135
{
136136
"--sidebar-background-opacity": settings.sidebarOpacity,

0 commit comments

Comments
 (0)