import { CustomFlowbiteTheme, Dropdown, Flowbite } from 'flowbite-react' import { Entity, MegalodonInterface } from 'megalodon' import { useRouter } from 'next/router' import { FaBookmark, FaEllipsis, FaFaceLaughBeam, FaReply, FaRetweet, FaStar } from 'react-icons/fa6' import Picker from '@emoji-mart/react' import { data } from '@/utils/emojiData' import { Account } from '@/db' import { FormattedMessage } from 'react-intl' type Props = { status: Entity.Status account: Account client: MegalodonInterface onRefresh: () => void } const customTheme: CustomFlowbiteTheme = { dropdown: { content: 'focus:outline-none', floating: { item: { base: 'hidden' } } } } export default function Actions(props: Props) { const router = useRouter() const reply = async () => { router.push({ query: { id: router.query.id, timeline: router.query.timeline, reply_target_id: props.status.id, detail: true } }) } const reblog = async () => { if (props.status.reblogged) { await props.client.unreblogStatus(props.status.id) } else { await props.client.reblogStatus(props.status.id) } props.onRefresh() } const favourite = async () => { if (props.status.favourited) { await props.client.unfavouriteStatus(props.status.id) } else { await props.client.favouriteStatus(props.status.id) } props.onRefresh() } const bookmark = async () => { if (props.status.bookmarked) { await props.client.unbookmarkStatus(props.status.id) } else { await props.client.bookmarkStatus(props.status.id) } props.onRefresh() } const onEmojiSelect = async emoji => { await props.client.createEmojiReaction(props.status.id, emoji.native) const dummy = document.getElementById('dummy-emoji-picker') dummy.click() props.onRefresh() } const report = () => { router.push({ query: { id: router.query.id, timeline: router.query.timeline, report_target_id: props.status.id, modal: true } }) } return (