import { Grid } from "@project-gauntlet/api/components"; import React, { ReactNode, useState } from "react"; import { Clipboard, showHud } from "@project-gauntlet/api/helpers"; import { GroupedBy, BaseEmoji, getEmojis, getEmojisGroupedBy, } from "unicode-emoji"; // @ts-expect-error gauntlet uses deno and not node // eslint-disable-next-line @typescript-eslint/no-unused-vars const denoCore: DenoCore = Deno[Deno.internal].core; export default function EmojiPicker(): ReactNode | undefined { const [searchText, setSearchText] = useState(""); let emojiList: BaseEmoji[] | Record; let isCategory = null; if (searchText) { emojiList = getEmojis().filter((emoji) => emoji.keywords.some((keyword) => keyword.includes(searchText)), ); isCategory = false; } else { emojiList = getEmojisGroupedBy("category"); isCategory = true; } return ( {isCategory ? Object.entries(emojiList).map(([category, emojis]) => ( {emojis.map((emoji: BaseEmoji) => ( { console.log(emoji); await Clipboard.writeText(emoji.emoji); showHud(`${emoji.emoji} copied to clipboard`); }} /> ))} )) : (emojiList as BaseEmoji[]).map((emoji: BaseEmoji) => ( { console.log(emoji); await Clipboard.writeText(emoji.emoji); showHud(`${emoji.emoji} copied to clipboard`); }} /> ))} ); }