Skip to content

Commit a44720b

Browse files
refactor(web): simplify global stylesheet
Co-authored-by: Julius Marminge <[email protected]>
1 parent de22137 commit a44720b

22 files changed

Lines changed: 362 additions & 505 deletions

‎apps/web/src/components/ChatView.tsx‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6012,8 +6012,9 @@ function ChatViewContent(props: ChatViewProps) {
60126012
// One inset in both states: the controls move between containers when
60136013
// the right panel opens, and a different right offset made them jump
60146014
// sideways on every toggle.
6015-
"workspace-titlebar-controls z-50 mr-px gap-1 [-webkit-app-region:no-drag]",
6015+
"absolute top-[var(--workspace-controls-top)] right-[var(--workspace-controls-right)] z-50 mr-px flex h-[var(--workspace-topbar-height)] items-center gap-1 [-webkit-app-region:no-drag]",
60166016
)}
6017+
data-workspace-titlebar-controls
60176018
>
60186019
{rightPanelOpen && !shouldUseRightPanelSheet ? (
60196020
<RightPanelMaximizeControl
@@ -6154,12 +6155,12 @@ function ChatViewContent(props: ChatViewProps) {
61546155
"bg-background transition-[padding-left] duration-200 ease-linear motion-reduce:transition-none",
61556156
isElectron
61566157
? cn(
6157-
"workspace-topbar drag-region relative px-3 sm:px-5",
6158+
"drag-region relative flex h-[var(--workspace-topbar-height)] min-h-[var(--workspace-topbar-height)] shrink-0 items-center px-3 sm:px-5",
61586159
reserveTitleBarControlInset &&
61596160
!inlineRightPanelOwnsTitleBar &&
61606161
"wco:pr-[var(--workspace-native-controls-inset)]",
61616162
)
6162-
: "workspace-topbar pl-[calc(env(safe-area-inset-left)+0.75rem)] pr-[calc(env(safe-area-inset-right)+0.75rem)] sm:pl-[calc(env(safe-area-inset-left)+1.25rem)] sm:pr-[calc(env(safe-area-inset-right)+1.25rem)]",
6163+
: "flex h-[var(--workspace-topbar-height)] min-h-[var(--workspace-topbar-height)] shrink-0 items-center pl-[calc(env(safe-area-inset-left)+0.75rem)] pr-[calc(env(safe-area-inset-right)+0.75rem)] sm:pl-[calc(env(safe-area-inset-left)+1.25rem)] sm:pr-[calc(env(safe-area-inset-right)+1.25rem)]",
61636164
COLLAPSED_SIDEBAR_TITLEBAR_INSET_CLASS,
61646165
)}
61656166
>
@@ -6267,7 +6268,7 @@ function ChatViewContent(props: ChatViewProps) {
62676268
aria-label="Scroll to end"
62686269
title="Scroll to end"
62696270
onClick={() => scrollToEnd(true)}
6270-
className="chat-composer-glass pointer-events-auto flex items-center gap-1.5 rounded-full border border-border/60 px-3 py-1 text-muted-foreground text-xs shadow-sm transition-colors hover:border-border hover:text-foreground hover:cursor-pointer"
6271+
className="surface-glass pointer-events-auto flex cursor-pointer items-center gap-1.5 rounded-full border border-border/60 px-3 py-1 text-muted-foreground text-xs shadow-sm transition-colors hover:border-border hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background"
62716272
>
62726273
<ChevronDownIcon className="size-3.5" />
62736274
Scroll to end
@@ -6288,7 +6289,7 @@ function ChatViewContent(props: ChatViewProps) {
62886289
>
62896290
<div
62906291
ref={attachDraftHeroTransitionGroupRef}
6291-
className="chat-composer-horizontal-inset w-full"
6292+
className="w-full ps-[calc(env(safe-area-inset-left)+0.75rem)] pe-[calc(env(safe-area-inset-right)+0.75rem)] sm:ps-[calc(env(safe-area-inset-left)+1.25rem)] sm:pe-[calc(env(safe-area-inset-right)+1.25rem)]"
62926293
>
62936294
<div className="pointer-events-auto relative z-10">
62946295
{isDraftHeroState ? (

‎apps/web/src/components/DiffPanelShell.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function getDiffPanelHeaderRowClassName(mode: DiffPanelMode) {
1414
mode === "embedded" ? "px-2" : "px-4",
1515
shouldUseDragRegion
1616
? "drag-region h-[52px] border-b border-border wco:h-[env(titlebar-area-height)] wco:pr-[calc(100vw-env(titlebar-area-width)-env(titlebar-area-x)+1em)]"
17-
: "surface-subheader",
17+
: "flex h-10 min-h-10 shrink-0 items-center border-b border-border/60 bg-background",
1818
);
1919
}
2020

‎apps/web/src/components/NoActiveThreadState.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ export function NoActiveThreadState() {
1111
<header
1212
className={cn(
1313
"border-b border-border px-3 transition-[padding-left] duration-200 ease-linear motion-reduce:transition-none sm:px-5",
14-
isElectron ? "workspace-topbar drag-region" : "workspace-topbar",
14+
isElectron
15+
? "drag-region flex h-[var(--workspace-topbar-height)] min-h-[var(--workspace-topbar-height)] shrink-0 items-center"
16+
: "flex h-[var(--workspace-topbar-height)] min-h-[var(--workspace-topbar-height)] shrink-0 items-center",
1517
COLLAPSED_SIDEBAR_TITLEBAR_INSET_CLASS,
1618
)}
1719
>

‎apps/web/src/components/RightPanelTabs.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ export function RightPanelTabs(props: RightPanelTabsProps) {
592592
>
593593
<div
594594
className={cn(
595-
"workspace-topbar gap-1 pl-2",
595+
"flex h-[var(--workspace-topbar-height)] min-h-[var(--workspace-topbar-height)] shrink-0 items-center gap-1 pl-2",
596596
props.mode !== "inline" && "[--workspace-topbar-height:--spacing(11)]",
597597
props.mode === "inline" && !props.layoutControls ? "pr-28" : "pr-3",
598598
ownsDesktopTitleBar && "wco:pr-[calc(var(--workspace-native-controls-inset)+6rem)]",

‎apps/web/src/components/chat/MessagesTimeline.test.tsx‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -226,22 +226,6 @@ function buildUserTimelineEntry(text: string) {
226226
}
227227

228228
describe("MessagesTimeline", () => {
229-
it("uses the larger leading inset only when the top fade is enabled", () => {
230-
const timelineEntries = [buildUserTimelineEntry("Hello")];
231-
232-
const compactMarkup = renderToStaticMarkup(
233-
<MessagesTimeline {...buildProps()} timelineEntries={timelineEntries} />,
234-
);
235-
const fadedMarkup = renderToStaticMarkup(
236-
<MessagesTimeline {...buildProps()} timelineEntries={timelineEntries} topFadeEnabled />,
237-
);
238-
239-
expect(compactMarkup).toContain('class="h-3 sm:h-4"');
240-
expect(compactMarkup).not.toContain("chat-timeline-scroll-fade");
241-
expect(fadedMarkup).toContain('class="h-10 sm:h-12"');
242-
expect(fadedMarkup).toContain("chat-timeline-scroll-fade");
243-
});
244-
245229
it("keeps assistant changed-files headers sticky below the thread header", () => {
246230
const assistantMessageId = MessageId.make("message-assistant-with-files");
247231
const turnId = TurnId.make("turn-with-files");

‎apps/web/src/components/chat/MessagesTimeline.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ export const MessagesTimeline = memo(function MessagesTimeline({
591591
onScroll={handleScroll}
592592
className={cn(
593593
"scrollbar-gutter-both h-full min-h-0 overflow-x-hidden overscroll-y-contain px-3 [overflow-anchor:none] sm:px-5",
594-
topFadeEnabled && "chat-timeline-scroll-fade",
594+
topFadeEnabled && "topbar-scroll-fade",
595595
)}
596596
ListHeaderComponent={
597597
loadEarlier !== null ? (

‎apps/web/src/components/chat/ModelPickerContent.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ export const ModelPickerContent = memo(function ModelPickerContent(props: {
598598
return (
599599
<TooltipProvider delay={0}>
600600
<div
601-
className="dropdown-glass model-picker-surface relative flex h-screen max-h-86.5 w-screen max-w-90 flex-row overflow-hidden rounded-lg text-popover-foreground [clip-path:inset(0_round_var(--radius-lg))]"
601+
className="dropdown-glass relative flex h-screen max-h-86.5 w-screen max-w-90 flex-row overflow-hidden rounded-lg text-popover-foreground [clip-path:inset(0_round_var(--radius-lg))]"
602602
data-model-picker-content="true"
603603
>
604604
{/* Sidebar */}

‎apps/web/src/components/files/FileBrowserPanel.tsx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,10 @@ export default function FileBrowserPanel({
350350
className="flex min-h-0 flex-1 flex-col bg-background"
351351
data-file-browser-panel={`${environmentId}:${cwd}`}
352352
>
353-
<div className="surface-subheader gap-1 px-2" data-surface-subheader>
353+
<div
354+
className="flex h-10 min-h-10 shrink-0 items-center gap-1 border-b border-border/60 bg-background px-2"
355+
data-surface-subheader
356+
>
354357
<RefreshFilesButton isPending={entriesQuery.isPending} onRefresh={entriesQuery.refresh} />
355358
<FileSearchField
356359
name="project-files-search"

‎apps/web/src/components/files/FilePreviewPanel.tsx‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,10 @@ export default function FilePreviewPanel({
857857
return (
858858
<div className="flex min-h-0 flex-1 flex-col overflow-hidden bg-background">
859859
{relativePath ? (
860-
<div className="surface-subheader gap-2 px-3" data-surface-subheader>
860+
<div
861+
className="flex h-10 min-h-10 shrink-0 items-center gap-2 border-b border-border/60 bg-background px-3"
862+
data-surface-subheader
863+
>
861864
<ScrollArea
862865
ref={breadcrumbRef}
863866
hideScrollbars

‎apps/web/src/components/preview/PreviewChromeRow.tsx‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ export function PreviewChromeRow({
109109

110110
return (
111111
<div className="relative">
112-
<form onSubmit={submit} className="surface-subheader gap-1 px-2" data-surface-subheader>
112+
<form
113+
onSubmit={submit}
114+
className="flex h-10 min-h-10 shrink-0 items-center gap-1 border-b border-border/60 bg-background px-2"
115+
data-surface-subheader
116+
>
113117
<div className="flex items-center gap-0.5" role="group" aria-label="Navigation">
114118
<Tooltip>
115119
<TooltipTrigger

0 commit comments

Comments
 (0)