Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

MUL-8329 feat(views): widen the issue and chat reading column on wide screens (#10162)

Jiayuan Zhang05259b84e2a2
diff --git a/packages/views/chat/components/chat-column.ts b/packages/views/chat/components/chat-column.ts
index 675c33d369..ddb7cece46 100644
--- a/packages/views/chat/components/chat-column.ts
+++ b/packages/views/chat/components/chat-column.ts
@@ -1,3 +1,5 @@
+import { READING_COLUMN } from "../../layout/reading-column";
+
/**
* Conversation-column geometry — ONE definition shared by every layer of the
* chat body (message rows, status banners, composer) so their left and right
@@ -9,8 +11,8 @@
* <div className={CHAT_COLUMN}> // the reading column itself
*
* Gutter OUTSIDE the cap makes the gutter a floor: it only bites while the
- * surface is narrower than the cap, and past that the column parks at
- * `max-w-4xl` and centers. The message list used to nest these the other way
+ * surface is narrower than the cap, and past that the column parks at its
+ * cap and centers. The message list used to nest these the other way
* round (`mx-auto max-w-4xl px-5` on a single element), which capped its text at
* 40px narrower than the composer card on any surface wider than ~936px — the
* two edges visibly failed to line up.
@@ -22,9 +24,10 @@
* gutter just because the window behind it is wide. Hosts therefore have to mark
* the chat column `@container`; ChatPage, ChatWindow, and the agent builder do.
* Without that ancestor the `@` variants simply never match and the column keeps
- * the base 20px, which is the old behavior rather than a broken layout.
+ * the base 20px, which is the old behavior rather than a broken layout. The
+ * column's own cap keys off the same container (see READING_COLUMN).
*/
export const CHAT_GUTTER = "px-5 @2xl:px-8 @4xl:px-12";
/** The reading column: centered, capped, full-width below the cap. */
-export const CHAT_COLUMN = "mx-auto w-full max-w-4xl";
+export const CHAT_COLUMN = READING_COLUMN;
diff --git a/packages/views/issues/components/issue-detail.test.tsx b/packages/views/issues/components/issue-detail.test.tsx
index e31cb3b8a1..3334357369 100644
--- a/packages/views/issues/components/issue-detail.test.tsx
+++ b/packages/views/issues/components/issue-detail.test.tsx
@@ -626,6 +626,7 @@ const mockTimeline: TimelineEntry[] = [
// ---------------------------------------------------------------------------
import { IssueDetail, groupSubIssuesByStage } from "./issue-detail";
+import { READING_COLUMN } from "../../layout/reading-column";
import {
IssueSurfaceSelectionProvider,
useCreateIssueSurfaceSelection,
@@ -635,6 +636,8 @@ import {
// Helpers
// ---------------------------------------------------------------------------
+const READING_COLUMN_SELECTOR = READING_COLUMN.split(" ").map((cls) => `.${CSS.escape(cls)}`).join("");
+
function createTestQueryClient() {
return new QueryClient({
defaultOptions: {
@@ -869,6 +872,27 @@ describe("IssueDetail (shared)", () => {
).toBe(true);
});
+ it("sizes the skeleton and the loaded column from the same reading container", async () => {
+ // The column's cap is relative to its scroller (`cqi`), so both scrollers
+ // have to be the container or the skeleton and the loaded column resolve
+ // the same clamp against different widths and jump when content mounts.
+ mockApiObj.getIssue.mockReturnValue(new Promise(() => {}));
+ const loadingRender = renderIssueDetail();
+ const skeletonColumn = loadingRender.container.querySelector(READING_COLUMN_SELECTOR);
+ expect(skeletonColumn).toBeTruthy();
+ expect(skeletonColumn!.parentElement).toHaveClass("@container");
+ loadingRender.unmount();
+
+ mockApiObj.getIssue.mockResolvedValue(mockIssue);
+ const { container } = renderIssueDetail();
+ await waitFor(() => {
+ expect(screen.getByText("Implement authentication")).toBeInTheDocument();
+ });
+ const column = container.querySelector(READING_COLUMN_SELECTOR);
+ expect(column).toBeTruthy();
+ expect(column!.parentElement).toHaveClass("@container");
+ });
+
it("gives the skeleton the same horizontal gutters as the loaded column", async () => {
// The skeleton is the loaded column's stand-in, so a gutter change has to
// land on both or the column jumps sideways at the moment the issue
@@ -884,7 +908,7 @@ describe("IssueDetail (shared)", () => {
mockApiObj.getIssue.mockReturnValue(new Promise(() => {}));
const loadingRender = renderIssueDetail();
const skeletonGutters = horizontalGutters(
- loadingRender.container.querySelector(".max-w-4xl"),
+ loadingRender.container.querySelector(READING_COLUMN_SELECTOR),
);
loadingRender.unmount();
@@ -897,7 +921,7 @@ describe("IssueDetail (shared)", () => {
// Non-empty guard: without it a renamed column class passes vacuously.
expect(skeletonGutters.length).toBeGreaterThan(0);
expect(skeletonGutters).toEqual(
- horizontalGutters(container.querySelector(".max-w-4xl")),
+ horizontalGutters(container.querySelector(READING_COLUMN_SELECTOR)),
);
});
diff --git a/packages/views/issues/components/issue-detail.tsx b/packages/views/issues/components/issue-detail.tsx
index dac58cf695..ef54f796de 100644
--- a/packages/views/issues/components/issue-detail.tsx
+++ b/packages/views/issues/components/issue-detail.tsx
@@ -183,6 +183,7 @@ import { cn } from "@multica/ui/lib/utils";
import { TruncatedTooltip } from "@multica/ui/components/common/truncated-tooltip";
import { CollectionPageState } from "../../layout/collection-page";
import { PAGE_GUTTER, usePageHeaderTitleBar } from "../../layout/page-header";
+import { READING_COLUMN } from "../../layout/reading-column";
import { useShowInSidebar } from "../../layout/panels/show-in-sidebar";
import { ProgressRing } from "./progress-ring";
@@ -1346,10 +1347,11 @@ export function IssueDetailSkeleton({
<div className="flex flex-1 min-h-0">
{/* Same scrollbar-gutter as the loaded scroller below, so the skeleton
column doesn't shift sideways when real content mounts. */}
- <div className="flex-1 overflow-y-auto [scrollbar-gutter:stable_both-edges]">
- {/* Gutters match the loaded column exactly (see its comment), so the
- skeleton doesn't reflow sideways when real content mounts. */}
- <div className="mx-auto w-full max-w-4xl px-3 py-6 space-y-6 md:px-8 md:py-8">
+ <div className="@container flex-1 overflow-y-auto [scrollbar-gutter:stable_both-edges]">
+ {/* Width and gutters match the loaded column exactly (see its
+ comment), so the skeleton doesn't reflow sideways when real
+ content mounts. */}
+ <div className={cn(READING_COLUMN, "px-3 py-6 space-y-6 md:px-8 md:py-8")}>
<Skeleton className="h-8 w-3/4" />
<div className="space-y-2">
<Skeleton className="h-4 w-full" />
@@ -3440,7 +3442,7 @@ export function IssueDetail({ issueId, onDelete, onDone, defaultSidebarOpen = tr
<div
ref={attachScrollContainer}
data-tab-scroll-root={isPeek ? undefined : scrollContainerKey}
- className="relative flex-1 overflow-y-auto [scrollbar-gutter:stable_both-edges]"
+ className="@container relative flex-1 overflow-y-auto [scrollbar-gutter:stable_both-edges]"
>
{/* Gutters: 32px is a comfortable reading margin on a desktop column
but eats 16% of a 393px phone, so below `md` they drop to 12px.
@@ -3450,10 +3452,11 @@ export function IssueDetail({ issueId, onDelete, onDone, defaultSidebarOpen = tr
floats — once the reader scrolls to the bottom. */}
<div
className={cn(
- "mx-auto w-full",
// The peek is already a narrow column, so it takes a tighter gutter
// and never reaches the chat launcher's corner (see IssuePeekHost).
- isPeek ? "px-6 py-5" : "max-w-4xl px-3 py-6 max-md:pb-chat-launcher md:px-8 md:py-8",
+ isPeek
+ ? "mx-auto w-full px-6 py-5"
+ : cn(READING_COLUMN, "px-3 py-6 max-md:pb-chat-launcher md:px-8 md:py-8"),
)}
>
<IssueDuplicateBanner
diff --git a/packages/views/layout/reading-column.ts b/packages/views/layout/reading-column.ts
new file mode 100644
index 0000000000..19237f924a
--- /dev/null
+++ b/packages/views/layout/reading-column.ts
@@ -0,0 +1,12 @@
+/**
+ * The reading column shared by the issue detail page and chat.
+ *
+ * The column widens with its host instead of parking at a fixed 896px: 70% of
+ * the nearest `@container`, never below 56rem (the old cap, so laptop widths
+ * are unchanged) and never above 70rem. Hosts mark that container; without one
+ * `cqi` falls back to the viewport, which still lands inside the clamp.
+ *
+ * Everything in the column shares its edges, prose included. The upper bound
+ * is what keeps lines of text readable, so raise it with that in mind.
+ */
+export const READING_COLUMN = "mx-auto w-full max-w-[clamp(56rem,70cqi,70rem)]";