Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ test("estimateRowHeight: short text is near the floor", () => {
assert.ok(h >= 60 && h < 120, `expected small, got ${h}`);
});

test("estimateRowHeight: continuation reserves its compact height", () => {
const h = estimateRowHeight(msg({ body: "hello" }), {
isContinuation: true,
});
assert.equal(h, 26);
});

test("estimateRowHeight: many lines reserve more", () => {
const tall = estimateRowHeight(
msg({ body: Array.from({ length: 20 }, (_, i) => `line ${i}`).join("\n") }),
Expand Down
4 changes: 2 additions & 2 deletions desktop/src/features/messages/lib/rowHeightEstimate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ const TEXT_LINE_HEIGHT = 20;
const CODE_LINE_HEIGHT = 19;
const CHARS_PER_LINE = 64; // rough wrap width at the timeline column
const ROW_CHROME = 26; // author/time header + denser row padding
const CONTINUATION_ROW_CHROME = 8; // dense row padding only; header/avatar are hidden
const CONTINUATION_ROW_CHROME = 0; // compact row padding only; header/avatar are hidden
Comment thread
klopez4212 marked this conversation as resolved.
Outdated
const MEDIA_BLOCK_MARGIN_TOP = 4; // image/video blocks use mt-1 in markdown
const REACTION_ROW = 24;
const PREVIEW_CARD = 70;
const MESSAGE_ITEM_BOTTOM_PADDING = 10; // TimelineMessageList pb-2.5
const MIN_ESTIMATE = 60; // never reserve less than the old flat floor
const CONTINUATION_MIN_ESTIMATE = 34;
const CONTINUATION_MIN_ESTIMATE = 26;

function mediaHeightFromDim(dim: string | undefined): number {
const dimensions = dimensionsFromDim(dim);
Expand Down
8 changes: 5 additions & 3 deletions desktop/src/features/messages/ui/MessageRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,8 @@ export const MessageRow = React.memo(
<div
aria-hidden="true"
className={cn(
"flex w-9 shrink-0 items-start justify-end pt-0.5",
isThreadReplyLayout ? "min-h-9 self-start" : "self-stretch",
"flex w-9 shrink-0 justify-end items-start pt-0.5",
isThreadReplyLayout ? "self-start" : "self-stretch",
)}
>
<MessageTimestamp
Expand Down Expand Up @@ -472,7 +472,9 @@ export const MessageRow = React.memo(
className={cn(
"absolute right-2 top-1 z-10 sm:pointer-events-none",
actionBarPlacement === "floating"
? "sm:top-0 sm:-translate-y-1/2"
? isContinuation
? "sm:-top-3 sm:-translate-y-1/2"
: "sm:top-0 sm:-translate-y-1/2"
: "sm:top-1 sm:translate-y-0",
)}
>
Expand Down
Loading