Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
20 changes: 10 additions & 10 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import type CONST from './CONST';
import type {IOUAction, IOUType} from './CONST';
import type {IOURequestType} from './libs/actions/IOU';
import Log from './libs/Log';
import type {RootNavigatorParamList} from './libs/Navigation/types';
import type {ReimbursementAccountStepToOpen} from './libs/ReimbursementAccountUtils';
import type {AttachmentModalScreenParams} from './pages/media/AttachmentModalScreen/types';
import SCREENS from './SCREENS';
import type {Screen} from './SCREENS';
import type {ExitReason} from './types/form/ExitSurveyReasonForm';
Expand Down Expand Up @@ -450,6 +450,10 @@ const ROUTES = {
return `r/${reportID}/avatar` as const;
},
},
ATTACHMENTS: {
route: 'attachment',
getRoute: (params?: ReportAttachmentsRouteParams) => getAttachmentModalScreenRoute('attachment', params),
},
EDIT_CURRENCY_REQUEST: {
route: 'r/:threadReportID/edit/currency',
getRoute: (threadReportID: string, currency: string, backTo: string) => `r/${threadReportID}/edit/currency?currency=${currency}&backTo=${backTo}` as const,
Expand All @@ -475,10 +479,6 @@ const ROUTES = {
return getUrlWithBackToParam(`r/${reportID}/details/shareCode` as const, backTo);
},
},
ATTACHMENTS: {
route: 'attachment',
getRoute: (params?: AttachmentRouteParams) => getAttachmentModalScreenRoute('attachment', params),
},
REPORT_PARTICIPANTS: {
route: 'r/:reportID/participants',
getRoute: (reportID: string, backTo?: string) => getUrlWithBackToParam(`r/${reportID}/participants` as const, backTo),
Expand Down Expand Up @@ -2781,12 +2781,12 @@ const SHARED_ROUTE_PARAMS: Partial<Record<Screen, string[]>> = {
export {getUrlWithBackToParam, PUBLIC_SCREENS_ROUTES, SHARED_ROUTE_PARAMS};
export default ROUTES;

type AttachmentsRoute = typeof ROUTES.ATTACHMENTS.route;
type ReportAddAttachmentRoute = `r/${string}/attachment/add`;
type AttachmentRoutes = AttachmentsRoute | ReportAddAttachmentRoute;
type AttachmentRouteParams = AttachmentModalScreenParams;
type ReportAttachmentsRoute = typeof ROUTES.ATTACHMENTS.route;
type AttachmentRoutes = ReportAttachmentsRoute;

type ReportAttachmentsRouteParams = RootNavigatorParamList[typeof SCREENS.ATTACHMENTS];

function getAttachmentModalScreenRoute(url: AttachmentRoutes, params?: AttachmentRouteParams) {
function getAttachmentModalScreenRoute(url: AttachmentRoutes, params?: ReportAttachmentsRouteParams) {
if (!params?.source) {
return url;
}
Expand Down
92 changes: 62 additions & 30 deletions src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import type {SearchQueryString} from '@components/Search/types';
import type {IOURequestType} from '@libs/actions/IOU';
import type {SaveSearchParams} from '@libs/API/parameters';
import type {ReimbursementAccountStepToOpen} from '@libs/ReimbursementAccountUtils';
import type {AttachmentModalScreenParams} from '@pages/media/AttachmentModalScreen/types';
import type {AvatarSource} from '@libs/UserUtils';
import type CONST from '@src/CONST';
import type {Country, IOUAction, IOUType} from '@src/CONST';
import type NAVIGATORS from '@src/NAVIGATORS';
Expand Down Expand Up @@ -1859,7 +1859,7 @@ type ReportsSplitNavigatorParamList = {
transactionID?: string;
iouReportID?: string;
};
[SCREENS.ATTACHMENTS]: AttachmentModalScreenParams;
[SCREENS.ATTACHMENTS]: AttachmentModalScreensParamList[typeof SCREENS.ATTACHMENTS];
};

type SettingsSplitNavigatorParamList = {
Expand Down Expand Up @@ -2115,18 +2115,34 @@ type PublicScreensParamList = SharedScreensParamList & {
[NAVIGATORS.TEST_TOOLS_MODAL_NAVIGATOR]: NavigatorScreenParams<TestToolsModalModalNavigatorParamList>;
};

type AuthScreensParamList = SharedScreensParamList & {
[SCREENS.CONCIERGE]: undefined;
[SCREENS.TRACK_EXPENSE]: undefined;
[SCREENS.SUBMIT_EXPENSE]: undefined;
[SCREENS.ATTACHMENTS]: AttachmentModalScreenParams;
type AttachmentModalScreensParamList = {
[SCREENS.ATTACHMENTS]: {
source?: AvatarSource;
reportID?: string;
accountID?: number;
attachmentID?: string;
type?: ValueOf<typeof CONST.ATTACHMENT_TYPE>;
fallbackSource?: AvatarSource;
isAuthTokenRequired?: boolean;
originalFileName?: string;
attachmentLink?: string;
headerTitle?: string;
hashKey?: number;
maybeIcon?: boolean;
onShow?: () => void;
onClose?: () => void;
};
[SCREENS.PROFILE_AVATAR]: {
accountID: string;
accountID: number;
backTo?: Routes;
onShow?: () => void;
onClose?: () => void;
};
[SCREENS.WORKSPACE_AVATAR]: {
policyID: string;
letter?: UpperCaseCharacters;
onShow?: () => void;
onClose?: () => void;
};
[SCREENS.WORKSPACE_JOIN_USER]: {
policyID: string;
Expand All @@ -2135,45 +2151,60 @@ type AuthScreensParamList = SharedScreensParamList & {
[SCREENS.REPORT_AVATAR]: {
reportID: string;
policyID?: string;
onShow?: () => void;
onClose?: () => void;
};
[SCREENS.WORKSPACES_LIST]: {
backTo?: Routes;
};
[SCREENS.NOT_FOUND]: undefined;
[SCREENS.REQUIRE_TWO_FACTOR_AUTH]: undefined;
[NAVIGATORS.REPORTS_SPLIT_NAVIGATOR]: NavigatorScreenParams<ReportsSplitNavigatorParamList>;
[NAVIGATORS.SETTINGS_SPLIT_NAVIGATOR]: NavigatorScreenParams<SettingsSplitNavigatorParamList>;
[NAVIGATORS.WORKSPACE_SPLIT_NAVIGATOR]: NavigatorScreenParams<WorkspaceSplitNavigatorParamList>;
[NAVIGATORS.RIGHT_MODAL_NAVIGATOR]: NavigatorScreenParams<RightModalNavigatorParamList>;
[NAVIGATORS.ONBOARDING_MODAL_NAVIGATOR]: NavigatorScreenParams<OnboardingModalNavigatorParamList>;
[NAVIGATORS.FEATURE_TRAINING_MODAL_NAVIGATOR]: NavigatorScreenParams<FeatureTrainingNavigatorParamList>;
[NAVIGATORS.WELCOME_VIDEO_MODAL_NAVIGATOR]: NavigatorScreenParams<WelcomeVideoModalNavigatorParamList>;
[NAVIGATORS.EXPLANATION_MODAL_NAVIGATOR]: NavigatorScreenParams<ExplanationModalNavigatorParamList>;
[NAVIGATORS.MIGRATED_USER_MODAL_NAVIGATOR]: NavigatorScreenParams<MigratedUserModalNavigatorParamList>;
[NAVIGATORS.TEST_DRIVE_MODAL_NAVIGATOR]: NavigatorScreenParams<TestDriveModalNavigatorParamList>;
[NAVIGATORS.TEST_DRIVE_DEMO_NAVIGATOR]: NavigatorScreenParams<TestDriveDemoNavigatorParamList>;
[NAVIGATORS.SEARCH_FULLSCREEN_NAVIGATOR]: NavigatorScreenParams<SearchFullscreenNavigatorParamList>;
[SCREENS.DESKTOP_SIGN_IN_REDIRECT]: undefined;
[SCREENS.TRANSACTION_RECEIPT]: {
reportID: string;
transactionID: string;
readonly?: string;
isFromReviewDuplicates?: string;
action?: IOUAction;
iouType?: IOUType;
mergeTransactionID?: string;
onShow?: () => void;
onClose?: () => void;
};
[SCREENS.MONEY_REQUEST.RECEIPT_PREVIEW]: {
reportID: string;
transactionID: string;
action: IOUAction;
iouType: IOUType;
readonly: string;
onShow?: () => void;
onClose?: () => void;
};
[SCREENS.CONNECTION_COMPLETE]: undefined;
[NAVIGATORS.SHARE_MODAL_NAVIGATOR]: NavigatorScreenParams<ShareNavigatorParamList>;
[SCREENS.BANK_CONNECTION_COMPLETE]: undefined;
[NAVIGATORS.TEST_TOOLS_MODAL_NAVIGATOR]: NavigatorScreenParams<TestToolsModalModalNavigatorParamList>;
};

type AuthScreensParamList = SharedScreensParamList &
AttachmentModalScreensParamList & {
[SCREENS.CONCIERGE]: undefined;
[SCREENS.TRACK_EXPENSE]: undefined;
[SCREENS.SUBMIT_EXPENSE]: undefined;
[SCREENS.WORKSPACES_LIST]: {
backTo?: Routes;
};
[SCREENS.NOT_FOUND]: undefined;
[SCREENS.REQUIRE_TWO_FACTOR_AUTH]: undefined;
[NAVIGATORS.REPORTS_SPLIT_NAVIGATOR]: NavigatorScreenParams<ReportsSplitNavigatorParamList>;
[NAVIGATORS.SETTINGS_SPLIT_NAVIGATOR]: NavigatorScreenParams<SettingsSplitNavigatorParamList>;
[NAVIGATORS.WORKSPACE_SPLIT_NAVIGATOR]: NavigatorScreenParams<WorkspaceSplitNavigatorParamList>;
[NAVIGATORS.RIGHT_MODAL_NAVIGATOR]: NavigatorScreenParams<RightModalNavigatorParamList>;
[NAVIGATORS.ONBOARDING_MODAL_NAVIGATOR]: NavigatorScreenParams<OnboardingModalNavigatorParamList>;
[NAVIGATORS.FEATURE_TRAINING_MODAL_NAVIGATOR]: NavigatorScreenParams<FeatureTrainingNavigatorParamList>;
[NAVIGATORS.WELCOME_VIDEO_MODAL_NAVIGATOR]: NavigatorScreenParams<WelcomeVideoModalNavigatorParamList>;
[NAVIGATORS.EXPLANATION_MODAL_NAVIGATOR]: NavigatorScreenParams<ExplanationModalNavigatorParamList>;
[NAVIGATORS.MIGRATED_USER_MODAL_NAVIGATOR]: NavigatorScreenParams<MigratedUserModalNavigatorParamList>;
[NAVIGATORS.TEST_DRIVE_MODAL_NAVIGATOR]: NavigatorScreenParams<TestDriveModalNavigatorParamList>;
[NAVIGATORS.TEST_DRIVE_DEMO_NAVIGATOR]: NavigatorScreenParams<TestDriveDemoNavigatorParamList>;
[NAVIGATORS.SEARCH_FULLSCREEN_NAVIGATOR]: NavigatorScreenParams<SearchFullscreenNavigatorParamList>;
[SCREENS.DESKTOP_SIGN_IN_REDIRECT]: undefined;
[SCREENS.CONNECTION_COMPLETE]: undefined;
[NAVIGATORS.SHARE_MODAL_NAVIGATOR]: NavigatorScreenParams<ShareNavigatorParamList>;
[SCREENS.BANK_CONNECTION_COMPLETE]: undefined;
[NAVIGATORS.TEST_TOOLS_MODAL_NAVIGATOR]: NavigatorScreenParams<TestToolsModalModalNavigatorParamList>;
};

type SearchReportParamList = {
[SCREENS.SEARCH.REPORT_RHP]: {
reportID: string;
Expand Down Expand Up @@ -2409,4 +2440,5 @@ export type {
ReportChangeApproverParamList,
TestToolsModalModalNavigatorParamList,
MergeTransactionNavigatorParamList,
AttachmentModalScreensParamList,
};
Loading
Loading