mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-07-24 12:50:50 +08:00
The issue was the omtimised build was optimising the "+1" object key name to just "1" causing the context menu to try to shown an undefined emoji icon.
29 lines
784 B
TypeScript
29 lines
784 B
TypeScript
import { Button } from "@chakra-ui/react";
|
|
import { MessageEmoji } from "src/types/Conversation";
|
|
import { emojiIcons } from "src/types/Emoji";
|
|
|
|
interface MessageEmojiButtonProps {
|
|
emoji: MessageEmoji;
|
|
checked?: boolean;
|
|
onClick: () => void;
|
|
}
|
|
|
|
export const MessageEmojiButton = ({ emoji, checked, onClick }: MessageEmojiButtonProps) => {
|
|
const EmojiIcon = emojiIcons.get(emoji.name);
|
|
if (!EmojiIcon) return <></>;
|
|
return (
|
|
<Button
|
|
onClick={onClick}
|
|
variant={checked ? "solid" : "ghost"}
|
|
colorScheme={checked ? "blue" : undefined}
|
|
size="sm"
|
|
height="1.6em"
|
|
minWidth={0}
|
|
padding="0"
|
|
>
|
|
<EmojiIcon style={{ height: "1em" }} />
|
|
<span style={{ marginInlineEnd: "0.25em" }}>{emoji.count}</span>
|
|
</Button>
|
|
);
|
|
};
|