Skip to content

Commit 3cfcf50

Browse files
authored
Polish sidebar project add-row styling (#99)
- Move new-thread action into the expanded project list - Refine rename, add-project, input, and collapsible transition styles
1 parent 10d4d37 commit 3cfcf50

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
@@ -10,7 +10,6 @@ import {
1010
PlusIcon,
1111
RocketIcon,
1212
SettingsIcon,
13-
SquarePenIcon,
1413
TerminalIcon,
1514
TriangleAlertIcon,
1615
} from "lucide-react";
@@ -83,7 +82,6 @@ import {
8382
SidebarFooter,
8483
SidebarGroup,
8584
SidebarHeader,
86-
SidebarMenuAction,
8785
SidebarMenu,
8886
SidebarMenuButton,
8987
SidebarMenuItem,
@@ -1304,7 +1302,7 @@ export default function Sidebar() {
13041302
el.select();
13051303
}
13061304
}}
1307-
className="min-w-0 flex-1 truncate text-xs bg-transparent outline-none border border-ring rounded px-0.5"
1305+
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"
13081306
value={renamingTitle}
13091307
onChange={(e) => setRenamingTitle(e.target.value)}
13101308
onKeyDown={(e) => {
@@ -1407,37 +1405,6 @@ export default function Sidebar() {
14071405
{project.name}
14081406
</span>
14091407
</SidebarMenuButton>
1410-
<Tooltip>
1411-
<TooltipTrigger
1412-
render={
1413-
<SidebarMenuAction
1414-
render={
1415-
<button
1416-
type="button"
1417-
aria-label={`Create new thread in ${project.name}`}
1418-
data-testid="new-thread-button"
1419-
/>
1420-
}
1421-
showOnHover
1422-
className="top-1 right-1 size-5 rounded-md p-0 text-muted-foreground/70 hover:bg-secondary hover:text-foreground"
1423-
onClick={(event) => {
1424-
event.preventDefault();
1425-
event.stopPropagation();
1426-
void handleNewThread(project.id, {
1427-
envMode: resolveSidebarNewThreadEnvMode({
1428-
defaultEnvMode: appSettings.defaultThreadEnvMode,
1429-
}),
1430-
});
1431-
}}
1432-
>
1433-
<SquarePenIcon className="size-3.5" />
1434-
</SidebarMenuAction>
1435-
}
1436-
/>
1437-
<TooltipPopup side="top">
1438-
{newThreadShortcutLabel ? `New thread (${newThreadShortcutLabel})` : "New thread"}
1439-
</TooltipPopup>
1440-
</Tooltip>
14411408
</div>
14421409

14431410
<CollapsibleContent>
@@ -1477,6 +1444,40 @@ export default function Sidebar() {
14771444
</SidebarMenuSubButton>
14781445
</SidebarMenuSubItem>
14791446
)}
1447+
1448+
{project.expanded && (
1449+
<SidebarMenuSubItem className="w-full">
1450+
<SidebarMenuSubButton
1451+
render={
1452+
<button
1453+
type="button"
1454+
aria-label={`Create new thread in ${project.name}`}
1455+
data-testid="new-thread-button"
1456+
title={
1457+
newThreadShortcutLabel
1458+
? `New thread (${newThreadShortcutLabel})`
1459+
: "New thread"
1460+
}
1461+
/>
1462+
}
1463+
data-thread-selection-safe
1464+
size="sm"
1465+
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"
1466+
onClick={(event) => {
1467+
event.preventDefault();
1468+
event.stopPropagation();
1469+
void handleNewThread(project.id, {
1470+
envMode: resolveSidebarNewThreadEnvMode({
1471+
defaultEnvMode: appSettings.defaultThreadEnvMode,
1472+
}),
1473+
});
1474+
}}
1475+
>
1476+
<PlusIcon className="size-3 shrink-0" />
1477+
<span>New thread</span>
1478+
</SidebarMenuSubButton>
1479+
</SidebarMenuSubItem>
1480+
)}
14801481
</SidebarMenuSub>
14811482

14821483
{project.expanded && activeProjectThread && !appSettings.sidebarHideFiles ? (
@@ -1930,7 +1931,7 @@ export default function Sidebar() {
19301931
<div className="mb-2 px-1">
19311932
<button
19321933
type="button"
1933-
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"
1934+
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"
19341935
onClick={() => void handlePickFolder()}
19351936
disabled={isPickingFolder || isAddingProject}
19361937
>
@@ -1952,10 +1953,10 @@ export default function Sidebar() {
19521953
<div className="flex gap-1.5">
19531954
<input
19541955
ref={addProjectInputRef}
1955-
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 ${
1956+
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 ${
19561957
addProjectError
1957-
? "border-red-500/70 focus:border-red-500"
1958-
: "border-border focus:border-ring"
1958+
? "border-red-500/70 focus:border-red-500 focus:ring-1 focus:ring-red-500/20"
1959+
: "border-border focus:border-ring focus:ring-1 focus:ring-ring/20"
19591960
} ${!manualProjectPathEntry ? "cursor-pointer" : ""}`}
19601961
readOnly={!manualProjectPathEntry}
19611962
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)