Skip to content

Commit eaaf644

Browse files
waleedlatif1Theodore Li
authored andcommitted
improvement(ui): sidebar (#3832)
1 parent de8f53e commit eaaf644

File tree

4 files changed

+35
-39
lines changed

4 files changed

+35
-39
lines changed

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/collapsed-sidebar-menu/collapsed-sidebar-menu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ function TaskStatusIcon({
128128
function WorkflowColorSwatch({ color }: { color: string }) {
129129
return (
130130
<div
131-
className='h-[14px] w-[14px] flex-shrink-0 rounded-[3px] border-[2px]'
131+
className='h-[16px] w-[16px] flex-shrink-0 rounded-sm border-[2.5px]'
132132
style={{
133133
backgroundColor: color,
134134
borderColor: `${color}60`,
@@ -161,7 +161,7 @@ export function CollapsedSidebarMenu({
161161
<button
162162
type='button'
163163
aria-label={ariaLabel}
164-
className='mx-0.5 flex h-[30px] items-center rounded-[8px] px-2 hover-hover:bg-[var(--surface-hover)]'
164+
className='mx-0.5 flex h-[30px] items-center rounded-lg px-2 hover-hover:bg-[var(--surface-hover)]'
165165
>
166166
{icon}
167167
</button>

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-sidebar/settings-sidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ export function SettingsSidebar({
210210
{/* Settings sections */}
211211
<div
212212
className={cn(
213-
'mt-3.5 flex flex-1 flex-col gap-3.5',
213+
'mt-3.5 flex flex-1 flex-col gap-3.5 pb-2',
214214
!isCollapsed && 'overflow-y-auto overflow-x-hidden'
215215
)}
216216
>

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workspace-header/workspace-header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ export function WorkspaceHeader({
343343
type='button'
344344
aria-label='Switch workspace'
345345
className={cn(
346-
'group flex h-[32px] min-w-0 items-center rounded-lg border border-[var(--border)] bg-[var(--surface-2)] pl-1.5 transition-colors hover-hover:bg-[var(--surface-5)]',
346+
'group flex h-[32px] min-w-0 items-center rounded-lg border border-[var(--border)] bg-[var(--surface-2)] pl-[5px] transition-colors hover-hover:bg-[var(--surface-5)]',
347347
isCollapsed ? 'w-[32px]' : 'w-full cursor-pointer gap-2 pr-2'
348348
)}
349349
title={activeWorkspace?.name || 'Loading...'}

apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,9 @@ const logger = createLogger('Sidebar')
102102

103103
function SidebarItemSkeleton() {
104104
return (
105-
<div className='sidebar-collapse-hide mx-0.5 flex h-[30px] items-center px-2'>
106-
<Skeleton className='h-[24px] w-full rounded-sm' />
105+
<div className='sidebar-collapse-hide mx-0.5 flex h-[30px] items-center gap-2 rounded-lg px-2'>
106+
<Skeleton className='h-[16px] w-[16px] flex-shrink-0 rounded-sm' />
107+
<Skeleton className='h-[14px] w-full rounded-sm' />
107108
</div>
108109
)
109110
}
@@ -1030,7 +1031,7 @@ export const Sidebar = memo(function Sidebar() {
10301031
const workflowsCollapsedIcon = useMemo(
10311032
() => (
10321033
<div
1033-
className='h-[16px] w-[16px] flex-shrink-0 rounded-[3px] border-[2px]'
1034+
className='h-[16px] w-[16px] flex-shrink-0 rounded-sm border-[2.5px]'
10341035
style={workflowIconStyle}
10351036
/>
10361037
),
@@ -1056,6 +1057,14 @@ export const Sidebar = memo(function Sidebar() {
10561057
// Stable no-op for collapsed workflow context menu delete (never changes)
10571058
const noop = useCallback(() => {}, [])
10581059

1060+
const handleExpandSidebar = useCallback(
1061+
(e: React.MouseEvent) => {
1062+
e.preventDefault()
1063+
toggleCollapsed()
1064+
},
1065+
[toggleCollapsed]
1066+
)
1067+
10591068
// Stable callback for the "New task" button in expanded mode
10601069
const handleNewTask = useCallback(
10611070
() => navigateToPage(`/workspace/${workspaceId}/home`),
@@ -1198,51 +1207,38 @@ export const Sidebar = memo(function Sidebar() {
11981207
<div className='flex h-full flex-col pt-3'>
11991208
{/* Top bar: Logo + Collapse toggle */}
12001209
<div className='flex flex-shrink-0 items-center pr-2 pb-2 pl-2.5'>
1201-
<div className='relative flex h-[30px] items-center'>
1202-
<Link
1203-
href={`/workspace/${workspaceId}/home`}
1204-
className='sidebar-collapse-hide sidebar-collapse-remove flex h-[30px] items-center rounded-[8px] px-1.5 hover-hover:bg-[var(--surface-hover)]'
1205-
tabIndex={isCollapsed ? -1 : 0}
1206-
>
1207-
{brand.logoUrl ? (
1208-
<Image
1209-
src={brand.logoUrl}
1210-
alt={brand.name}
1211-
width={16}
1212-
height={16}
1213-
className='h-[16px] w-[16px] object-contain'
1214-
unoptimized
1215-
/>
1216-
) : (
1217-
<Wordmark className='h-[16px] w-auto text-[var(--text-body)]' />
1218-
)}
1219-
</Link>
1220-
1210+
<div className='flex h-[30px] items-center'>
12211211
<Tooltip.Root>
12221212
<Tooltip.Trigger asChild>
1223-
<button
1224-
type='button'
1225-
onClick={toggleCollapsed}
1226-
className='sidebar-collapse-show group absolute left-0 flex h-[30px] w-[30px] items-center justify-center rounded-[8px] hover-hover:bg-[var(--surface-hover)]'
1227-
aria-label='Expand sidebar'
1228-
tabIndex={isCollapsed ? 0 : -1}
1213+
<Link
1214+
href={`/workspace/${workspaceId}/home`}
1215+
onClick={isCollapsed ? handleExpandSidebar : undefined}
1216+
className='group flex h-[30px] items-center rounded-[8px] px-1.5 hover-hover:bg-[var(--surface-hover)]'
1217+
aria-label={isCollapsed ? 'Expand sidebar' : brand.name}
12291218
>
12301219
{brand.logoUrl ? (
12311220
<Image
12321221
src={brand.logoUrl}
12331222
alt={brand.name}
12341223
width={16}
12351224
height={16}
1236-
className='h-[16px] w-[16px] object-contain group-hover:hidden'
1225+
className={cn(
1226+
'h-[16px] w-[16px] flex-shrink-0 object-contain',
1227+
isCollapsed && 'group-hover:hidden'
1228+
)}
12371229
unoptimized
12381230
/>
1231+
) : isCollapsed ? (
1232+
<Sim className='h-[16px] w-[16px] flex-shrink-0 group-hover:hidden' />
12391233
) : (
1240-
<Sim className='h-[16px] w-[16px] text-[var(--text-icon)] group-hover:hidden' />
1234+
<Wordmark className='h-[16px] w-auto text-[var(--text-body)]' />
1235+
)}
1236+
{isCollapsed && (
1237+
<PanelLeft className='hidden h-[16px] w-[16px] flex-shrink-0 rotate-180 text-[var(--text-icon)] group-hover:block' />
12411238
)}
1242-
<PanelLeft className='hidden h-[16px] w-[16px] rotate-180 text-[var(--text-icon)] group-hover:block' />
1243-
</button>
1239+
</Link>
12441240
</Tooltip.Trigger>
1245-
{isCollapsed && (
1241+
{showCollapsedTooltips && (
12461242
<Tooltip.Content side='right'>
12471243
<p>Expand sidebar</p>
12481244
</Tooltip.Content>
@@ -1272,7 +1268,7 @@ export const Sidebar = memo(function Sidebar() {
12721268
</div>
12731269

12741270
{/* Workspace Header */}
1275-
<div className='flex-shrink-0 px-2.5'>
1271+
<div className='flex-shrink-0 pr-2.5 pl-[9px]'>
12761272
<WorkspaceHeader
12771273
activeWorkspace={activeWorkspace}
12781274
workspaceId={workspaceId}

0 commit comments

Comments
 (0)