Skip to content

Commit 5bb849d

Browse files
committed
feat: separate subtitle from workspace rooms
1 parent c293216 commit 5bb849d

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

src/pages/ReportDetailsPage.tsx

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@ import type {OnyxEntry} from 'react-native-onyx';
99
import type {ValueOf} from 'type-fest';
1010
import AvatarWithImagePicker from '@components/AvatarWithImagePicker';
1111
import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView';
12-
import DisplayNames from '@components/DisplayNames';
1312
import HeaderWithBackButton from '@components/HeaderWithBackButton';
1413
import MentionReportContext from '@components/HTMLEngineProvider/HTMLRenderers/MentionReportRenderer/MentionReportContext';
1514
import MenuItem from '@components/MenuItem';
1615
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
1716
import {ModalActions} from '@components/Modal/Global/ModalContext';
1817
import OfflineWithFeedback from '@components/OfflineWithFeedback';
1918
import ParentNavigationSubtitle from '@components/ParentNavigationSubtitle';
20-
import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback';
2119
import type {PromotedAction} from '@components/PromotedActionsBar';
2220
import PromotedActionsBar, {PromotedActions} from '@components/PromotedActionsBar';
2321
import ReportActionAvatars from '@components/ReportActionAvatars';
@@ -72,6 +70,7 @@ import {
7270
getParentNavigationSubtitle,
7371
getParticipantsAccountIDsForDisplay,
7472
getParticipantsList,
73+
getPolicyName,
7574
getReportDescription,
7675
getReportFieldKey,
7776
getReportForHeader,
@@ -362,10 +361,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata, reportLoading
362361
const shouldParseFullTitle = parentReportAction?.actionName !== CONST.REPORT.ACTIONS.TYPE.ADD_COMMENT && !isGroupChat;
363362
const rawReportName = getReportNameFromReportNameUtils(reportForHeader, reportAttributes);
364363
const reportName = shouldParseFullTitle ? Parser.htmlToText(rawReportName) : rawReportName;
365-
const additionalRoomDetails =
366-
(isPolicyExpenseChat && !!report?.isOwnPolicyExpenseChat) || isExpenseReportUtil(report) || isPolicyExpenseChat || isInvoiceRoom
367-
? chatRoomSubtitle
368-
: `${translate('threads.in')} ${chatRoomSubtitle}`;
364+
const additionalRoomDetails = isExpenseReportUtil(report) || isPolicyExpenseChat || isInvoiceRoom ? chatRoomSubtitle : `${translate('threads.in')} ${chatRoomSubtitle}`;
369365

370366
let roomDescription: string | undefined;
371367
if (caseID === CASES.MONEY_REQUEST) {
@@ -750,6 +746,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata, reportLoading
750746
return result;
751747
}, [canJoin, report, backTo, currentUserPersonalDetails.accountID]);
752748

749+
const shouldDisplayGroupWorkspaceAsPushRow = !isThread && (isGroupChat || isUserCreatedPolicyRoom || isDefaultRoom);
753750
const nameSectionGroupWorkspace = (
754751
<OfflineWithFeedback
755752
pendingAction={report?.pendingFields?.reportName}
@@ -763,10 +760,10 @@ function ReportDetailsPage({policy, report, route, reportMetadata, reportLoading
763760
interactive={!shouldDisableRename}
764761
title={StringUtils.lineBreaksToSpaces(reportName)}
765762
titleStyle={styles.newKansasLarge}
766-
titleContainerStyle={shouldDisableRename && styles.alignItemsCenter}
763+
titleContainerStyle={!shouldDisplayGroupWorkspaceAsPushRow && styles.alignItemsCenter}
767764
shouldCheckActionAllowedOnPress={false}
768-
description={!shouldDisableRename ? roomDescription : ''}
769-
furtherDetails={chatRoomSubtitle && !isGroupChat ? additionalRoomDetails : ''}
765+
description={shouldDisplayGroupWorkspaceAsPushRow ? roomDescription : ''}
766+
furtherDetails={chatRoomSubtitle && !isGroupChat && !shouldDisplayGroupWorkspaceAsPushRow ? additionalRoomDetails : ''}
770767
furtherDetailsNumberOfLines={isWorkspaceChat ? 0 : undefined}
771768
furtherDetailsStyle={isWorkspaceChat ? [styles.textAlignCenter, styles.breakWord] : undefined}
772769
onPress={() => {
@@ -775,6 +772,14 @@ function ReportDetailsPage({policy, report, route, reportMetadata, reportLoading
775772
numberOfLinesTitle={isThread ? 2 : 0}
776773
shouldBreakWord
777774
/>
775+
{shouldDisplayGroupWorkspaceAsPushRow && !isGroupChat && (
776+
<MenuItemWithTopDescription
777+
shouldShowRightIcon={false}
778+
interactive={false}
779+
description={translate('workspace.common.workspace')}
780+
title={getPolicyName({report})}
781+
/>
782+
)}
778783
</View>
779784
</OfflineWithFeedback>
780785
);

0 commit comments

Comments
 (0)