Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4999,6 +4999,7 @@ const CONST = {
INFO: 'info',
},
REPORT_DETAILS_MENU_ITEM: {
GO_TO_ROOM: 'goToRoom',
MEMBERS: 'member',
INVITE: 'invite',
SETTINGS: 'settings',
Expand Down
1 change: 1 addition & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2961,6 +2961,7 @@ const translations = {
},
},
reportDetailsPage: {
goToRoom: 'Go to room',
inWorkspace: (policyName: string) => `in ${policyName}`,
generatingPDF: 'Generate PDF',
waitForPDF: 'Please wait while we generate the PDF.',
Expand Down
1 change: 1 addition & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2766,6 +2766,7 @@ ${amount} para ${merchant} - ${date}`,
},
},
reportDetailsPage: {
goToRoom: 'Ir a la sala',
inWorkspace: (policyName) => `en ${policyName}`,
generatingPDF: 'Generar PDF',
waitForPDF: 'Por favor, espera mientras creamos el PDF.',
Expand Down
20 changes: 20 additions & 0 deletions src/pages/DynamicReportDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ function DynamicReportDetailsPage({policy, report, route, reportMetadata, report
'Camera',
'Trashcan',
'ArrowSplit',
'Hashtag',
]);
const navigateBackFromReportDetailsPath = useDynamicBackPath(DYNAMIC_ROUTES.REPORT_DETAILS.path);

Expand Down Expand Up @@ -380,6 +381,10 @@ function DynamicReportDetailsPage({policy, report, route, reportMetadata, report
const shouldShowLeaveButton = canLeaveChat(report, policy, currentUserPersonalDetails?.accountID, !!reportNameValuePairs?.private_isArchived);
const shouldShowGoToWorkspace = shouldShowPolicy(policy, false, currentUserPersonalDetails?.email) && !policy?.isJoinRequestPending;

// Only show the "Go to room" row when the Details page was opened from a screen other than the room report itself
// (e.g. the Workspace rooms list), i.e. the room report is not the report currently open in the central pane.
const shouldShowGoToRoom = isChatRoom && Navigation.getTopmostReportId() !== report?.reportID;

const reportForHeader = useMemo(() => getReportForHeader(report), [report]);
const shouldParseFullTitle = parentReportAction?.actionName !== CONST.REPORT.ACTIONS.TYPE.ADD_COMMENT && !isGroupChat;
const rawReportName = getReportNameFromReportNameUtils(reportForHeader, reportAttributes);
Expand Down Expand Up @@ -410,6 +415,19 @@ function DynamicReportDetailsPage({policy, report, route, reportMetadata, report
return items;
}

if (shouldShowGoToRoom) {
items.push({
key: CONST.REPORT_DETAILS_MENU_ITEM.GO_TO_ROOM,
translationKey: 'reportDetailsPage.goToRoom',
icon: expensifyIcons.Hashtag,
isAnonymousAction: false,
shouldShowRightIcon: true,
action: () => {
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report?.reportID));
},
});
}

// The Members page is only shown when:
// - The report is a thread in a chat report
// - The report is not a user created room with participants to show i.e. DM, Group Chat, etc
Expand Down Expand Up @@ -629,6 +647,7 @@ function DynamicReportDetailsPage({policy, report, route, reportMetadata, report
}, [
isSelfDM,
isArchivedRoom,
shouldShowGoToRoom,
isGroupChat,
isDefaultRoom,
isChatThread,
Expand Down Expand Up @@ -659,6 +678,7 @@ function DynamicReportDetailsPage({policy, report, route, reportMetadata, report
expensifyIcons.Building,
expensifyIcons.Exit,
expensifyIcons.Bug,
expensifyIcons.Hashtag,
styles.ph2,
shouldOpenRoomMembersPage,
navigateBackFromReportDetailsPath,
Expand Down
7 changes: 6 additions & 1 deletion src/pages/workspace/rooms/WorkspaceRoomsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import Navigation from '@libs/Navigation/Navigation';
import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types';
import {getDisplayNameOrDefault} from '@libs/PersonalDetailsUtils';
import {isPolicyAdmin} from '@libs/PolicyUtils';
import {getReportName} from '@libs/ReportNameUtils';
import {getParticipantsAccountIDsForDisplay} from '@libs/ReportUtils';
import type {WorkspaceSplitNavigatorParamList} from '@navigation/types';
Expand All @@ -42,6 +43,7 @@
const illustrations = useMemoizedLazyIllustrations(['Hashtag']);
const policyID = route.params.policyID;
const policy = usePolicy(policyID);
const isAdmin = isPolicyAdmin(policy);
useWorkspaceDocumentTitle(policy?.name, 'workspace.common.rooms');

const reportAttributes = useReportAttributes();
Expand All @@ -65,7 +67,10 @@
ownerAvatar: ownerDetails?.avatar,
ownerDisplayName: ownerDetails ? getDisplayNameOrDefault(ownerDetails) : '',
memberCount: getParticipantsAccountIDsForDisplay(report, true, false, false, undefined, personalDetails).length,
action: () => Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report.reportID)),
action: () => {
const targetRoute = isAdmin ? ROUTES.REPORT_WITH_ID_DETAILS.getRoute(report.reportID) : ROUTES.REPORT_WITH_ID.getRoute(report.reportID);

Check failure on line 71 in src/pages/workspace/rooms/WorkspaceRoomsPage.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Property 'REPORT_WITH_ID_DETAILS' does not exist on type '{ readonly INBOX: "inbox"; readonly HOME: "home"; readonly WORKSPACES_LIST: { readonly route: "workspaces"; readonly getRoute: (backTo?: string | undefined) => "workspaces"; }; readonly SEARCH_ROUTER: "search-router"; ... 694 more ...; readonly SAML_SIGN_IN: "sign-in-with-saml"; }'.

Check failure on line 71 in src/pages/workspace/rooms/WorkspaceRoomsPage.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Unsafe member access .getRoute on a type that cannot be resolved

Check failure on line 71 in src/pages/workspace/rooms/WorkspaceRoomsPage.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Unsafe call of a type that could not be resolved

Check failure on line 71 in src/pages/workspace/rooms/WorkspaceRoomsPage.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Unsafe assignment of an error typed value

Check failure on line 71 in src/pages/workspace/rooms/WorkspaceRoomsPage.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Unsafe member access .getRoute on a type that cannot be resolved

Check failure on line 71 in src/pages/workspace/rooms/WorkspaceRoomsPage.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Unsafe call of a type that could not be resolved

Check failure on line 71 in src/pages/workspace/rooms/WorkspaceRoomsPage.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Unsafe assignment of an error typed value
Navigation.navigate(targetRoute);

Check failure on line 72 in src/pages/workspace/rooms/WorkspaceRoomsPage.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Unsafe argument of type error typed assigned to a parameter of type `Route`

Check failure on line 72 in src/pages/workspace/rooms/WorkspaceRoomsPage.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Unsafe argument of type error typed assigned to a parameter of type `Route`
},
};
});

Expand Down
Loading