Whalebird-desktop-client-ma.../renderer/components/report/Report.tsx

44 lines
1.3 KiB
TypeScript
Raw Normal View History

import { Button, Dialog, DialogBody, DialogHeader, Textarea, Typography } from '@material-tailwind/react'
2023-12-12 16:49:00 +01:00
import { Entity, MegalodonInterface } from 'megalodon'
import { FormattedMessage } from 'react-intl'
type Props = {
open: boolean
close: () => void
status: Entity.Status
client: MegalodonInterface
}
export default function Report(props: Props) {
const submit = async () => {
const comment = document.getElementById('comment') as HTMLTextAreaElement
await props.client.report(props.status.account.id, {
status_ids: [props.status.id],
comment: comment.value,
forward: true
})
props.close()
}
return (
<Dialog open={props.open} handler={props.close} size="md">
<DialogHeader>
2023-12-12 16:49:00 +01:00
<FormattedMessage id="report.title" values={{ user: `@${props.status.account.username}` }} />
</DialogHeader>
<DialogBody className="max-h-full max-w-full">
2023-12-12 16:49:00 +01:00
<form>
<div className="block">
<Typography>
2023-12-12 16:49:00 +01:00
<FormattedMessage id="report.detail" />
</Typography>
2024-03-14 17:12:19 +01:00
<Textarea id="comment" color="blue-gray" rows={4} />
2023-12-12 16:49:00 +01:00
</div>
<Button className="mt-2" onClick={submit}>
2023-12-12 16:49:00 +01:00
<FormattedMessage id="report.submit" />
</Button>
</form>
</DialogBody>
</Dialog>
2023-12-12 16:49:00 +01:00
)
}