From 367f71843d60d9ef35105dabc1959c4aebda7011 Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Thu, 23 Nov 2023 15:06:46 +0900 Subject: [PATCH] Implement sensitive post --- locales/en/translation.json | 3 ++- renderer/components/compose/Compose.tsx | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/locales/en/translation.json b/locales/en/translation.json index e70009a5..bc56e28e 100644 --- a/locales/en/translation.json +++ b/locales/en/translation.json @@ -75,7 +75,8 @@ "unlisted": "Unlisted", "private": "Private", "direct": "Direct" - } + }, + "nsfw": "Sensitive" }, "alert": { "validation": { diff --git a/renderer/components/compose/Compose.tsx b/renderer/components/compose/Compose.tsx index 7eb32443..e104ec56 100644 --- a/renderer/components/compose/Compose.tsx +++ b/renderer/components/compose/Compose.tsx @@ -1,4 +1,4 @@ -import { Dropdown, FileInput, Spinner, TextInput, Textarea } from 'flowbite-react' +import { Checkbox, Dropdown, Label, Spinner, TextInput, Textarea } from 'flowbite-react' import { ChangeEvent, useEffect, useRef, useState } from 'react' import { FormattedMessage, useIntl } from 'react-intl' import { FaEnvelope, FaGlobe, FaListCheck, FaLock, FaLockOpen, FaPaperPlane, FaPaperclip, FaXmark } from 'react-icons/fa6' @@ -40,6 +40,12 @@ export default function Compose(props: Props) { media_ids: attachments.map(m => m.id) }) } + const sensitive = document.getElementById('sensitive') as HTMLInputElement + if (sensitive.checked) { + options = Object.assign({}, options, { + sensitive: sensitive.checked + }) + } setLoading(true) try { await props.client.postStatus(body, options) @@ -119,6 +125,16 @@ export default function Compose(props: Props) { ))} + + {attachments.length > 0 && ( +
+ + +
+ )} +