Skip to content

Commit b84f8e6

Browse files
authored
Polish message row hover states (#880)
1 parent bc53008 commit b84f8e6

6 files changed

Lines changed: 18 additions & 7 deletions

File tree

desktop/src/features/messages/ui/DayDivider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export function DayDivider({ label }: { label: string }) {
66
data-testid="message-timeline-day-divider"
77
data-day-label={label}
88
>
9-
<p className="shrink-0 rounded-full bg-background/90 px-2 py-0.5 text-[10px] font-medium tracking-[0.02em] text-muted-foreground/65 backdrop-blur-sm">
9+
<p className="shrink-0 rounded-lg border border-border/70 bg-background/95 px-2 py-1 text-[10px] font-medium tracking-[0.02em] text-muted-foreground/70 shadow-xs backdrop-blur-sm">
1010
{label}
1111
</p>
1212
</section>

desktop/src/features/messages/ui/MessageRow.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export const MessageRow = React.memo(
3030
function MessageRow({
3131
channelId = null,
3232
highlighted = false,
33+
hoverBackground = true,
3334
isFollowingThread,
3435
layoutVariant = "default",
3536
message,
@@ -45,6 +46,7 @@ export const MessageRow = React.memo(
4546
}: {
4647
channelId?: string | null;
4748
highlighted?: boolean;
49+
hoverBackground?: boolean;
4850
isFollowingThread?: boolean;
4951
layoutVariant?: "default" | "thread-reply";
5052
message: TimelineMessage;
@@ -314,7 +316,8 @@ export const MessageRow = React.memo(
314316

315317
<article
316318
className={cn(
317-
"group/message relative rounded-2xl px-2 py-1 transition-colors",
319+
"group/message relative rounded-2xl px-3 py-2 transition-colors",
320+
hoverBackground && "hover:bg-muted/50 focus-within:bg-muted/50",
318321
"flex items-start gap-2.5",
319322
highlighted
320323
? "-mx-4 rounded-none px-6 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-8"
@@ -448,6 +451,7 @@ export const MessageRow = React.memo(
448451
prev.message.role === next.message.role &&
449452
prev.message.personaDisplayName === next.message.personaDisplayName &&
450453
prev.highlighted === next.highlighted &&
454+
prev.hoverBackground === next.hoverBackground &&
451455
prev.isFollowingThread === next.isFollowingThread &&
452456
prev.layoutVariant === next.layoutVariant &&
453457
prev.profiles === next.profiles &&

desktop/src/features/messages/ui/MessageThreadPanel.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,11 +309,16 @@ export function MessageThreadPanel({
309309
{threadReplies.map((entry) => {
310310
return (
311311
<div
312-
className="flex flex-col gap-1"
312+
className={cn(
313+
"flex flex-col gap-1",
314+
entry.summary &&
315+
"group/message -mx-1 rounded-2xl px-1 py-1 transition-colors hover:bg-muted/50 focus-within:bg-muted/50",
316+
)}
313317
key={entry.message.id}
314318
>
315319
<MessageRow
316320
channelId={channelId}
321+
hoverBackground={!entry.summary}
317322
layoutVariant="thread-reply"
318323
message={entry.message}
319324
onDelete={

desktop/src/features/messages/ui/SystemMessageRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ export const SystemMessageRow = React.memo(function SystemMessageRow({
321321

322322
return (
323323
<div
324-
className="group/message relative rounded-2xl px-2 py-1 transition-colors"
324+
className="group/message relative rounded-2xl px-3 py-2 transition-colors hover:bg-muted/50 focus-within:bg-muted/50"
325325
data-testid="system-message-row"
326326
>
327327
<div className="flex items-start gap-2.5">

desktop/src/features/messages/ui/TimelineMessageList.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,15 @@ export const TimelineMessageList = React.memo(function TimelineMessageList({
108108
<div
109109
key={message.id}
110110
className={cn(
111-
"relative flex flex-col gap-0",
111+
"group/message relative -mx-1 flex flex-col gap-0 rounded-2xl px-1 py-1 transition-colors hover:bg-muted/50 focus-within:bg-muted/50",
112112
isHighlighted &&
113113
"-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",
114114
)}
115115
>
116116
<MessageRow
117117
channelId={channelId}
118118
highlighted={false}
119+
hoverBackground={false}
119120
isFollowingThread={
120121
isFollowingThreadById
121122
? isFollowingThreadById(message.id)

desktop/tests/e2e/messaging.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ test("opens a single-level thread panel with inline expansion", async ({
403403
const siblingReply = `Sibling threaded reply ${timestamp}`;
404404
const nestedReply = `Nested threaded reply ${timestamp}`;
405405
const nestedReplyFromBob = `Nested reply from Bob ${timestamp}`;
406+
const nestedReplyVisibleTopMaxPx = 260;
406407
const fillerReplies = Array.from(
407408
{ length: 14 },
408409
(_, index) => `Thread filler reply ${index} ${timestamp}`,
@@ -524,7 +525,7 @@ test("opens a single-level thread panel with inline expansion", async ({
524525
return rowRect.top - bodyRect.top;
525526
});
526527
})
527-
.toBeLessThanOrEqual(240);
528+
.toBeLessThanOrEqual(nestedReplyVisibleTopMaxPx);
528529

529530
const firstReplyId = await firstReplyRow.getAttribute("data-message-id");
530531
if (!firstReplyId) {
@@ -578,7 +579,7 @@ test("opens a single-level thread panel with inline expansion", async ({
578579
return rowRect.top - bodyRect.top;
579580
});
580581
})
581-
.toBeLessThanOrEqual(240);
582+
.toBeLessThanOrEqual(nestedReplyVisibleTopMaxPx);
582583

583584
await firstReplySummaryRow.click();
584585
await expect(

0 commit comments

Comments
 (0)