diff --git a/locales/en/translation.json b/locales/en/translation.json
index 0da8f754..bd89f757 100644
--- a/locales/en/translation.json
+++ b/locales/en/translation.json
@@ -15,7 +15,8 @@
},
"show_more": "Show more",
"show_less": "Show less",
- "cw": "Media hidden"
+ "cw": "Media hidden",
+ "report": "Report {user}"
}
},
"accounts": {
@@ -115,5 +116,10 @@
"title": "Settings",
"language": "Language",
"font_size": "Font size"
+ },
+ "report": {
+ "title": "Report {user}",
+ "detail": "Detail",
+ "submit": "Submit"
}
}
diff --git a/renderer/components/report/Report.tsx b/renderer/components/report/Report.tsx
new file mode 100644
index 00000000..654b7e56
--- /dev/null
+++ b/renderer/components/report/Report.tsx
@@ -0,0 +1,43 @@
+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 (
+
+
+
+
+
+
+
+
+ )
+}
diff --git a/renderer/components/timelines/status/Actions.tsx b/renderer/components/timelines/status/Actions.tsx
index 397b9147..8576d2e2 100644
--- a/renderer/components/timelines/status/Actions.tsx
+++ b/renderer/components/timelines/status/Actions.tsx
@@ -5,6 +5,7 @@ import { FaBookmark, FaEllipsis, FaFaceLaughBeam, FaReply, FaRetweet, FaStar } f
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
@@ -65,6 +66,10 @@ export default function Actions(props: Props) {
props.onRefresh()
}
+ const report = () => {
+ router.push({ query: { id: router.query.id, timeline: router.query.timeline, report_target_id: props.status.id, modal: true } })
+ }
+
return (
@@ -74,7 +79,6 @@ export default function Actions(props: Props) {
{props.account.sns !== 'mastodon' && (
(
@@ -91,7 +95,19 @@ export default function Actions(props: Props) {
)}
-
+ (
+
+
+
+ )}
+ >
+
+
+
+
)
}
diff --git a/renderer/pages/accounts/[id]/[timeline].tsx b/renderer/pages/accounts/[id]/[timeline].tsx
index 88bab026..84904ecc 100644
--- a/renderer/pages/accounts/[id]/[timeline].tsx
+++ b/renderer/pages/accounts/[id]/[timeline].tsx
@@ -5,12 +5,14 @@ import { Account, db } from '@/db'
import generator, { Entity, MegalodonInterface } from 'megalodon'
import Notifications from '@/components/timelines/Notifications'
import Media from '@/components/Media'
+import Report from '@/components/report/Report'
export default function Page() {
const router = useRouter()
const [account, setAccount] = useState(null)
const [client, setClient] = useState(null)
const [attachment, setAttachment] = useState(null)
+ const [report, setReport] = useState(null)
useEffect(() => {
if (router.query.id) {
@@ -35,6 +37,16 @@ export default function Page() {
}
}, [router.query.id, router.query.timeline])
+ useEffect(() => {
+ if (router.query.modal && router.query.report_target_id) {
+ const f = async () => {
+ const res = await client.getStatus(router.query.report_target_id as string)
+ setReport(res.data)
+ }
+ f()
+ }
+ }, [router.query.modal, router.query.report_target_id])
+
if (!account || !client) return null
switch (router.query.timeline as string) {
case 'notifications': {
@@ -45,6 +57,7 @@ export default function Page() {
<>
setAttachment(null)} attachment={attachment} />
+ {report && setReport(null)} status={report} client={client} />}
>
)
}