2023-12-12 16:49:00 +01:00
|
|
|
import { Button, Label, Modal, Textarea } from 'flowbite-react'
|
|
|
|
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 (
|
|
|
|
<Modal show={props.open} onClose={props.close} size="xl">
|
|
|
|
<Modal.Header>
|
|
|
|
<FormattedMessage id="report.title" values={{ user: `@${props.status.account.username}` }} />
|
|
|
|
</Modal.Header>
|
|
|
|
<Modal.Body className="max-h-full max-w-full">
|
|
|
|
<form>
|
|
|
|
<div className="block">
|
|
|
|
<Label htmlFor="comment">
|
|
|
|
<FormattedMessage id="report.detail" />
|
|
|
|
</Label>
|
|
|
|
<Textarea id="comment" rows={4} />
|
|
|
|
</div>
|
2024-01-03 07:54:29 +01:00
|
|
|
<Button color="blue" className="mt-2" onClick={submit}>
|
2023-12-12 16:49:00 +01:00
|
|
|
<FormattedMessage id="report.submit" />
|
|
|
|
</Button>
|
|
|
|
</form>
|
|
|
|
</Modal.Body>
|
|
|
|
</Modal>
|
|
|
|
)
|
|
|
|
}
|