From 75be34ce45bc91a17170617aed3399f0651c5f6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Thu, 4 Apr 2024 00:11:37 +0200 Subject: [PATCH] Move missing description confirmation setting back to Settings, add optional indicator for attachments without description MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- src/components/upload.tsx | 20 ++++++++++++++++++-- src/features/developers/settings-store.tsx | 4 ---- src/features/preferences/index.tsx | 4 ++++ src/locales/en.json | 2 ++ 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/components/upload.tsx b/src/components/upload.tsx index 8308950ccd..75a1281917 100644 --- a/src/components/upload.tsx +++ b/src/components/upload.tsx @@ -10,14 +10,14 @@ import zoomInIcon from '@tabler/icons/outline/zoom-in.svg'; import clsx from 'clsx'; import { List as ImmutableList } from 'immutable'; import React, { useState } from 'react'; -import { defineMessages, useIntl } from 'react-intl'; +import { FormattedMessage, defineMessages, useIntl } from 'react-intl'; import { spring } from 'react-motion'; import { openModal } from 'soapbox/actions/modals'; import Blurhash from 'soapbox/components/blurhash'; import { HStack, Icon, IconButton } from 'soapbox/components/ui'; import Motion from 'soapbox/features/ui/util/optional-motion'; -import { useAppDispatch } from 'soapbox/hooks'; +import { useAppDispatch, useSettings } from 'soapbox/hooks'; import { Attachment } from 'soapbox/types/entities'; export const MIMETYPE_ICONS: Record = { @@ -55,6 +55,7 @@ export const MIMETYPE_ICONS: Record = { }; const messages = defineMessages({ + altWarning: { id: 'upload_form.alt_warning', defaultMessage: 'This attachment doesn\'t have a description' }, description: { id: 'upload_form.description', defaultMessage: 'Describe for the visually impaired' }, delete: { id: 'upload_form.undo', defaultMessage: 'Delete' }, preview: { id: 'upload_form.preview', defaultMessage: 'Preview' }, @@ -80,6 +81,8 @@ const Upload: React.FC = ({ const intl = useIntl(); const dispatch = useAppDispatch(); + const { missingDescriptionModal } = useSettings(); + const [hovered, setHovered] = useState(false); const [focused, setFocused] = useState(false); const [dirtyDescription, setDirtyDescription] = useState(null); @@ -200,6 +203,19 @@ const Upload: React.FC = ({ )} + {missingDescriptionModal && !description && ( + + + + + )} +
{mediaType === 'video' && (