Skip to content
Merged
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
8 changes: 4 additions & 4 deletions config/eslint/eslint.seatbelt.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -1076,11 +1076,11 @@
"../../src/pages/ReimbursementAccount/utils/getSubStepValues.ts" "@typescript-eslint/no-unsafe-type-assertion" 4
"../../src/pages/ReportDescriptionPage.tsx" "no-restricted-syntax" 1
"../../src/pages/ReportParticipantDetailsPage.tsx" "@typescript-eslint/no-deprecated/ConfirmModal" 1
"../../src/pages/DynamicRoomMemberDetailsPage.tsx" "@typescript-eslint/no-deprecated/ConfirmModal" 1
"../../src/pages/DynamicRoomMemberDetailsPage.tsx" "@typescript-eslint/no-unsafe-type-assertion" 1
"../../src/pages/DynamicRoomMembersPage.tsx" "react-hooks/preserve-manual-memoization" 1
"../../src/pages/DynamicRoomMembersPage.tsx" "react-hooks/set-state-in-effect" 1
"../../src/pages/ReportParticipantDetailsPage.tsx" "@typescript-eslint/no-unsafe-type-assertion" 1
"../../src/pages/RoomMemberDetailsPage.tsx" "@typescript-eslint/no-deprecated/ConfirmModal" 1
"../../src/pages/RoomMemberDetailsPage.tsx" "@typescript-eslint/no-unsafe-type-assertion" 1
"../../src/pages/RoomMembersPage.tsx" "react-hooks/preserve-manual-memoization" 1
"../../src/pages/RoomMembersPage.tsx" "react-hooks/set-state-in-effect" 1
"../../src/pages/ScheduleCall/ScheduleCallPage.tsx" "react-hooks/preserve-manual-memoization" 1
"../../src/pages/Search/AdvancedSearchFilters.tsx" "@typescript-eslint/no-unsafe-type-assertion" 17
"../../src/pages/Search/EmptySearchView.tsx" "@typescript-eslint/no-unsafe-type-assertion" 1
Expand Down
48 changes: 18 additions & 30 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,24 @@ const DYNAMIC_ROUTES = {
SCREENS.REPORT_DETAILS.DYNAMIC_ROOT,
],
},
ROOM_MEMBERS: {
path: 'members',
entryScreens: [SCREENS.REPORT_DETAILS.DYNAMIC_ROOT],
Comment thread
huult marked this conversation as resolved.
},
ROOM_INVITE: {
path: 'room-invite',
entryScreens: [SCREENS.REPORT_DETAILS.DYNAMIC_ROOT, SCREENS.ROOM_MEMBERS.DYNAMIC_ROOT],
},
ROOM_MEMBER_DETAILS: {
path: 'room-member-details/:accountID',
entryScreens: [SCREENS.ROOM_MEMBERS.DYNAMIC_ROOT],
getRoute: (accountID: number) => `room-member-details/${accountID}` as const,
},
SPLIT_BILL_DETAILS: {
path: 'split/:reportActionID',
entryScreens: [SCREENS.REPORT, SCREENS.RIGHT_MODAL.SEARCH_REPORT, SCREENS.RIGHT_MODAL.EXPENSE_REPORT, SCREENS.RIGHT_MODAL.SEARCH_MONEY_REQUEST_REPORT],
getRoute: (reportActionID: string) => `split/${reportActionID}` as const,
},
TASK_ASSIGNEE: {
path: 'assignee',
entryScreens: [SCREENS.REPORT, SCREENS.RIGHT_MODAL.SEARCH_REPORT, SCREENS.RIGHT_MODAL.EXPENSE_REPORT, SCREENS.RIGHT_MODAL.SEARCH_MONEY_REQUEST_REPORT],
Expand Down Expand Up @@ -1523,36 +1541,6 @@ const ROUTES = {
route: 'r/:reportID/chronos/schedule-ooo',
getRoute: (reportID: string) => `r/${reportID}/chronos/schedule-ooo` as const,
},
SPLIT_BILL_DETAILS: {
route: 'r/:reportID/split/:reportActionID',
getRoute: (reportID: string | undefined, reportActionID: string, backTo?: string) => {
if (!reportID) {
Log.warn('Invalid reportID is used to build the SPLIT_BILL_DETAILS route');
}

return getUrlWithBackToParam(`r/${reportID}/split/${reportActionID}` as const, backTo);
},
},
ROOM_MEMBERS: {
route: 'r/:reportID/members',

getRoute: (reportID: string, backTo?: string) => getUrlWithBackToParam(`r/${reportID}/members` as const, backTo),
},
ROOM_MEMBER_DETAILS: {
route: 'r/:reportID/members/:accountID',

getRoute: (reportID: string, accountID: number, backTo?: string) => getUrlWithBackToParam(`r/${reportID}/members/${accountID}` as const, backTo),
},
ROOM_INVITE: {
route: 'r/:reportID/invite',
getRoute: (reportID: string | undefined, backTo?: string) => {
if (!reportID) {
Log.warn('Invalid reportID is used to build the ROOM_INVITE route');
}

return getUrlWithBackToParam(`r/${reportID}/invite` as const, backTo);
},
},
SPLIT_EXPENSE: {
// TODO: Remove backTo from route once we have find another way to fix navigation issues with tabs
route: 'create/split-expense/overview/:reportID/:transactionID/:splitExpenseTransactionID/:backTo?',
Expand Down
8 changes: 4 additions & 4 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ const SCREENS = {
},

SPLIT_DETAILS: {
ROOT: 'SplitDetails_Root',
DYNAMIC_ROOT: 'Dynamic_SplitDetails_Root',
EDIT_REQUEST: 'SplitDetails_Edit_Request',
EDIT_CURRENCY: 'SplitDetails_Edit_Currency',
},
Expand Down Expand Up @@ -1006,9 +1006,9 @@ const SCREENS = {
ROLE: 'ReportParticipants_Role',
},
ROOM_MEMBERS: {
ROOT: 'RoomMembers_Root',
INVITE: 'RoomMembers_Invite',
DETAILS: 'RoomMember_Details',
DYNAMIC_ROOT: 'Dynamic_RoomMembers_Root',
DYNAMIC_INVITE: 'Dynamic_RoomMembers_Invite',
DYNAMIC_DETAILS: 'Dynamic_RoomMember_Details',
},
DYNAMIC_FLAG_COMMENT: 'Dynamic_Flag_Comment',
DYNAMIC_TASK_TITLE: 'Dynamic_Task_Title',
Expand Down
5 changes: 3 additions & 2 deletions src/components/ReportActionItem/MoneyRequestAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useStyleUtils from '@hooks/useStyleUtils';
import useThemeStyles from '@hooks/useThemeStyles';
import {createTransactionThreadReport} from '@libs/actions/Report';
import createDynamicRoute from '@libs/Navigation/helpers/dynamicRoutesUtils/createDynamicRoute';
import getReportRouteForCurrentContext from '@libs/Navigation/helpers/getReportRouteForCurrentContext';
import Navigation from '@libs/Navigation/Navigation';
import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types';
Expand All @@ -27,7 +28,7 @@ import {useReportActionItemActions} from '@pages/inbox/report/ReportActionItemCo
import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import {DYNAMIC_ROUTES} from '@src/ROUTES';
import SCREENS from '@src/SCREENS';
import type * as OnyxTypes from '@src/types/onyx';
import TransactionPreview from './TransactionPreview';
Expand Down Expand Up @@ -85,7 +86,7 @@ function MoneyRequestAction({action, chatReportID, requestReportID, reportID, is
return;
}
if (isSplitBillAction) {
Navigation.navigate(ROUTES.SPLIT_BILL_DETAILS.getRoute(chatReportID, action.reportActionID, Navigation.getReportRHPActiveRoute()));
Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.SPLIT_BILL_DETAILS.getRoute(action.reportActionID)));
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ const TravelModalStackNavigator = createModalStackNavigator<TravelNavigatorParam
});

const SplitDetailsModalStackNavigator = createModalStackNavigator<SplitDetailsNavigatorParamList>({
[SCREENS.SPLIT_DETAILS.ROOT]: () => require<ReactComponentModule>('../../../../pages/iou/SplitBillDetailsPage').default,
[SCREENS.SPLIT_DETAILS.DYNAMIC_ROOT]: () => require<ReactComponentModule>('../../../../pages/iou/DynamicSplitBillDetailsPage').default,
});

const ProfileModalStackNavigator = createModalStackNavigator<ProfileNavigatorParamList>({
Expand Down Expand Up @@ -368,9 +368,9 @@ const ReportParticipantsModalStackNavigator = createModalStackNavigator<Particip
});

const RoomMembersModalStackNavigator = createModalStackNavigator<RoomMembersNavigatorParamList>({
[SCREENS.ROOM_MEMBERS.ROOT]: () => require<ReactComponentModule>('../../../../pages/RoomMembersPage').default,
[SCREENS.ROOM_MEMBERS.INVITE]: () => require<ReactComponentModule>('../../../../pages/RoomInvitePage').default,
[SCREENS.ROOM_MEMBERS.DETAILS]: () => require<ReactComponentModule>('../../../../pages/RoomMemberDetailsPage').default,
[SCREENS.ROOM_MEMBERS.DYNAMIC_ROOT]: () => require<ReactComponentModule>('../../../../pages/DynamicRoomMembersPage').default,
[SCREENS.ROOM_MEMBERS.DYNAMIC_INVITE]: () => require<ReactComponentModule>('../../../../pages/DynamicRoomInvitePage').default,
[SCREENS.ROOM_MEMBERS.DYNAMIC_DETAILS]: () => require<ReactComponentModule>('../../../../pages/DynamicRoomMemberDetailsPage').default,
});

const NewChatModalStackNavigator = createModalStackNavigator<NewChatNavigatorParamList>({
Expand Down
3 changes: 3 additions & 0 deletions src/libs/Navigation/linkingConfig/OldRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ const oldRoutes: Record<string, string> = {
'/r/*/title': '/r/$1/title',
'/r/*/description': '/r/$1/description',
'/r/*/assignee': '/r/$1/assignee',
'/r/*/members': '/r/$1/details/members',
'/r/*/members/*': '/r/$1/details/members/room-member-details/$2',
'/r/*/invite': '/r/$1/details/room-invite',
'/r/*/notes/*/edit': '/r/$1/notes-edit/$2',
'/r/*/notes': '/r/$1/details/notes',
'/workspaces/*/overview/address': '/workspaces/$1/overview/workspace-address',
Expand Down
8 changes: 4 additions & 4 deletions src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1704,9 +1704,9 @@ const config: LinkingOptions<RootNavigatorParamList>['config'] = {
},
[SCREENS.RIGHT_MODAL.ROOM_MEMBERS]: {
screens: {
[SCREENS.ROOM_MEMBERS.ROOT]: ROUTES.ROOM_MEMBERS.route,
[SCREENS.ROOM_MEMBERS.INVITE]: ROUTES.ROOM_INVITE.route,
[SCREENS.ROOM_MEMBERS.DETAILS]: ROUTES.ROOM_MEMBER_DETAILS.route,
[SCREENS.ROOM_MEMBERS.DYNAMIC_ROOT]: DYNAMIC_ROUTES.ROOM_MEMBERS.path,
[SCREENS.ROOM_MEMBERS.DYNAMIC_INVITE]: DYNAMIC_ROUTES.ROOM_INVITE.path,
[SCREENS.ROOM_MEMBERS.DYNAMIC_DETAILS]: DYNAMIC_ROUTES.ROOM_MEMBER_DETAILS.path,
},
},
[SCREENS.RIGHT_MODAL.MONEY_REQUEST]: {
Expand Down Expand Up @@ -1896,7 +1896,7 @@ const config: LinkingOptions<RootNavigatorParamList>['config'] = {
},
[SCREENS.RIGHT_MODAL.SPLIT_DETAILS]: {
screens: {
[SCREENS.SPLIT_DETAILS.ROOT]: ROUTES.SPLIT_BILL_DETAILS.route,
[SCREENS.SPLIT_DETAILS.DYNAMIC_ROOT]: DYNAMIC_ROUTES.SPLIT_BILL_DETAILS.path,
},
},
[SCREENS.RIGHT_MODAL.TASK_DETAILS]: {
Expand Down
16 changes: 4 additions & 12 deletions src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1831,22 +1831,16 @@ type ParticipantsNavigatorParamList = {
};

type RoomMembersNavigatorParamList = {
[SCREENS.ROOM_MEMBERS.ROOT]: {
[SCREENS.ROOM_MEMBERS.DYNAMIC_ROOT]: {
reportID: string;
// eslint-disable-next-line no-restricted-syntax -- `backTo` usages in this file are legacy. Do not add new `backTo` params to screens. See contributingGuides/NAVIGATION.md
backTo?: Routes;
};
[SCREENS.ROOM_MEMBERS.INVITE]: {
[SCREENS.ROOM_MEMBERS.DYNAMIC_INVITE]: {
reportID: string;
role?: 'accountant';
// eslint-disable-next-line no-restricted-syntax -- `backTo` usages in this file are legacy. Do not add new `backTo` params to screens. See contributingGuides/NAVIGATION.md
backTo?: Routes;
};
[SCREENS.ROOM_MEMBERS.DETAILS]: {
[SCREENS.ROOM_MEMBERS.DYNAMIC_DETAILS]: {
reportID: string;
accountID: string;
// eslint-disable-next-line no-restricted-syntax -- `backTo` usages in this file are legacy. Do not add new `backTo` params to screens. See contributingGuides/NAVIGATION.md
backTo?: Routes;
};
};

Expand Down Expand Up @@ -2335,11 +2329,9 @@ type EnablePaymentsNavigatorParamList = {
};

type SplitDetailsNavigatorParamList = {
[SCREENS.SPLIT_DETAILS.ROOT]: {
[SCREENS.SPLIT_DETAILS.DYNAMIC_ROOT]: {
reportID: string;
reportActionID: string;
// eslint-disable-next-line no-restricted-syntax -- `backTo` usages in this file are legacy. Do not add new `backTo` params to screens. See contributingGuides/NAVIGATION.md
backTo?: Routes;
};
[SCREENS.SPLIT_DETAILS.EDIT_REQUEST]: {
field: string;
Expand Down
4 changes: 2 additions & 2 deletions src/pages/DynamicReportDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ function DynamicReportDetailsPage({policy, report, route, reportMetadata, report
shouldShowRightIcon: true,
action: () => {
if (shouldOpenRoomMembersPage) {
Navigation.navigate(ROUTES.ROOM_MEMBERS.getRoute(report?.reportID, Navigation.getActiveRoute()));
Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.ROOM_MEMBERS.path));
} else {
Navigation.navigate(ROUTES.REPORT_PARTICIPANTS.getRoute(report?.reportID, Navigation.getActiveRoute()));
}
Expand All @@ -448,7 +448,7 @@ function DynamicReportDetailsPage({policy, report, route, reportMetadata, report
isAnonymousAction: false,
shouldShowRightIcon: true,
action: () => {
Navigation.navigate(ROUTES.ROOM_INVITE.getRoute(report?.reportID));
Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.ROOM_INVITE.path));
},
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import type {WithNavigationTransitionEndProps} from '@components/withNavigationT
import useAncestors from '@hooks/useAncestors';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useDelegateAccountID from '@hooks/useDelegateAccountID';
import useDynamicBackPath from '@hooks/useDynamicBackPath';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
import usePersonalDetailSearchSelector from '@hooks/usePersonalDetailSearchSelector';
Expand Down Expand Up @@ -46,20 +47,16 @@ import {isEmptyObject} from '@src/types/utils/EmptyObject';
import type {WithReportOrNotFoundProps} from './inbox/report/withReportOrNotFound';
import withReportOrNotFound from './inbox/report/withReportOrNotFound';

type RoomInvitePageProps = WithReportOrNotFoundProps & WithNavigationTransitionEndProps & PlatformStackScreenProps<RoomMembersNavigatorParamList, typeof SCREENS.ROOM_MEMBERS.INVITE>;
type DynamicRoomInvitePageProps = WithReportOrNotFoundProps &
WithNavigationTransitionEndProps &
PlatformStackScreenProps<RoomMembersNavigatorParamList, typeof SCREENS.ROOM_MEMBERS.DYNAMIC_INVITE>;

type MembersSection = SectionListData<OptionData, Section<OptionData>>;
function RoomInvitePage({
report,
policy,
didScreenTransitionEnd,
route: {
params: {backTo},
},
}: RoomInvitePageProps) {
function DynamicRoomInvitePage({report, policy, didScreenTransitionEnd}: DynamicRoomInvitePageProps) {
const styles = useThemeStyles();
const reportAttributes = useReportAttributes();
const {translate, formatPhoneNumber} = useLocalize();
const backPath = useDynamicBackPath(DYNAMIC_ROUTES.ROOM_INVITE.path);
const [userSearchPhrase] = useOnyx(ONYXKEYS.ROOM_MEMBERS_USER_SEARCH_PHRASE);
const [countryCode = CONST.DEFAULT_COUNTRY_CODE] = useOnyx(ONYXKEYS.COUNTRY_CODE);
const [reportMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${report?.reportID}`, {selector: pendingChatMembersSelector});
Expand Down Expand Up @@ -124,12 +121,8 @@ function RoomInvitePage({
// Non policy members should not be able to view the participants of a room
const reportID = report?.reportID;
const isPolicyEmployee = isPolicyEmployeeUtil(report?.policyID, policy);
const backRoute =
reportID &&
(!isPolicyEmployee || isReportArchived
? createDynamicRoute(DYNAMIC_ROUTES.REPORT_DETAILS.path, ROUTES.REPORT_WITH_ID.getRoute(reportID))
: ROUTES.ROOM_MEMBERS.getRoute(reportID, backTo));

const reportDetailsRoute = reportID ? createDynamicRoute(DYNAMIC_ROUTES.REPORT_DETAILS.path, ROUTES.REPORT_WITH_ID.getRoute(reportID)) : undefined;
const backRoute = reportID && (!isPolicyEmployee || isReportArchived) ? reportDetailsRoute : backPath;
const reportName = getReportName(report, reportAttributes);

const ancestors = useAncestors(report);
Expand Down Expand Up @@ -167,11 +160,7 @@ function RoomInvitePage({
inviteToRoom(report, invitedEmailsToAccountIDs, formatPhoneNumber);
}
};
if (backTo) {
Navigation.goBack(backTo, {afterTransition});
} else {
Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(report.reportID), {afterTransition});
}
Navigation.goBack(backRoute, {afterTransition});
}
};

Expand Down Expand Up @@ -220,7 +209,7 @@ function RoomInvitePage({
return (
<ScreenWrapper
shouldEnableMaxHeight
testID="RoomInvitePage"
testID="DynamicRoomInvitePage"
includeSafeAreaPaddingBottom
>
<FullPageNotFoundView
Expand Down Expand Up @@ -256,4 +245,4 @@ function RoomInvitePage({
);
}

export default withNavigationTransitionEnd(withReportOrNotFound()(RoomInvitePage));
export default withNavigationTransitionEnd(withReportOrNotFound()(DynamicRoomInvitePage));
Loading
Loading