Skip to content

Commit c5166f2

Browse files
morgmartTrace (Engineer)Rivet
authored
feat(desktop): simplify the message action rail (#6529)
## Problem Quick-reaction shortcuts make the message action rail visually noisy. Reaction access should remain first-class, but through one predictable Add reaction action rather than several learned emoji shortcuts. ## Change The rail is now: **Add reaction · Reply · Copy link · More** - Remove all quick-reaction shortcut buttons and their divider from the message action rail. - Preserve Add reaction as the first action, including its existing picker, tooltip, accessible name, keyboard behavior, reaction behavior, and feedback. - Keep the existing Link2 Copy link action, shared copy handler, More-menu entry, eligibility guards, and success feedback unchanged. - Keep reveal, positioning, responsiveness, styling, and remaining menu paths unchanged. The now-unused quick-reaction rendering component and imports were removed from `MessageActionBar`; shared reaction learning remains intact for other reaction surfaces. ## Tests Focused smoke coverage verifies: - zero `React with …` shortcut buttons; - exact ordered rail: `Open reactions → Reply → Copy link → More actions`; - the rail and More-menu paths emit the same canonical thread-aware `buzz://message` URL; - existing success feedback; - pending and huddle rows omit both copy-link surfaces; - the action bar stays within the open thread panel. The zero-shortcut contract was mutation-checked by restoring the prior production action bar: the focused test failed causally with expected 0 versus received 3 quick-reaction buttons. ## Validation At `4f062e0d60b0f0c16b6862cdea7137c287060947`: - `pnpm exec biome check src/features/messages/ui/MessageActionBar.tsx tests/e2e/message-copy-link.spec.ts` — passed. - `pnpm exec tsc --noEmit` — passed. - `pnpm test` — 5,432 passed, 0 failed. - `pnpm build:e2e` — passed; existing dynamic-import and chunk-size warnings only. - `pnpm exec playwright test tests/e2e/message-copy-link.spec.ts --project=smoke` — 2 passed. - Pre-push `file-size-check`, `desktop-check`, `desktop-typecheck`, and `desktop-test` — passed. Vogue’s design review: **SHIP** — reaction remains discoverable and accessible as the visible first action; the extra click is an intentional efficiency tradeoff for the simpler hierarchy. --------- Signed-off-by: Trace (Engineer) <9d485ff0c62915e08a801162c195c7ef096f6f6143925407255cea2656c4b8a4@buzz.block.builderlab.xyz> Signed-off-by: morgmart <[email protected]> Signed-off-by: Rivet <a08d9a8418c7ff03afe19964724c8fd87bf1776ab9e9b9cafb8cc920edd02a6e@buzz.block.builderlab.xyz> Co-authored-by: Trace (Engineer) <9d485ff0c62915e08a801162c195c7ef096f6f6143925407255cea2656c4b8a4@buzz.block.builderlab.xyz> Co-authored-by: Rivet <a08d9a8418c7ff03afe19964724c8fd87bf1776ab9e9b9cafb8cc920edd02a6e@buzz.block.builderlab.xyz>
1 parent 30d2fc5 commit c5166f2

7 files changed

Lines changed: 268 additions & 121 deletions

File tree

‎desktop/playwright.config.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export default defineConfig({
3838
"**/invites-settings-screenshots.spec.ts",
3939
"**/messaging.spec.ts",
4040
"**/message-feedback-snapshots.spec.ts",
41+
"**/message-copy-link.spec.ts",
4142
"**/custom-emoji.spec.ts",
4243
"**/profile-custom-emoji-status.spec.ts",
4344
"**/custom-emoji-ui.spec.ts",

‎desktop/src/features/messages/ui/MessageActionBar.tsx‎

Lines changed: 50 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,16 @@ import { toast } from "sonner";
1818

1919
import { buildMessageLink } from "@/features/messages/lib/messageLink";
2020
import { EmojiPicker } from "@/features/custom-emoji/ui/EmojiPicker";
21-
import { useCustomEmoji } from "@/features/custom-emoji/hooks";
2221
import { getThreadReference } from "@/features/messages/lib/threading";
2322
import { ReportMessageDialog } from "@/features/moderation/ui/ReportMessageDialog";
2423
import { MessageModerationMenuItems } from "@/features/moderation/ui/MessageModerationMenuItems";
2524
import type {
2625
TimelineMessage,
2726
TimelineReaction,
2827
} from "@/features/messages/types";
29-
import {
30-
recordQuickReactionEmoji,
31-
useQuickReactionEmojis,
32-
} from "@/features/messages/ui/useQuickReactionEmojis";
33-
import { reactionEmojiUrl } from "@/shared/api/customEmoji";
28+
import { recordQuickReactionEmoji } from "@/features/messages/ui/useQuickReactionEmojis";
3429
import { cn } from "@/shared/lib/cn";
3530
import { copyTextToClipboard } from "@/shared/lib/clipboard";
36-
import { emojiDisplayName } from "@/shared/lib/emojiName";
37-
import { rewriteRelayUrl } from "@/shared/lib/mediaUrl";
3831
import { KIND_HUDDLE_STARTED } from "@/shared/constants/kinds";
3932
import { Button } from "@/shared/ui/button";
4033
import { HashArrowIn } from "@/shared/ui/icons";
@@ -53,6 +46,32 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "@/shared/ui/tooltip";
5346
const ACTION_BUTTON_CLASS = "h-8 w-8 rounded-full p-0";
5447
const ACTION_ICON_CLASS = "!h-4 !w-4";
5548

49+
/** Copying a message link is offered from both the hover action bar and the
50+
* More menu; both paths share this exact link-building + toast behavior. */
51+
function copyMessageLink(channelId: string, message: TimelineMessage) {
52+
const { rootId } = getThreadReference(message.tags ?? []);
53+
const link = buildMessageLink({
54+
channelId,
55+
messageId: message.id,
56+
threadRootId: rootId,
57+
});
58+
copyTextToClipboard(link, "Link copied to clipboard");
59+
}
60+
61+
/** Gate shared by every copy-link surface: pending sends have no delivered
62+
* event to link to, huddle system rows aren't linkable, and callers without
63+
* a channelId (e.g. inbox preview rows) can't build the link. */
64+
function canCopyMessageLink(
65+
message: TimelineMessage,
66+
channelId: string | null | undefined,
67+
): channelId is string {
68+
return (
69+
!message.pending &&
70+
message.kind !== KIND_HUDDLE_STARTED &&
71+
Boolean(channelId)
72+
);
73+
}
74+
5675
function MoreActionsMenu({
5776
channelId,
5877
message,
@@ -242,17 +261,11 @@ function MoreActionsMenu({
242261
</DropdownMenuItem>
243262
) : null}
244263

245-
{hasCopyActions && channelId ? (
264+
{canCopyMessageLink(message, channelId) ? (
246265
<DropdownMenuItem
247266
data-testid={`copy-message-link-${message.id}`}
248267
onClick={() => {
249-
const { rootId } = getThreadReference(message.tags ?? []);
250-
const link = buildMessageLink({
251-
channelId,
252-
messageId: message.id,
253-
threadRootId: rootId,
254-
});
255-
copyTextToClipboard(link, "Link copied to clipboard");
268+
copyMessageLink(channelId, message);
256269
}}
257270
>
258271
<Link2 className="h-4 w-4" />
@@ -316,51 +329,6 @@ function MoreActionsMenu({
316329
);
317330
}
318331

319-
function QuickReactionButton({
320-
customEmojiUrl,
321-
emoji,
322-
onSelect,
323-
}: {
324-
customEmojiUrl?: string;
325-
emoji: string;
326-
onSelect: (emoji: string) => void;
327-
}) {
328-
const displayName = emojiDisplayName(emoji);
329-
const mediaUrl = customEmojiUrl ? rewriteRelayUrl(customEmojiUrl) : null;
330-
331-
return (
332-
<Tooltip>
333-
<TooltipTrigger asChild>
334-
<button
335-
aria-label={`React with ${displayName}`}
336-
className="flex h-8 w-8 items-center justify-center rounded-full text-base leading-none text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring"
337-
onClick={() => onSelect(emoji)}
338-
title={displayName}
339-
type="button"
340-
>
341-
{mediaUrl ? (
342-
<img
343-
alt={emoji}
344-
className="h-5 w-5 object-contain"
345-
draggable={false}
346-
src={mediaUrl}
347-
/>
348-
) : (
349-
<span aria-hidden="true" className="translate-y-px">
350-
{emoji}
351-
</span>
352-
)}
353-
</button>
354-
</TooltipTrigger>
355-
<TooltipContent>{displayName}</TooltipContent>
356-
</Tooltip>
357-
);
358-
}
359-
360-
function isCustomEmojiShortcode(emoji: string) {
361-
return emoji.startsWith(":") && emoji.endsWith(":");
362-
}
363-
364332
export const MessageActionBar = React.memo(function MessageActionBar({
365333
channelId,
366334
message,
@@ -404,20 +372,6 @@ export const MessageActionBar = React.memo(function MessageActionBar({
404372
}) {
405373
const [isReactionPickerOpen, setIsReactionPickerOpen] = React.useState(false);
406374
const [isDropdownOpen, setIsDropdownOpen] = React.useState(false);
407-
const customEmoji = useCustomEmoji();
408-
const quickReactionEmojis = useQuickReactionEmojis(4, customEmoji);
409-
const quickReactionItems = React.useMemo(
410-
() =>
411-
quickReactionEmojis
412-
.map((emoji) => ({
413-
customEmojiUrl: reactionEmojiUrl(emoji, customEmoji),
414-
emoji,
415-
}))
416-
.filter(
417-
(item) => !isCustomEmojiShortcode(item.emoji) || item.customEmojiUrl,
418-
),
419-
[customEmoji, quickReactionEmojis],
420-
);
421375
const hasReplyAction = Boolean(onReply);
422376
const hasReactionAction = Boolean(onReactionSelect);
423377

@@ -482,22 +436,6 @@ export const MessageActionBar = React.memo(function MessageActionBar({
482436
>
483437
<div className="overflow-hidden rounded-full border border-border/70 bg-background/95 shadow-xs backdrop-blur-sm supports-[backdrop-filter]:bg-background/85">
484438
<div className="flex items-center gap-0.5 p-1">
485-
{hasReactionAction && quickReactionItems.length > 0 ? (
486-
<>
487-
<div className="hidden items-center gap-0.5 sm:flex">
488-
{quickReactionItems.map(({ customEmojiUrl, emoji }) => (
489-
<QuickReactionButton
490-
customEmojiUrl={customEmojiUrl}
491-
emoji={emoji}
492-
key={emoji}
493-
onSelect={handleReactionSelection}
494-
/>
495-
))}
496-
</div>
497-
<div className="mx-0.5 hidden h-4 w-px bg-border/70 sm:block" />
498-
</>
499-
) : null}
500-
501439
{hasReactionAction ? (
502440
<Popover
503441
onOpenChange={setIsReactionPickerOpen}
@@ -566,6 +504,27 @@ export const MessageActionBar = React.memo(function MessageActionBar({
566504
</Tooltip>
567505
) : null}
568506

507+
{canCopyMessageLink(message, channelId) ? (
508+
<Tooltip>
509+
<TooltipTrigger asChild>
510+
<Button
511+
aria-label="Copy link"
512+
className={ACTION_BUTTON_CLASS}
513+
data-testid={`copy-link-message-${message.id}`}
514+
onClick={() => {
515+
copyMessageLink(channelId, message);
516+
}}
517+
size="sm"
518+
type="button"
519+
variant="ghost"
520+
>
521+
<Link2 className={ACTION_ICON_CLASS} />
522+
</Button>
523+
</TooltipTrigger>
524+
<TooltipContent>Copy link</TooltipContent>
525+
</Tooltip>
526+
) : null}
527+
569528
{hasMoreMenuActions ? (
570529
<MoreActionsMenu
571530
channelId={channelId}

‎desktop/tests/e2e/channel-activity-popover.spec.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -773,10 +773,11 @@ test.describe("channel activity hover preview", () => {
773773
await rootRow.hover();
774774
const actionBar = page.getByTestId(`message-action-bar-${root.id}`);
775775
await expect(actionBar).toBeVisible();
776-
await actionBar
777-
.getByRole("button", { name: /^React with / })
778-
.first()
779-
.click();
776+
await actionBar.getByRole("button", { name: "Open reactions" }).click();
777+
const picker = page.locator("em-emoji-picker");
778+
await expect(picker).toBeVisible();
779+
await picker.locator("input[type='search']").fill("thumbs up");
780+
await picker.getByRole("button", { name: "👍" }).first().click();
780781
await expect(
781782
rootRow.getByRole("button", { name: /^Toggle .* reaction$/ }),
782783
).toBeVisible();

‎desktop/tests/e2e/custom-emoji.spec.ts‎

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ async function quickReactionStorageContains(
285285
}, emoji);
286286
}
287287

288-
test("message quick reaction tray stays neutral after selecting a tray emoji", async ({
288+
test("message reaction action stays neutral after selecting from the picker", async ({
289289
page,
290290
}) => {
291291
await openGeneral(page);
@@ -294,19 +294,18 @@ test("message quick reaction tray stays neutral after selecting a tray emoji", a
294294
await expect(row).toBeVisible();
295295
await row.hover();
296296

297-
const quickReactionButton = row.getByRole("button", {
298-
name: "React with :+1:",
299-
});
300-
await expect(quickReactionButton).toBeVisible();
301-
await quickReactionButton.click();
297+
const reactionTrigger = messageReactionTrigger(row);
298+
await expect(reactionTrigger).toBeVisible();
299+
await reactionTrigger.click();
300+
const picker = page.locator("em-emoji-picker");
301+
await expect(picker).toBeVisible();
302+
await picker.locator("input[type='search']").fill("thumbs up");
303+
await picker.getByRole("button", { name: "👍" }).first().click();
302304

303305
await expect(row.getByLabel("Toggle 👍 reaction")).toBeVisible();
304306
await row.hover();
305-
await expect(quickReactionButton).not.toHaveAttribute("aria-pressed", "true");
306-
await expect(quickReactionButton).not.toHaveClass(SELECTED_ACTION_CLASS);
307-
await expect(messageReactionTrigger(row)).not.toHaveClass(
308-
SELECTED_ACTION_CLASS,
309-
);
307+
await expect(reactionTrigger).not.toHaveAttribute("aria-pressed", "true");
308+
await expect(reactionTrigger).not.toHaveClass(SELECTED_ACTION_CLASS);
310309
});
311310

312311
test("emoji picker keeps Frequently used live within the app session", async ({

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ test("inbox reaction on a thread-reply mention persists after refetch", async ({
114114
},
115115
);
116116

117-
// Open the inbox item and react via the hover action bar's quick reaction.
117+
// Open the inbox item and react through Add reaction and the picker.
118118
const item = page.getByTestId(`home-inbox-item-${replyEvent.id}`);
119119
await item.click();
120120
const detail = page.getByTestId("home-inbox-detail");
@@ -152,9 +152,11 @@ test("inbox reaction on a thread-reply mention persists after refetch", async ({
152152
}
153153
expect(actionBarBox.y).toBeGreaterThanOrEqual(selectedMessageBox.y);
154154

155-
await selectedMessage
156-
.getByRole("button", { name: "React with :+1:" })
157-
.click();
155+
await actionBar.getByRole("button", { name: "Open reactions" }).click();
156+
const picker = page.locator("em-emoji-picker");
157+
await expect(picker).toBeVisible();
158+
await picker.locator("input[type='search']").fill("thumbs up");
159+
await picker.getByRole("button", { name: "👍" }).first().click();
158160

159161
// The pill must appear AND persist: the post-toggle refetch replaces the
160162
// optimistic state with fetched reaction events. Give the refetch time to

0 commit comments

Comments
 (0)