2024-01-09 13:30:05 +01:00
|
|
|
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 (
|
2024-01-09 13:30:05 +01:00
|
|
|
<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}` }} />
|
2024-01-09 13:30:05 +01:00
|
|
|
</DialogHeader>
|
|
|
|
<DialogBody className="max-h-full max-w-full">
|
2023-12-12 16:49:00 +01:00
|
|
|
<form>
|
|
|
|
<div className="block">
|
2024-01-09 13:30:05 +01:00
|
|
|
<Typography>
|
2023-12-12 16:49:00 +01:00
|
|
|
<FormattedMessage id="report.detail" />
|
2024-01-09 13:30:05 +01:00
|
|
|
</Typography>
|
2023-12-12 16:49:00 +01:00
|
|
|
<Textarea id="comment" rows={4} />
|
|
|
|
</div>
|
2024-01-09 13:30:05 +01:00
|
|
|
<Button className="mt-2" onClick={submit}>
|
2023-12-12 16:49:00 +01:00
|
|
|
<FormattedMessage id="report.submit" />
|
|
|
|
</Button>
|
|
|
|
</form>
|
2024-01-09 13:30:05 +01:00
|
|
|
</DialogBody>
|
|
|
|
</Dialog>
|
2023-12-12 16:49:00 +01:00
|
|
|
)
|
|
|
|
}
|