diff --git a/packages/session-ui/component-tests/session-message-projection.spec.ts b/packages/session-ui/component-tests/session-message-projection.spec.ts index 35e38b2a5af..c36e98adb8d 100644 --- a/packages/session-ui/component-tests/session-message-projection.spec.ts +++ b/packages/session-ui/component-tests/session-message-projection.spec.ts @@ -1,5 +1,26 @@ import { expect, story } from "../../stories/playwright/story" +story("keeps quote attachment icons fixed while long text truncates", async ({ mount, page }) => { + const gallery = await mount("current-session-timeline-rows--quote-attachments") + + await page.evaluate(() => document.fonts.ready.then(() => undefined)) + + for (const title of ["Remove this", "Can we make this smaller?"]) { + const icon = gallery + .locator('[data-component="attachment-card"]') + .filter({ hasText: title }) + .locator('[data-slot="icon-svg"]') + + await expect(icon).toHaveCSS("width", "12px") + await expect(icon).toHaveCSS("height", "12px") + } + + const label = gallery.locator('[data-slot="attachment-card-label"]').filter({ hasText: "It has a 32px minimum" }) + + expect(await label.evaluate((element) => element.scrollWidth > element.clientWidth)).toBe(true) + await expect(label).toHaveCSS("text-overflow", "ellipsis") +}) + story.describe("message actions menu", () => { story.use({ timezoneId: "UTC" }) diff --git a/packages/session-ui/src/message/attachment-card.css b/packages/session-ui/src/message/attachment-card.css index a24d6bfa148..26242b2a233 100644 --- a/packages/session-ui/src/message/attachment-card.css +++ b/packages/session-ui/src/message/attachment-card.css @@ -57,13 +57,14 @@ align-items: center; gap: 4px; min-width: 0; + min-height: 16px; overflow: hidden; white-space: nowrap; font-weight: 440; color: var(--v2-text-text-muted); [data-component="file-icon"], - [data-slot="attachment-card-icon"] { + [data-slot="icon-svg"] { width: 12px; height: 12px; flex: none; diff --git a/packages/session-ui/src/message/comment-card.tsx b/packages/session-ui/src/message/comment-card.tsx index 87e126bda4a..717934f36fa 100644 --- a/packages/session-ui/src/message/comment-card.tsx +++ b/packages/session-ui/src/message/comment-card.tsx @@ -121,7 +121,7 @@ export function CommentCard(props: { {(note) => ( <> - + {subtitle()} @@ -132,14 +132,14 @@ export function CommentCard(props: { {(text) => ( <> - + {props.comment ? text() : (source()?.label ?? i18n.t("ui.commentCard.quote"))} - + {props.comment ? i18n.t("ui.commentCard.editComment") : i18n.t("ui.commentCard.addComment")} diff --git a/packages/session-ui/src/timeline/timeline-row.stories.tsx b/packages/session-ui/src/timeline/timeline-row.stories.tsx index e02f1572473..32ce0510a88 100644 --- a/packages/session-ui/src/timeline/timeline-row.stories.tsx +++ b/packages/session-ui/src/timeline/timeline-row.stories.tsx @@ -545,6 +545,31 @@ export const PromptWithAttachments = { ), } +export const QuoteAttachments = { + render: () => ( +
+ + +
+ ), +} + export const NoteAttachments = { render: () => { const [state, setState] = createStore({ selected: "None" })