Only display sensitive media button if there are any

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-09-06 13:27:55 +02:00
parent 11c4e69728
commit 82d9edc7aa
4 changed files with 17 additions and 11 deletions

View File

@ -33,7 +33,7 @@ import ReplyGroupIndicator from './reply-group-indicator';
import ReplyMentions from './reply-mentions';
import ScheduleButton from './schedule-button';
import ScheduleForm from './schedule-form';
import SpoilerButton from './spoiler-button';
import SensitiveMediaButton from './sensitive-media-button';
import SpoilerInput from './spoiler-input';
import TextCharacterCounter from './text-character-counter';
import UploadForm from './upload-form';
@ -179,7 +179,7 @@ const ComposeForm = <ID extends string>({ id, shouldCondense, autoFocus, clickab
<EmojiPickerDropdown onPickEmoji={handleEmojiPick} condensed={shouldCondense} />
{features.polls && <PollButton composeId={id} />}
{features.scheduledStatuses && <ScheduleButton composeId={id} />}
{features.spoilers && <SpoilerButton composeId={id} />}
{anyMedia && features.spoilers && <SensitiveMediaButton composeId={id} />}
</HStack>
), [features, id]);

View File

@ -7,15 +7,15 @@ import { useAppDispatch, useCompose } from 'pl-fe/hooks';
import ComposeFormButton from './compose-form-button';
const messages = defineMessages({
marked: { id: 'compose_form.spoiler.marked', defaultMessage: 'Media is marked as sensitive' },
unmarked: { id: 'compose_form.spoiler.unmarked', defaultMessage: 'Media is not marked as sensitive' },
marked: { id: 'compose_form.sensitive.marked', defaultMessage: 'Media is marked as sensitive' },
unmarked: { id: 'compose_form.sensitive.unmarked', defaultMessage: 'Media is not marked as sensitive' },
});
interface ISpoilerButton {
interface ISensitiveMediaButton {
composeId: string;
}
const SpoilerButton: React.FC<ISpoilerButton> = ({ composeId }) => {
const SensitiveMediaButton: React.FC<ISensitiveMediaButton> = ({ composeId }) => {
const intl = useIntl();
const dispatch = useAppDispatch();
@ -34,4 +34,4 @@ const SpoilerButton: React.FC<ISpoilerButton> = ({ composeId }) => {
);
};
export { SpoilerButton as default };
export { SensitiveMediaButton as default };

View File

@ -485,8 +485,8 @@
"compose_form.publish_loud": "{publish}!",
"compose_form.save_changes": "Save changes",
"compose_form.schedule": "Schedule",
"compose_form.spoiler.marked": "Media is marked as sensitive",
"compose_form.spoiler.unmarked": "Media is not marked as sensitive",
"compose_form.sensitive.marked": "Media is marked as sensitive",
"compose_form.sensitive.unmarked": "Media is not marked as sensitive",
"compose_form.spoiler_placeholder": "Subject (optional)",
"confirmation_modal.cancel": "Cancel",
"confirmations.admin.deactivate_user.confirm": "Deactivate @{name}",
@ -1512,6 +1512,12 @@
"status.unbookmarked": "Bookmark removed.",
"status.unmute_conversation": "Unmute conversation",
"status.unpin": "Unpin from profile",
"status.visibility.direct": "The post is only visible to mentioned users",
"status.visibility.list": "The post is only visible to the members of a list",
"status.visibility.list.named": "The post is only visible to the members of a {name} list",
"status.visibility.local": "The post is only visible to users on your instance",
"status.visibility.mutuals_only": "The post is only visible to people who mutually follow the author",
"status.visibility.private": "The post is only visible to followers of the author",
"status_list.queue_label": "Click to see {count} new {count, plural, one {post} other {posts}}",
"statuses.quote_tombstone": "Post is unavailable.",
"statuses.tombstone": "One or more posts are unavailable.",

View File

@ -485,8 +485,8 @@
"compose_form.publish_loud": "{publish}!",
"compose_form.save_changes": "Zapisz zmiany",
"compose_form.schedule": "Zaplanuj",
"compose_form.spoiler.marked": "Media są oznaczone jako wrażliwe",
"compose_form.spoiler.unmarked": "Media nie są oznaczone jako wrażliwe",
"compose_form.sensitive.marked": "Media są oznaczone jako wrażliwe",
"compose_form.sensitive.unmarked": "Media nie są oznaczone jako wrażliwe",
"compose_form.spoiler_placeholder": "Temat (nieobowiązkowy)",
"confirmation_modal.cancel": "Anuluj",
"confirmations.admin.deactivate_user.confirm": "Dezaktywuj @{name}",