Skip to content

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

fix(theme): update CSS imports and remove unused layout overrides

Steven Enamakel73c14edc2c39
diff --git a/app/src/index.css b/app/src/index.css
index 6b3ca4e109..59e82ed092 100644
--- a/app/src/index.css
+++ b/app/src/index.css
@@ -20,6 +20,8 @@
dependency; without it the class matches nothing and a streaming trace looks
identical to a settled one. Guarded by `src/__tests__/shimmerUtility.test.ts`. */
@import 'tw-shimmer';
+/* User border preferences (Appearance → Layout); unlayered so it wins. */
+@import './styles/layout-overrides.css';
@plugin '@tailwindcss/forms';
@plugin '@tailwindcss/typography';
diff --git a/app/src/providers/ThemeProvider.tsx b/app/src/providers/ThemeProvider.tsx
index 4a56c3adc5..5eb7b46d8b 100644
--- a/app/src/providers/ThemeProvider.tsx
+++ b/app/src/providers/ThemeProvider.tsx
@@ -1,7 +1,7 @@
-import { ReactNode, useCallback, useEffect, useRef } from 'react';
+import { ReactNode, useCallback, useEffect, useMemo, useRef } from 'react';
import { withDerivedChrome } from '../lib/theme/chrome';
-import { applyBorderContrast, applyLayoutAttributes } from '../lib/theme/layout';
+import { applyBorderContrast, applyLayoutAttributes, resolveLayout } from '../lib/theme/layout';
import { findFamily, resolveFamilyVariant } from '../lib/theme/presets';
import type { Theme } from '../lib/theme/types';
import { useAppSelector } from '../store/hooks';
@@ -9,7 +9,6 @@ import {
selectActiveFamilyId,
selectEffectiveTheme,
selectRootFontSizePx,
- selectThemeLayout,
selectThemeVariant,
} from '../store/themeSlice';
@@ -34,7 +33,10 @@ const ThemeProvider = ({ children }: { children: ReactNode }) => {
const themeVariant = useAppSelector(selectThemeVariant);
const activeFamilyId = useAppSelector(selectActiveFamilyId);
const effectiveTheme = useAppSelector(selectEffectiveTheme);
- const layout = useAppSelector(selectThemeLayout);
+ // Select the raw persisted value (stable identity) and fill defaults here, so
+ // the layout effect only re-runs when the preference actually changes.
+ const rawLayout = useAppSelector(state => state.theme?.layout);
+ const layout = useMemo(() => resolveLayout(rawLayout), [rawLayout]);
// Read inside `applyTheme` (a stable callback also fired by the OS
// light/dark listener) so border contrast is re-derived on every theme apply.
const layoutRef = useRef(layout);
diff --git a/app/src/styles/layout-overrides.css b/app/src/styles/layout-overrides.css
new file mode 100644
index 0000000000..9a58fd7b1a
--- /dev/null
+++ b/app/src/styles/layout-overrides.css
@@ -0,0 +1,40 @@
+/*
+ * Appearance → Layout → "Show borders on". `ThemeProvider` sets
+ * `data-borders-<area>="off"` on <html> for each area the user switched off
+ * (see `lib/theme/layout.ts`). Imported unlayered, after Tailwind, so these
+ * beat utility classes without `!important`.
+ */
+
+/* Cards and panels: `Card`, contained / card-style accordions. */
+html[data-borders-cards='off']
+ :is(
+ [data-slot='card'],
+ [data-slot='accordion'][data-variant='contained'],
+ [data-slot='accordion-item'][data-variant='card']
+ ) {
+ border-color: transparent;
+}
+
+/* Form controls: text fields, text areas, selects. */
+html[data-borders-controls='off']
+ :is(
+ input:not([type='checkbox'], [type='radio'], [type='range'], [type='color']),
+ textarea,
+ select,
+ [data-slot='select-trigger'],
+ [data-slot='native-select'],
+ [data-slot='input-group'],
+ [data-slot='number-field']
+ ) {
+ border-color: transparent;
+}
+
+/* Hairlines between rows (`divide-y` / `divide-x` lists). */
+html[data-borders-dividers='off'] :is([class*='divide-y'], [class*='divide-x']) > * {
+ border-color: transparent;
+}
+
+/* The edge around the main content card. */
+html[data-borders-frame='off'] {
+ --shadow-content-edge: 0 0 #0000;
+}