Only offer reply and reactions on bot messages
The user's own messages no longer get the reply and react row. A bot's reaction to one still shows, read-only, and react-message refuses a reaction on the user's own message. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -3,14 +3,34 @@ import Span from "@moduletrace/twui/layout/Span";
|
||||
import type { BotMessageReaction } from "@/src/types";
|
||||
|
||||
type Props = BotMessageReaction & {
|
||||
onToggle: () => void;
|
||||
/**
|
||||
* Left out on the user's own messages: the bot's reactions there only
|
||||
* show.
|
||||
*/
|
||||
onToggle?: () => void;
|
||||
};
|
||||
|
||||
/**
|
||||
* One emoji reaction under a message: its count, highlighted when the
|
||||
* user gave it. Clicking takes it back or adds it.
|
||||
*/
|
||||
export default function MessageReactionChip({ emoji, count, mine, onToggle }: Props) {
|
||||
export default function MessageReactionChip({
|
||||
emoji,
|
||||
count,
|
||||
mine,
|
||||
onToggle,
|
||||
}: Props) {
|
||||
if (!onToggle) {
|
||||
return (
|
||||
<Span className="inline-flex shrink-0 items-center gap-1 px-2 py-0.5 rounded-default-lg border border-solid border-hairline bg-surface text-xs leading-4 text-ink-secondary">
|
||||
<Span className="text-sm leading-4">{emoji}</Span>
|
||||
{count > 1 ? (
|
||||
<Span className="tabular-nums">{count}</Span>
|
||||
) : null}
|
||||
</Span>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Button
|
||||
title={mine ? "Remove your reaction" : "Add this reaction"}
|
||||
@@ -20,7 +40,7 @@ export default function MessageReactionChip({ emoji, count, mine, onToggle }: Pr
|
||||
variant="ghost"
|
||||
color="text"
|
||||
onClick={onToggle}
|
||||
className={`shrink-0 gap-1! px-2! py-0.5! rounded-default-lg border border-solid text-xs leading-4 ${
|
||||
className={`shrink-0 gap-1! p-0! rounded-default-lg text-xs leading-4 ${
|
||||
mine
|
||||
? "border-hairline-strong bg-sunken text-ink"
|
||||
: "border-hairline bg-surface text-ink-secondary hover:text-ink"
|
||||
|
||||
Reference in New Issue
Block a user