Skip to content

Commit 72ab059

Browse files
committed
Polish sidebar project add-row styling
- Move new-thread action into the expanded project list - Refine rename, add-project, input, and collapsible transition styles
1 parent bfe2af6 commit 72ab059

3 files changed

Lines changed: 41 additions & 40 deletions

File tree

apps/web/src/components/Sidebar.tsx

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
PlusIcon,
99
RocketIcon,
1010
SettingsIcon,
11-
SquarePenIcon,
1211
TerminalIcon,
1312
TriangleAlertIcon,
1413
} from "lucide-react";
@@ -81,7 +80,6 @@ import {
8180
SidebarFooter,
8281
SidebarGroup,
8382
SidebarHeader,
84-
SidebarMenuAction,
8583
SidebarMenu,
8684
SidebarMenuButton,
8785
SidebarMenuItem,
@@ -1302,7 +1300,7 @@ export default function Sidebar() {
13021300
el.select();
13031301
}
13041302
}}
1305-
className="min-w-0 flex-1 truncate text-xs bg-transparent outline-none border border-ring rounded px-0.5"
1303+
className="min-w-0 flex-1 truncate text-xs bg-accent/30 outline-none rounded px-1 py-px ring-1 ring-ring/40 transition-[box-shadow] duration-150 focus:ring-ring/70"
13061304
value={renamingTitle}
13071305
onChange={(e) => setRenamingTitle(e.target.value)}
13081306
onKeyDown={(e) => {
@@ -1405,37 +1403,6 @@ export default function Sidebar() {
14051403
{project.name}
14061404
</span>
14071405
</SidebarMenuButton>
1408-
<Tooltip>
1409-
<TooltipTrigger
1410-
render={
1411-
<SidebarMenuAction
1412-
render={
1413-
<button
1414-
type="button"
1415-
aria-label={`Create new thread in ${project.name}`}
1416-
data-testid="new-thread-button"
1417-
/>
1418-
}
1419-
showOnHover
1420-
className="top-1 right-1 size-5 rounded-md p-0 text-muted-foreground/70 hover:bg-secondary hover:text-foreground"
1421-
onClick={(event) => {
1422-
event.preventDefault();
1423-
event.stopPropagation();
1424-
void handleNewThread(project.id, {
1425-
envMode: resolveSidebarNewThreadEnvMode({
1426-
defaultEnvMode: appSettings.defaultThreadEnvMode,
1427-
}),
1428-
});
1429-
}}
1430-
>
1431-
<SquarePenIcon className="size-3.5" />
1432-
</SidebarMenuAction>
1433-
}
1434-
/>
1435-
<TooltipPopup side="top">
1436-
{newThreadShortcutLabel ? `New thread (${newThreadShortcutLabel})` : "New thread"}
1437-
</TooltipPopup>
1438-
</Tooltip>
14391406
</div>
14401407

14411408
<CollapsibleContent>
@@ -1475,6 +1442,40 @@ export default function Sidebar() {
14751442
</SidebarMenuSubButton>
14761443
</SidebarMenuSubItem>
14771444
)}
1445+
1446+
{project.expanded && (
1447+
<SidebarMenuSubItem className="w-full">
1448+
<SidebarMenuSubButton
1449+
render={
1450+
<button
1451+
type="button"
1452+
aria-label={`Create new thread in ${project.name}`}
1453+
data-testid="new-thread-button"
1454+
title={
1455+
newThreadShortcutLabel
1456+
? `New thread (${newThreadShortcutLabel})`
1457+
: "New thread"
1458+
}
1459+
/>
1460+
}
1461+
data-thread-selection-safe
1462+
size="sm"
1463+
className="h-6 w-full translate-x-0 justify-start gap-1.5 px-2 text-left text-[11px] text-muted-foreground/35 transition-colors duration-150 hover:bg-accent/50 hover:text-muted-foreground/65"
1464+
onClick={(event) => {
1465+
event.preventDefault();
1466+
event.stopPropagation();
1467+
void handleNewThread(project.id, {
1468+
envMode: resolveSidebarNewThreadEnvMode({
1469+
defaultEnvMode: appSettings.defaultThreadEnvMode,
1470+
}),
1471+
});
1472+
}}
1473+
>
1474+
<PlusIcon className="size-3 shrink-0" />
1475+
<span>New thread</span>
1476+
</SidebarMenuSubButton>
1477+
</SidebarMenuSubItem>
1478+
)}
14781479
</SidebarMenuSub>
14791480

14801481
{project.expanded && activeProjectThread ? (
@@ -1902,7 +1903,7 @@ export default function Sidebar() {
19021903
<div className="mb-2 px-1">
19031904
<button
19041905
type="button"
1905-
className="mb-1.5 flex w-full items-center justify-center gap-2 rounded-md border border-border bg-secondary py-1.5 text-xs text-foreground/80 transition-colors duration-150 hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-60"
1906+
className="mb-1.5 flex w-full items-center justify-center gap-2 rounded-md border border-border bg-secondary py-1.5 text-xs text-foreground/80 transition-[background-color,border-color,color] duration-150 ease-out hover:border-border/80 hover:bg-accent hover:text-foreground disabled:cursor-not-allowed disabled:opacity-60"
19061907
onClick={() => void handlePickFolder()}
19071908
disabled={isPickingFolder || isAddingProject}
19081909
>
@@ -1924,10 +1925,10 @@ export default function Sidebar() {
19241925
<div className="flex gap-1.5">
19251926
<input
19261927
ref={addProjectInputRef}
1927-
className={`min-w-0 flex-1 rounded-md border bg-secondary px-2 py-1 font-mono text-xs text-foreground placeholder:text-muted-foreground/40 focus:outline-none ${
1928+
className={`min-w-0 flex-1 rounded-md border bg-secondary px-2 py-1 font-mono text-xs text-foreground placeholder:text-muted-foreground/40 outline-none transition-[border-color,box-shadow] duration-150 ease-out ${
19281929
addProjectError
1929-
? "border-red-500/70 focus:border-red-500"
1930-
: "border-border focus:border-ring"
1930+
? "border-red-500/70 focus:border-red-500 focus:ring-1 focus:ring-red-500/20"
1931+
: "border-border focus:border-ring focus:ring-1 focus:ring-ring/20"
19311932
} ${!manualProjectPathEntry ? "cursor-pointer" : ""}`}
19321933
readOnly={!manualProjectPathEntry}
19331934
placeholder={

apps/web/src/components/ui/collapsible.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function CollapsiblePanel({ className, ...props }: CollapsiblePrimitive.Panel.Pr
2222
return (
2323
<CollapsiblePrimitive.Panel
2424
className={cn(
25-
"h-(--collapsible-panel-height) overflow-hidden transition-[height] duration-200 data-ending-style:h-0 data-starting-style:h-0 data-open:data-ending-style:[height:var(--collapsible-panel-height)]",
25+
"h-(--collapsible-panel-height) overflow-hidden transition-[height] duration-200 ease-out data-ending-style:h-0 data-starting-style:h-0 data-open:data-ending-style:[height:var(--collapsible-panel-height)]",
2626
className,
2727
)}
2828
data-slot="collapsible-panel"

apps/web/src/components/ui/input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function Input({
5454
className={
5555
cn(
5656
!unstyled &&
57-
"relative inline-flex w-full rounded-lg border border-input bg-background not-dark:bg-clip-padding text-base text-foreground shadow-xs/5 ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16 has-aria-invalid:border-destructive/36 has-focus-visible:border-ring has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none has-focus-visible:ring-[3px] not-has-disabled:has-not-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] sm:text-sm dark:bg-input/32 dark:has-aria-invalid:ring-destructive/24 dark:not-has-disabled:has-not-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)]",
57+
"relative inline-flex w-full rounded-lg border border-input bg-background not-dark:bg-clip-padding text-base text-foreground shadow-xs/5 ring-ring/24 transition-[box-shadow,border-color] duration-150 ease-out before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16 has-aria-invalid:border-destructive/36 has-focus-visible:border-ring has-disabled:opacity-64 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none has-focus-visible:ring-[3px] not-has-disabled:has-not-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] sm:text-sm dark:bg-input/32 dark:has-aria-invalid:ring-destructive/24 dark:not-has-disabled:has-not-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)]",
5858
className,
5959
) || undefined
6060
}

0 commit comments

Comments
 (0)