From 7314f89b4d80274ca7595f51a93bd897c4b56419 Mon Sep 17 00:00:00 2001 From: Justin Blumencranz <96924014+j15z@users.noreply.github.com> Date: Thu, 13 Aug 2026 19:29:54 -0700 Subject: [PATCH 1/3] fix(sidebar): align credits chip with panel toggle and square the collapsed rail --- .../resource-tabs/resource-tab-controls.ts | 13 ++-- .../app/workspace/[workspaceId]/home/home.tsx | 65 +++++++++---------- .../collapsed-sidebar-menu.tsx | 3 +- .../settings-sidebar/settings-sidebar.tsx | 12 +++- .../sidebar-footer/sidebar-footer.tsx | 17 +++-- .../workspace-header/workspace-header.tsx | 3 +- .../w/components/sidebar/constants.ts | 26 ++++++++ .../w/components/sidebar/sidebar.tsx | 22 ++++++- 8 files changed, 110 insertions(+), 51 deletions(-) diff --git a/apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-tabs/resource-tab-controls.ts b/apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-tabs/resource-tab-controls.ts index cf8f02ac5ab..5d5697d7be9 100644 --- a/apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-tabs/resource-tab-controls.ts +++ b/apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-tabs/resource-tab-controls.ts @@ -7,13 +7,18 @@ export const RESOURCE_TAB_ICON_CLASS = 'size-[16px] text-[var(--text-icon)]' /** Shared geometry for the resource header and controls positioned over it. */ export const RESOURCE_HEADER_CLASSES = { layout: - '[--resource-header-controls-height:43px] [--resource-header-end-inset:16px] [--resource-header-fixed-reserve:54px]', + '[--resource-header-controls-height:43px] [--resource-header-end-inset:16px] [--resource-header-fixed-reserve:54px] [--resource-header-toggle-size:30px]', bar: 'h-[calc(var(--resource-header-controls-height)_+_1px)]', - controls: 'h-[var(--resource-header-controls-height)]', - contentTop: 'top-[8.5px]', + overlay: 'absolute top-0 flex h-[var(--resource-header-controls-height)] items-center', startPadding: 'pl-[var(--resource-header-end-inset)]', endPadding: 'pr-[var(--resource-header-fixed-reserve)]', endPosition: 'right-[var(--resource-header-end-inset)]', - adjacentEndPosition: 'right-[var(--resource-header-fixed-reserve)]', + /** + * Sits a control 1px clear of the overlaid 30px collapse toggle — the same + * chip-to-chip gap the sidebar header cluster uses (`gap-[1px]`), so the + * credits chip and the toggle read as one cluster across both surfaces. + */ + adjacentEndPosition: + 'right-[calc(var(--resource-header-end-inset)_+_var(--resource-header-toggle-size)_+_1px)]', emptyAddOffset: '-translate-x-1.5', } as const diff --git a/apps/sim/app/workspace/[workspaceId]/home/home.tsx b/apps/sim/app/workspace/[workspaceId]/home/home.tsx index dd5d02da37d..eba97d8274e 100644 --- a/apps/sim/app/workspace/[workspaceId]/home/home.tsx +++ b/apps/sim/app/workspace/[workspaceId]/home/home.tsx @@ -283,21 +283,32 @@ export function Home({ chatId, userName, userId, tableViewsEnabled }: HomeProps) setIsResourceCollapsed(true) }, [clearWidth]) + const clearResourceActivity = useCallback((resourceId: string) => { + setResourceActivityIds((current) => { + if (!current.has(resourceId)) return current + const next = new Set(current) + next.delete(resourceId) + return next + }) + }, []) + + const expandResource = () => { + userOwnsResourceViewRef.current = true + const activeResourceId = activeResourceParamRef.current + if (activeResourceId) clearResourceActivity(activeResourceId) + setIsResourceCollapsed(false) + } + const selectResourceFromUser = useCallback( (resourceId: string) => { userOwnsResourceViewRef.current = true - setResourceActivityIds((current) => { - if (!current.has(resourceId)) return current - const next = new Set(current) - next.delete(resourceId) - return next - }) + clearResourceActivity(resourceId) if (effectiveActiveResourceIdRef.current === resourceId) return effectiveActiveResourceIdRef.current = resourceId activeResourceParamRef.current = resourceId setActiveResourceId(resourceId) }, - [setActiveResourceId] + [setActiveResourceId, clearResourceActivity] ) const addResourceFromUser = useCallback( @@ -581,9 +592,17 @@ export function Home({ chatId, userName, userId, tableViewsEnabled }: HomeProps) {showEmptyState && (
@@ -690,34 +709,14 @@ export function Home({ chatId, userName, userId, tableViewsEnabled }: HomeProps)
diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-sidebar/settings-sidebar.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-sidebar/settings-sidebar.tsx index 51721d89430..504105afec6 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-sidebar/settings-sidebar.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-sidebar/settings-sidebar.tsx @@ -31,6 +31,7 @@ import { SIDEBAR_DIVIDER_PAD_ABOVE_CLASS, SIDEBAR_DIVIDER_PAD_BELOW_CLASS, SIDEBAR_ITEM_GAP_CLASS, + SIDEBAR_RAIL_CHIP_CLASS, SIDEBAR_SECTION_GAP_CLASS, } from '@/app/workspace/[workspaceId]/w/components/sidebar/constants' import { SidebarTooltip } from '@/app/workspace/[workspaceId]/w/components/sidebar/sidebar' @@ -305,7 +306,11 @@ export function SettingsSidebar({ )} > -