Tighten message density (#1426)

This commit is contained in:
klopez4212
2026-07-01 16:50:50 +01:00
committed by GitHub
parent c0e10d67e0
commit 6a08a3f4c8
10 changed files with 98 additions and 54 deletions

View File

@@ -25,8 +25,8 @@ const MEDIA_MAX_HEIGHT = 256; // max-h-64
const TEXT_LINE_HEIGHT = 22;
const CODE_LINE_HEIGHT = 19;
const CHARS_PER_LINE = 64; // rough wrap width at the timeline column
const ROW_CHROME = 34; // author/time header + row padding
const REACTION_ROW = 28;
const ROW_CHROME = 26; // author/time header + denser row padding
const REACTION_ROW = 24;
const PREVIEW_CARD = 96;
const MIN_ESTIMATE = 60; // never reserve less than the old flat floor

View File

@@ -16,8 +16,12 @@ import { Popover, PopoverContent, PopoverTrigger } from "@/shared/ui/popover";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/shared/ui/tooltip";
const REACTION_PILL_BASE_CLASSES =
"inline-flex h-8 items-center rounded-full border text-xs font-medium leading-none transition-colors";
const REACTION_GLYPH_CLASSES = "h-3.5 w-3.5 translate-y-px text-sm";
"inline-flex h-7 items-center rounded-full border text-xs font-medium leading-none transition-colors";
const REACTION_CUSTOM_GLYPH_CLASSES = "h-3.5 w-3.5 -translate-y-[0.5px]";
const REACTION_NATIVE_GLYPH_CLASSES = "h-3 w-3 text-xs";
const REACTION_COUNT_CLASSES = "text-muted-foreground";
const REACTION_NATIVE_COUNT_CLASSES =
"text-muted-foreground translate-y-[0.5px]";
const REACTION_PILL_HOVER_CLASSES =
"hover:bg-primary/10 hover:text-foreground focus-visible:bg-primary/10 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring";
const BADGE_BURST_STABLE_FRAMES = 2;
@@ -436,9 +440,20 @@ function ReactionPill({
ref={setPillRef}
type="button"
>
<EmojiGlyph reaction={reaction} className={REACTION_GLYPH_CLASSES} />
<EmojiGlyph
reaction={reaction}
className={
reaction.emojiUrl
? REACTION_CUSTOM_GLYPH_CLASSES
: REACTION_NATIVE_GLYPH_CLASSES
}
/>
<AnimatedCount
className="text-muted-foreground"
className={
reaction.emojiUrl
? REACTION_COUNT_CLASSES
: REACTION_NATIVE_COUNT_CLASSES
}
value={reaction.count}
/>
</button>
@@ -468,10 +483,18 @@ function ReactionPill({
>
<EmojiGlyph
reaction={reaction}
className={REACTION_GLYPH_CLASSES}
className={
reaction.emojiUrl
? REACTION_CUSTOM_GLYPH_CLASSES
: REACTION_NATIVE_GLYPH_CLASSES
}
/>
<AnimatedCount
className="text-muted-foreground"
className={
reaction.emojiUrl
? REACTION_COUNT_CLASSES
: REACTION_NATIVE_COUNT_CLASSES
}
value={reaction.count}
/>
</button>

View File

@@ -380,7 +380,7 @@ export const MessageRow = React.memo(
const actionBarNode = (
<div
className={cn(
"absolute right-2 top-1 z-10",
"absolute right-2 top-1 z-10 sm:pointer-events-none",
actionBarPlacement === "floating"
? "sm:top-0 sm:-translate-y-1/2"
: "sm:top-1 sm:translate-y-0",
@@ -644,7 +644,7 @@ export const MessageRow = React.memo(
<article
className={cn(
"group/message relative z-10 rounded-2xl transition-colors",
isThreadReplyLayout ? "py-1.5" : "py-2",
isThreadReplyLayout ? "py-1.5" : "py-1",
hoverBackground
? "mx-1 px-2 hover:bg-muted/50 focus-within:bg-muted/50"
: isThreadReplyLayout

View File

@@ -33,20 +33,20 @@ function ParticipantAvatar({
}) {
return (
<div
className={index > 0 ? "-ml-2" : ""}
className={index > 0 ? "-ml-1" : ""}
data-testid="message-thread-summary-participant"
style={{
zIndex: index + 1,
...(index < participantCount - 1 && {
mask: "radial-gradient(circle 16px at calc(100% + 4px) 50%, transparent 99%, #fff 100%)",
mask: "radial-gradient(circle 14px at calc(100% + 6px) 50%, transparent 99%, #fff 100%)",
WebkitMask:
"radial-gradient(circle 16px at calc(100% + 4px) 50%, transparent 99%, #fff 100%)",
"radial-gradient(circle 14px at calc(100% + 6px) 50%, transparent 99%, #fff 100%)",
}),
}}
>
<UserAvatar
avatarUrl={participant.avatarUrl}
className="h-7 w-7 text-2xs"
className="h-6 w-6 text-2xs"
displayName={participant.author}
size="sm"
/>
@@ -210,7 +210,7 @@ export function MessageThreadSummaryRow({
<button
aria-label={summaryAriaLabel}
className="group relative isolate inline-flex h-8 w-fit max-w-full cursor-pointer items-center gap-1.5 rounded-full py-0 pr-3 text-left text-xs font-medium text-muted-foreground transition-[color,opacity] hover:text-foreground hover:opacity-90 focus-visible:outline-hidden"
className="group relative isolate inline-flex h-[1.875rem] w-fit max-w-full cursor-pointer items-center gap-1.5 rounded-full py-0 pr-3 text-left text-xs font-medium text-muted-foreground transition-[color,opacity] hover:text-foreground hover:opacity-90 focus-visible:outline-hidden"
data-thread-head-id={message.id}
data-testid="message-thread-summary"
onClick={() => onOpenThread(message)}

View File

@@ -375,7 +375,7 @@ function MessageRowItem({
return (
<div
className={cn(
"group/message relative mx-1 mb-1.5 flex flex-col gap-0 rounded-2xl px-0 py-1 transition-colors hover:bg-muted/50 focus-within:bg-muted/50",
"group/message relative mx-1 mb-1 flex flex-col gap-0 rounded-2xl px-0 py-1 transition-colors hover:bg-muted/50 focus-within:bg-muted/50",
isHighlighted &&
"-mx-4 px-4 before:absolute before:-inset-y-1.5 before:inset-x-0 before:animate-[route-target-highlight-fade_2s_ease-out_forwards] before:bg-primary/10 before:content-[''] motion-reduce:before:animate-none sm:-mx-6 sm:px-6",
)}