From 21419f23d4c514e59e74f6a533e8473dfa19dc52 Mon Sep 17 00:00:00 2001 From: Chewbacca Date: Wed, 12 Apr 2023 09:44:29 -0400 Subject: [PATCH] Add group context to details screen --- .../status/components/detailed-status.tsx | 41 ++++++++++++++++--- app/soapbox/features/status/index.tsx | 3 +- app/soapbox/locales/en.json | 1 - app/soapbox/locales/zh-CN.json | 1 - 4 files changed, 37 insertions(+), 9 deletions(-) diff --git a/app/soapbox/features/status/components/detailed-status.tsx b/app/soapbox/features/status/components/detailed-status.tsx index 4fc0f0eaf2..05e435d4e2 100644 --- a/app/soapbox/features/status/components/detailed-status.tsx +++ b/app/soapbox/features/status/components/detailed-status.tsx @@ -2,20 +2,20 @@ import React, { useEffect, useRef, useState } from 'react'; import { FormattedDate, FormattedMessage, useIntl } from 'react-intl'; import Account from 'soapbox/components/account'; -import Icon from 'soapbox/components/icon'; import StatusContent from 'soapbox/components/status-content'; import StatusMedia from 'soapbox/components/status-media'; import StatusReplyMentions from 'soapbox/components/status-reply-mentions'; import SensitiveContentOverlay from 'soapbox/components/statuses/sensitive-content-overlay'; +import StatusInfo from 'soapbox/components/statuses/status-info'; import TranslateButton from 'soapbox/components/translate-button'; -import { HStack, Stack, Text } from 'soapbox/components/ui'; +import { HStack, Icon, Stack, Text } from 'soapbox/components/ui'; import QuotedStatus from 'soapbox/features/status/containers/quoted-status-container'; import { getActualStatus } from 'soapbox/utils/status'; import StatusInteractionBar from './status-interaction-bar'; import type { List as ImmutableList } from 'immutable'; -import type { Attachment as AttachmentEntity, Status as StatusEntity } from 'soapbox/types/entities'; +import type { Attachment as AttachmentEntity, Group, Status as StatusEntity } from 'soapbox/types/entities'; interface IDetailedStatus { status: StatusEntity @@ -50,6 +50,35 @@ const DetailedStatus: React.FC = ({ onOpenCompareHistoryModal(status); }; + const renderStatusInfo = () => { + if (status.group) { + return ( +
+ } + text={ + + + ) }} + /> + + } + /> +
+ ); + } + }; + const actualStatus = getActualStatus(status); if (!actualStatus) return null; const { account } = actualStatus; @@ -75,14 +104,16 @@ const DetailedStatus: React.FC = ({ } if (actualStatus.visibility === 'direct') { - statusTypeIcon = ; + statusTypeIcon = ; } else if (actualStatus.visibility === 'private') { - statusTypeIcon = ; + statusTypeIcon = ; } return (
+ {renderStatusInfo()} +
= (props) => { const titleMessage = () => { if (status.visibility === 'direct') return messages.titleDirect; - return status.group ? messages.titleGroup : messages.title; + return messages.title; }; return ( diff --git a/app/soapbox/locales/en.json b/app/soapbox/locales/en.json index 265cb1bcc7..002cbe6c8c 100644 --- a/app/soapbox/locales/en.json +++ b/app/soapbox/locales/en.json @@ -1465,7 +1465,6 @@ "status.show_original": "Show original", "status.title": "Post Details", "status.title_direct": "Direct message", - "status.title_group": "Group Post Details", "status.translate": "Translate", "status.translated_from_with": "Translated from {lang} using {provider}", "status.unbookmark": "Remove bookmark", diff --git a/app/soapbox/locales/zh-CN.json b/app/soapbox/locales/zh-CN.json index 617c8e727a..8897529718 100644 --- a/app/soapbox/locales/zh-CN.json +++ b/app/soapbox/locales/zh-CN.json @@ -1464,7 +1464,6 @@ "status.show_original": "显示原文本", "status.title": "帖文详情", "status.title_direct": "私信", - "status.title_group": "群组帖文详情", "status.translate": "翻译", "status.translated_from_with": "使用 {provider} 从 {lang} 翻译而来", "status.unbookmark": "移除书签",