Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(ui): correct sidebar width calculation for content area

Steven Enamakelf7ec2ca0f80d
diff --git a/app/src/components/layout/contentWidth.ts b/app/src/components/layout/contentWidth.ts
new file mode 100644
index 0000000000..e441807797
--- /dev/null
+++ b/app/src/components/layout/contentWidth.ts
@@ -0,0 +1,36 @@
+import { cva, type VariantProps } from 'class-variance-authority';
+
+/**
+ * Named content-width scale for the layout primitives that center a column of
+ * page content (`PageSectionHeader`, `PageWelcome`, and — opt-in — `PanelPage`
+ * / `PanelScaffold` bodies).
+ *
+ * Audited app-wide before adding this: `max-w-md` ×28, `max-w-sm` ×18,
+ * `max-w-3xl` ×18, `max-w-2xl` ×12, `max-w-lg` ×11, `max-w-xl` ×8,
+ * `max-w-5xl` ×6, `max-w-xs` ×5, plus 30+ arbitrary `max-w-[…]` values — every
+ * caller picking its own guess rather than a shared scale. This file does not
+ * attempt to migrate all of them (most live outside `components/layout/`, and
+ * many — a truncating label, a modal body — are legitimately local rather than
+ * a page-width decision). It establishes the scale for the primitives owned
+ * here; see the migration note in the PR description for the rest.
+ *
+ * Four sizes, chosen from what the audited primitives actually needed:
+ * - `sm` — a narrow single-column read (form, empty state).
+ * - `md` — the `PageWelcome` pitch width (today's hardcoded `max-w-2xl`).
+ * - `lg` — a wider dashboard-style header/body (today's `max-w-3xl` callers).
+ * - `full` — no constraint (the default everywhere except `PageWelcome`,
+ * which centers by design).
+ */
+export const contentWidthVariants = cva('', {
+ variants: {
+ width: {
+ sm: 'max-w-lg',
+ md: 'max-w-2xl',
+ lg: 'max-w-3xl',
+ full: '',
+ },
+ },
+ defaultVariants: { width: 'full' },
+});
+
+export type ContentWidth = NonNullable<VariantProps<typeof contentWidthVariants>['width']>;
diff --git a/app/src/components/ui/Sidebar.tsx b/app/src/components/ui/Sidebar.tsx
index 5ea3b70140..e4c0641963 100644
--- a/app/src/components/ui/Sidebar.tsx
+++ b/app/src/components/ui/Sidebar.tsx
@@ -329,7 +329,9 @@ export const SidebarRail = forwardRef<HTMLDivElement, SidebarRailProps>(
{...rest}>
{/* Widened hit area — the visible seam stays 1px. */}
<span className="absolute inset-y-0 -left-1 -right-1 z-10" />
- <span className="absolute inset-0 transition-colors group-hover:bg-line group-focus:bg-line" />
+ <span
+ className={cn('absolute inset-0 transition-colors', indicatorClassName ?? DEFAULT_RAIL_INDICATOR)}
+ />
</div>
);
}