Skip to content

Commit 48c654d

Browse files
committed
improvement(ui): sidebar
1 parent 23c3072 commit 48c654d

File tree

5 files changed

+36
-40
lines changed

5 files changed

+36
-40
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 gap-2 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
@@ -101,8 +101,9 @@ const logger = createLogger('Sidebar')
101101

102102
function SidebarItemSkeleton() {
103103
return (
104-
<div className='sidebar-collapse-hide mx-0.5 flex h-[30px] items-center px-2'>
105-
<Skeleton className='h-[24px] w-full rounded-sm' />
104+
<div className='sidebar-collapse-hide mx-0.5 flex h-[30px] items-center gap-2 rounded-lg px-2'>
105+
<Skeleton className='h-[16px] w-[16px] flex-shrink-0 rounded-sm' />
106+
<Skeleton className='h-[14px] w-full rounded-sm' />
106107
</div>
107108
)
108109
}
@@ -1027,7 +1028,7 @@ export const Sidebar = memo(function Sidebar() {
10271028
const workflowsCollapsedIcon = useMemo(
10281029
() => (
10291030
<div
1030-
className='h-[16px] w-[16px] flex-shrink-0 rounded-[3px] border-[2px]'
1031+
className='h-[16px] w-[16px] flex-shrink-0 rounded-sm border-[2.5px]'
10311032
style={workflowIconStyle}
10321033
/>
10331034
),
@@ -1053,6 +1054,14 @@ export const Sidebar = memo(function Sidebar() {
10531054
// Stable no-op for collapsed workflow context menu delete (never changes)
10541055
const noop = useCallback(() => {}, [])
10551056

1057+
const handleExpandSidebar = useCallback(
1058+
(e: React.MouseEvent) => {
1059+
e.preventDefault()
1060+
toggleCollapsed()
1061+
},
1062+
[toggleCollapsed]
1063+
)
1064+
10561065
// Stable callback for the "New task" button in expanded mode
10571066
const handleNewTask = useCallback(
10581067
() => navigateToPage(`/workspace/${workspaceId}/home`),
@@ -1171,51 +1180,38 @@ export const Sidebar = memo(function Sidebar() {
11711180
<div className='flex h-full flex-col pt-3'>
11721181
{/* Top bar: Logo + Collapse toggle */}
11731182
<div className='flex flex-shrink-0 items-center pr-2 pb-2 pl-2.5'>
1174-
<div className='relative flex h-[30px] items-center'>
1175-
<Link
1176-
href={`/workspace/${workspaceId}/home`}
1177-
className='sidebar-collapse-hide sidebar-collapse-remove flex h-[30px] items-center rounded-[8px] px-1.5 hover-hover:bg-[var(--surface-hover)]'
1178-
tabIndex={isCollapsed ? -1 : 0}
1179-
>
1180-
{brand.logoUrl ? (
1181-
<Image
1182-
src={brand.logoUrl}
1183-
alt={brand.name}
1184-
width={16}
1185-
height={16}
1186-
className='h-[16px] w-[16px] object-contain'
1187-
unoptimized
1188-
/>
1189-
) : (
1190-
<Wordmark className='h-[16px] w-auto text-[var(--text-body)]' />
1191-
)}
1192-
</Link>
1193-
1183+
<div className='flex h-[30px] items-center'>
11941184
<Tooltip.Root>
11951185
<Tooltip.Trigger asChild>
1196-
<button
1197-
type='button'
1198-
onClick={toggleCollapsed}
1199-
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)]'
1200-
aria-label='Expand sidebar'
1201-
tabIndex={isCollapsed ? 0 : -1}
1186+
<Link
1187+
href={`/workspace/${workspaceId}/home`}
1188+
onClick={isCollapsed ? handleExpandSidebar : undefined}
1189+
className='group flex h-[30px] items-center rounded-[8px] px-1.5 hover-hover:bg-[var(--surface-hover)]'
1190+
aria-label={isCollapsed ? 'Expand sidebar' : brand.name}
12021191
>
12031192
{brand.logoUrl ? (
12041193
<Image
12051194
src={brand.logoUrl}
12061195
alt={brand.name}
12071196
width={16}
12081197
height={16}
1209-
className='h-[16px] w-[16px] object-contain group-hover:hidden'
1198+
className={cn(
1199+
'h-[16px] w-[16px] flex-shrink-0 object-contain',
1200+
isCollapsed && 'group-hover:hidden'
1201+
)}
12101202
unoptimized
12111203
/>
1204+
) : isCollapsed ? (
1205+
<Sim className='h-[16px] w-[16px] flex-shrink-0 group-hover:hidden' />
12121206
) : (
1213-
<Sim className='h-[16px] w-[16px] text-[var(--text-icon)] group-hover:hidden' />
1207+
<Wordmark className='h-[16px] w-auto text-[var(--text-body)]' />
1208+
)}
1209+
{isCollapsed && (
1210+
<PanelLeft className='hidden h-[16px] w-[16px] flex-shrink-0 rotate-180 text-[var(--text-icon)] group-hover:block' />
12141211
)}
1215-
<PanelLeft className='hidden h-[16px] w-[16px] rotate-180 text-[var(--text-icon)] group-hover:block' />
1216-
</button>
1212+
</Link>
12171213
</Tooltip.Trigger>
1218-
{isCollapsed && (
1214+
{showCollapsedTooltips && (
12191215
<Tooltip.Content side='right'>
12201216
<p>Expand sidebar</p>
12211217
</Tooltip.Content>
@@ -1245,7 +1241,7 @@ export const Sidebar = memo(function Sidebar() {
12451241
</div>
12461242

12471243
{/* Workspace Header */}
1248-
<div className='flex-shrink-0 px-2.5'>
1244+
<div className='flex-shrink-0 pr-2.5 pl-[9px]'>
12491245
<WorkspaceHeader
12501246
activeWorkspace={activeWorkspace}
12511247
workspaceId={workspaceId}

apps/sim/lib/auth/hybrid.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const BEARER_PREFIX = 'Bearer '
2525
export function hasExternalApiCredentials(headers: Headers): boolean {
2626
if (headers.has(API_KEY_HEADER)) return true
2727
const auth = headers.get('authorization')
28-
return auth !== null && auth.startsWith(BEARER_PREFIX)
28+
return auth?.startsWith(BEARER_PREFIX)
2929
}
3030

3131
export interface AuthResult {

0 commit comments

Comments
 (0)