import { Avatar } from 'flowbite-react' import { Entity, MegalodonInterface } from 'megalodon' import dayjs from 'dayjs' import Body from './Body' import Media from './Media' import emojify from '@/utils/emojify' import Card from './Card' import Poll from './Poll' import { FormattedMessage } from 'react-intl' import Actions from './Actions' import { useRouter } from 'next/router' import { useState } from 'react' type Props = { status: Entity.Status client: MegalodonInterface onRefresh: (status: Entity.Status) => void } export default function Status(props: Props) { const status = originalStatus(props.status) const [spoilered, setSpoilered] = useState(status.spoiler_text.length > 0) const router = useRouter() const onRefresh = async () => { const res = await props.client.getStatus(status.id) props.onRefresh(res.data) } const openStatus = () => { router.push({ query: { id: router.query.id, timeline: router.query.timeline, status_id: status.id, detail: true } }) } const openUser = (id: string) => { router.push({ query: { id: router.query.id, timeline: router.query.timeline, user_id: id, detail: true } }) } return (