Skip to content

Commit 0fbd0e8

Browse files
[verified] fix(desktop): remove Thread Rail backing corners
Signed-off-by: Empire Operating <[email protected]>
1 parent 0525755 commit 0fbd0e8

4 files changed

Lines changed: 134 additions & 100 deletions

File tree

‎desktop/src/features/channels/threadRailLayout.test.mjs‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import test from "node:test";
44
import {
55
isThreadRailVisible,
66
projectThreadRailLayout,
7+
threadRailColumnClassName,
78
threadRailEntryClassName,
89
threadRailHeaderClassName,
910
threadRailShellClassName,
@@ -16,6 +17,19 @@ test("isThreadRailVisible hides the rail at and below the desktop breakpoint", (
1617
assert.equal(isThreadRailVisible(601, 0), false);
1718
});
1819

20+
test("Thread Rail column replaces exposed sidebar paint without adding corners", () => {
21+
const className = threadRailColumnClassName();
22+
23+
assert.match(className, /buzz-theme-gradient-underlay/);
24+
assert.match(className, /self-stretch/);
25+
assert.match(className, /shrink-0/);
26+
assert.doesNotMatch(className, /rounded/);
27+
assert.doesNotMatch(className, /bg-background/);
28+
assert.doesNotMatch(className, /bg-sidebar/);
29+
assert.doesNotMatch(className, /shadow/);
30+
assert.doesNotMatch(className, /ring/);
31+
});
32+
1933
test("Thread Rail paints a compact rounded card capped at the content bounds", () => {
2034
for (const collapsed of [false, true]) {
2135
const className = threadRailShellClassName(collapsed);

‎desktop/src/features/channels/threadRailLayout.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
export const THREAD_RAIL_DESKTOP_BREAKPOINT_PX = 600;
22

3+
export function threadRailColumnClassName(): string {
4+
return "buzz-theme-gradient-underlay hidden min-h-0 shrink-0 self-stretch min-[601px]:flex min-[601px]:flex-col";
5+
}
6+
37
export function threadRailShellClassName(_collapsed: boolean): string {
48
return [
59
"hidden mb-2 mr-2 mt-px max-h-[calc(100%-0.5625rem)] min-h-0 shrink-0 self-start overflow-hidden rounded-2xl bg-background shadow-content-edge ring-1 ring-border/30 ring-inset",
Lines changed: 104 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { ChevronLeft, ChevronRight, MessageSquareText, X } from "lucide-react";
22

33
import {
4+
threadRailColumnClassName,
45
threadRailEntryClassName,
56
threadRailHeaderClassName,
67
threadRailShellClassName,
@@ -36,111 +37,116 @@ export function ThreadRail({
3637
}) {
3738
if (pins.length === 0) return null;
3839
return (
39-
<aside
40-
aria-label="Pinned threads"
41-
className={cn(
42-
threadRailShellClassName(collapsed),
43-
collapsed ? "min-[601px]:w-10" : "min-[601px]:w-56",
44-
)}
45-
data-collapsed={collapsed}
46-
data-testid="thread-rail"
40+
<div
41+
className={threadRailColumnClassName()}
42+
data-testid="thread-rail-column"
4743
>
48-
<div
44+
<aside
45+
aria-label="Pinned threads"
4946
className={cn(
50-
threadRailHeaderClassName(),
51-
collapsed ? "justify-center px-1" : "justify-between",
47+
threadRailShellClassName(collapsed),
48+
collapsed ? "min-[601px]:w-10" : "min-[601px]:w-56",
5249
)}
53-
data-testid="thread-rail-header"
50+
data-collapsed={collapsed}
51+
data-testid="thread-rail"
5452
>
55-
{!collapsed ? (
56-
<span className="truncate text-base font-semibold leading-6 tracking-tight">
57-
Pinned threads
58-
</span>
59-
) : null}
60-
<Button
61-
aria-expanded={!collapsed}
62-
aria-label={
63-
collapsed
64-
? `Expand ${pins.length} pinned threads`
65-
: "Collapse pinned threads"
66-
}
67-
data-testid="thread-rail-toggle"
68-
onClick={onToggleCollapsed}
69-
size="icon"
70-
type="button"
71-
variant="ghost"
72-
>
73-
{collapsed ? (
74-
<ChevronLeft aria-hidden />
75-
) : (
76-
<ChevronRight aria-hidden />
53+
<div
54+
className={cn(
55+
threadRailHeaderClassName(),
56+
collapsed ? "justify-center px-1" : "justify-between",
7757
)}
78-
</Button>
79-
</div>
80-
{!collapsed ? (
81-
<div className="min-h-0 space-y-1 overflow-y-auto px-2 pb-2 pt-1">
82-
{pins.map((pin) => {
83-
const active = isThreadRailPinActive(
84-
pin,
85-
selectedChannelId,
86-
openThreadRootId,
87-
);
88-
const hasUnread = unreadRootIds.has(pin.rootId);
89-
const label = `${pin.channelName ? `#${pin.channelName}: ` : ""}${
90-
pin.rootExcerpt || "Pinned thread"
91-
}`;
92-
return (
93-
<div
94-
className={threadRailEntryClassName(active)}
95-
data-testid={`thread-rail-row-${pin.rootId}`}
96-
key={`${pin.channelId}:${pin.rootId}`}
97-
>
98-
<button
99-
aria-current={active ? "page" : undefined}
100-
aria-label={hasUnread ? `${label}, unread reply` : label}
101-
className="min-w-0 flex-1 px-2.5 py-2 text-left text-sm focus-visible:outline-hidden"
102-
data-testid={`thread-rail-entry-${pin.rootId}`}
103-
onClick={() =>
104-
onNavigate(threadRailPinToChannelNavigation(pin))
105-
}
106-
title={label}
107-
type="button"
58+
data-testid="thread-rail-header"
59+
>
60+
{!collapsed ? (
61+
<span className="truncate text-base font-semibold leading-6 tracking-tight">
62+
Pinned threads
63+
</span>
64+
) : null}
65+
<Button
66+
aria-expanded={!collapsed}
67+
aria-label={
68+
collapsed
69+
? `Expand ${pins.length} pinned threads`
70+
: "Collapse pinned threads"
71+
}
72+
data-testid="thread-rail-toggle"
73+
onClick={onToggleCollapsed}
74+
size="icon"
75+
type="button"
76+
variant="ghost"
77+
>
78+
{collapsed ? (
79+
<ChevronLeft aria-hidden />
80+
) : (
81+
<ChevronRight aria-hidden />
82+
)}
83+
</Button>
84+
</div>
85+
{!collapsed ? (
86+
<div className="min-h-0 space-y-1 overflow-y-auto px-2 pb-2 pt-1">
87+
{pins.map((pin) => {
88+
const active = isThreadRailPinActive(
89+
pin,
90+
selectedChannelId,
91+
openThreadRootId,
92+
);
93+
const hasUnread = unreadRootIds.has(pin.rootId);
94+
const label = `${pin.channelName ? `#${pin.channelName}: ` : ""}${
95+
pin.rootExcerpt || "Pinned thread"
96+
}`;
97+
return (
98+
<div
99+
className={threadRailEntryClassName(active)}
100+
data-testid={`thread-rail-row-${pin.rootId}`}
101+
key={`${pin.channelId}:${pin.rootId}`}
108102
>
109-
<span className="flex items-center gap-2">
110-
<MessageSquareText
111-
aria-hidden
112-
className="size-3.5 shrink-0 text-muted-foreground"
113-
/>
114-
<span className="min-w-0 flex-1 truncate">{label}</span>
115-
{hasUnread ? (
116-
<span
103+
<button
104+
aria-current={active ? "page" : undefined}
105+
aria-label={hasUnread ? `${label}, unread reply` : label}
106+
className="min-w-0 flex-1 px-2.5 py-2 text-left text-sm focus-visible:outline-hidden"
107+
data-testid={`thread-rail-entry-${pin.rootId}`}
108+
onClick={() =>
109+
onNavigate(threadRailPinToChannelNavigation(pin))
110+
}
111+
title={label}
112+
type="button"
113+
>
114+
<span className="flex items-center gap-2">
115+
<MessageSquareText
117116
aria-hidden
118-
className="size-2 shrink-0 rounded-full bg-primary"
119-
data-testid={`thread-rail-unread-${pin.rootId}`}
117+
className="size-3.5 shrink-0 text-muted-foreground"
120118
/>
121-
) : null}
122-
</span>
123-
</button>
124-
<Button
125-
aria-label={`Unpin ${label}`}
126-
className="mr-1 shrink-0 opacity-0 group-hover:opacity-100 focus-visible:opacity-100"
127-
data-testid={`unpin-thread-rail-${pin.rootId}`}
128-
onClick={(event) => {
129-
event.stopPropagation();
130-
onUnpin(pin);
131-
}}
132-
size="icon-xs"
133-
title="Unpin thread"
134-
type="button"
135-
variant="ghost"
136-
>
137-
<X aria-hidden />
138-
</Button>
139-
</div>
140-
);
141-
})}
142-
</div>
143-
) : null}
144-
</aside>
119+
<span className="min-w-0 flex-1 truncate">{label}</span>
120+
{hasUnread ? (
121+
<span
122+
aria-hidden
123+
className="size-2 shrink-0 rounded-full bg-primary"
124+
data-testid={`thread-rail-unread-${pin.rootId}`}
125+
/>
126+
) : null}
127+
</span>
128+
</button>
129+
<Button
130+
aria-label={`Unpin ${label}`}
131+
className="mr-1 shrink-0 opacity-0 group-hover:opacity-100 focus-visible:opacity-100"
132+
data-testid={`unpin-thread-rail-${pin.rootId}`}
133+
onClick={(event) => {
134+
event.stopPropagation();
135+
onUnpin(pin);
136+
}}
137+
size="icon-xs"
138+
title="Unpin thread"
139+
type="button"
140+
variant="ghost"
141+
>
142+
<X aria-hidden />
143+
</Button>
144+
</div>
145+
);
146+
})}
147+
</div>
148+
) : null}
149+
</aside>
150+
</div>
145151
);
146152
}

‎desktop/tests/e2e/thread-rail.spec.ts‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,21 @@ test("pins a canonical thread, switches it from the collapsible rail, and unpins
5959
const railElement = document.querySelector<HTMLElement>(
6060
'[data-testid="thread-rail"]',
6161
);
62+
const railColumnElement = document.querySelector<HTMLElement>(
63+
'[data-testid="thread-rail-column"]',
64+
);
6265
const contentElement = document.querySelector<HTMLElement>(
6366
"[data-buzz-content-surface]:not([data-buzz-content-unframed])",
6467
);
65-
if (!railElement || !contentElement) {
66-
throw new Error("Thread Rail or framed content surface unavailable");
68+
if (!railElement || !railColumnElement || !contentElement) {
69+
throw new Error(
70+
"Thread Rail, rail column, or framed content surface unavailable",
71+
);
6772
}
6873
const railRect = railElement.getBoundingClientRect();
6974
const contentRect = contentElement.getBoundingClientRect();
7075
const railStyle = getComputedStyle(railElement);
76+
const railColumnStyle = getComputedStyle(railColumnElement);
7177
const contentStyle = getComputedStyle(contentElement);
7278
return {
7379
railTop: Math.round(railRect.top),
@@ -77,6 +83,8 @@ test("pins a canonical thread, switches it from the collapsible rail, and unpins
7783
railRadius: railStyle.borderTopLeftRadius,
7884
contentRadius: contentStyle.borderTopLeftRadius,
7985
railBackground: railStyle.backgroundColor,
86+
railColumnBackgroundImage: railColumnStyle.backgroundImage,
87+
railColumnRadius: railColumnStyle.borderTopLeftRadius,
8088
contentBackground: contentStyle.backgroundColor,
8189
railClipPath: railStyle.clipPath,
8290
};
@@ -87,6 +95,8 @@ test("pins a canonical thread, switches it from the collapsible rail, and unpins
8795
railBackground: paneGeometry.contentBackground,
8896
});
8997
expect(paneGeometry.railBottom).toBeLessThan(paneGeometry.contentBottom);
98+
expect(paneGeometry.railColumnRadius).toBe("0px");
99+
expect(paneGeometry.railColumnBackgroundImage).toContain("linear-gradient");
90100
expect(paneGeometry.railClipPath).toBe("none");
91101
const entry = rail.getByTestId(`thread-rail-entry-${root.id}`);
92102
await expect(entry).toHaveAttribute("aria-current", "page");

0 commit comments

Comments
 (0)