Skip to content

Commit de13960

Browse files
authored
fix(desktop): keep project Inbox previews compact (#3193)
## Summary Project pull request and issue previews in Inbox no longer expand when their content begins with a Markdown heading. Heading-form titles now match neighboring Inbox typography while preserving the existing two-line truncation. ### Related issue Related: #3117 ### Testing - `pnpm build:e2e` - `pnpm exec playwright test tests/e2e/project-inbox.spec.ts --project=smoke --retries=0` — passed - `pnpm exec biome check tests/e2e/project-inbox.spec.ts src/shared/styles/globals/markdown.css` — passed - `pnpm check:px-text` — passed - Captured `desktop/test-results/inbox-preview/01-project-preview.png` The repository-wide desktop file-size gate remains blocked by the pre-existing 1,026-line `AgentCreationPreview.tsx` on `main`; the change itself introduces no file-size regression. Signed-off-by: Thomas Petersen <thomasp@squareup.com>
1 parent 2bd4c24 commit de13960

2 files changed

Lines changed: 34 additions & 1 deletion

File tree

‎desktop/src/shared/styles/globals/markdown.css‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@
118118
display: -webkit-box;
119119
-webkit-box-orient: vertical;
120120
-webkit-line-clamp: 2;
121+
font-size: inherit;
122+
font-weight: inherit;
123+
letter-spacing: inherit;
124+
line-height: inherit;
121125
overflow: hidden;
122126
}
123127

‎desktop/tests/e2e/project-inbox.spec.ts‎

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ test("Buzz Git pull request renders and stays actionable in Inbox", async ({
4646
id,
4747
kind: 1618,
4848
pubkey: author,
49-
content: "Inbox rendering verification",
49+
content: "# Inbox rendering verification",
5050
created_at: Math.floor(Date.now() / 1000) + 1,
5151
channel_id: null,
5252
channel_name: "",
@@ -69,6 +69,35 @@ test("Buzz Git pull request renders and stays actionable in Inbox", async ({
6969

7070
const inboxRow = page.getByTestId(`home-inbox-item-${pullRequestId}`);
7171
await expect(inboxRow).toBeVisible({ timeout: 10_000 });
72+
const previewTypography = await inboxRow
73+
.locator(".inbox-preview-markdown")
74+
.evaluate((preview) => {
75+
const firstBlock = preview.firstElementChild;
76+
if (!firstBlock) {
77+
throw new Error("Expected the Inbox preview to render a first block.");
78+
}
79+
const previewStyle = getComputedStyle(preview);
80+
const firstBlockStyle = getComputedStyle(firstBlock);
81+
return {
82+
firstBlockTag: firstBlock.tagName,
83+
fontSizeMatches: firstBlockStyle.fontSize === previewStyle.fontSize,
84+
fontWeightMatches:
85+
firstBlockStyle.fontWeight === previewStyle.fontWeight,
86+
letterSpacingMatches:
87+
firstBlockStyle.letterSpacing === previewStyle.letterSpacing,
88+
lineHeightMatches:
89+
firstBlockStyle.lineHeight === previewStyle.lineHeight,
90+
lineClamp: firstBlockStyle.webkitLineClamp,
91+
};
92+
});
93+
expect(previewTypography).toEqual({
94+
firstBlockTag: "H1",
95+
fontSizeMatches: true,
96+
fontWeightMatches: true,
97+
letterSpacingMatches: true,
98+
lineHeightMatches: true,
99+
lineClamp: "2",
100+
});
72101
await inboxRow.locator(":scope > div").first().click();
73102

74103
const detail = page.getByTestId("home-project-inbox-detail");

0 commit comments

Comments
 (0)
Sponsor
SponsoredKunjungi sekarang
Promo