From bfbeceeacecf644af5ffbee1f73bec5645c5fa3b Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Mon, 9 Oct 2023 15:39:47 +0200 Subject: [PATCH 01/52] ref: moved UnredIndicatorUpdater to TS --- .../UnreadIndicatorUpdater/{index.js => index.ts} | 7 +++---- .../updateUnread/index.android.js | 2 -- .../updateUnread/index.android.ts | 5 +++++ .../{index.desktop.js => index.desktop.ts} | 6 +++--- .../updateUnread/{index.ios.js => index.ios.ts} | 7 +++---- .../updateUnread/{index.website.js => index.ts} | 12 +++++++----- .../UnreadIndicatorUpdater/updateUnread/types.ts | 3 +++ 7 files changed, 24 insertions(+), 18 deletions(-) rename src/libs/UnreadIndicatorUpdater/{index.js => index.ts} (56%) delete mode 100644 src/libs/UnreadIndicatorUpdater/updateUnread/index.android.js create mode 100644 src/libs/UnreadIndicatorUpdater/updateUnread/index.android.ts rename src/libs/UnreadIndicatorUpdater/updateUnread/{index.desktop.js => index.desktop.ts} (77%) rename src/libs/UnreadIndicatorUpdater/updateUnread/{index.ios.js => index.ios.ts} (69%) rename src/libs/UnreadIndicatorUpdater/updateUnread/{index.website.js => index.ts} (74%) create mode 100644 src/libs/UnreadIndicatorUpdater/updateUnread/types.ts diff --git a/src/libs/UnreadIndicatorUpdater/index.js b/src/libs/UnreadIndicatorUpdater/index.ts similarity index 56% rename from src/libs/UnreadIndicatorUpdater/index.js rename to src/libs/UnreadIndicatorUpdater/index.ts index 09fa82612314..a20373a75494 100644 --- a/src/libs/UnreadIndicatorUpdater/index.js +++ b/src/libs/UnreadIndicatorUpdater/index.ts @@ -1,14 +1,13 @@ -import _ from 'underscore'; import Onyx from 'react-native-onyx'; import ONYXKEYS from '../../ONYXKEYS'; -import updateUnread from './updateUnread/index'; +import updateUnread from './updateUnread'; import * as ReportUtils from '../ReportUtils'; Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, waitForCollectionCallback: true, callback: (reportsFromOnyx) => { - const unreadReports = _.filter(reportsFromOnyx, ReportUtils.isUnread); - updateUnread(_.size(unreadReports)); + const unreadReports = Object.values(reportsFromOnyx ?? {}).filter((report) => ReportUtils.isUnread(report)); + updateUnread(unreadReports.length); }, }); diff --git a/src/libs/UnreadIndicatorUpdater/updateUnread/index.android.js b/src/libs/UnreadIndicatorUpdater/updateUnread/index.android.js deleted file mode 100644 index 731b8058a9a7..000000000000 --- a/src/libs/UnreadIndicatorUpdater/updateUnread/index.android.js +++ /dev/null @@ -1,2 +0,0 @@ -// Android does not yet implement this -export default () => {}; diff --git a/src/libs/UnreadIndicatorUpdater/updateUnread/index.android.ts b/src/libs/UnreadIndicatorUpdater/updateUnread/index.android.ts new file mode 100644 index 000000000000..567b8dded5cf --- /dev/null +++ b/src/libs/UnreadIndicatorUpdater/updateUnread/index.android.ts @@ -0,0 +1,5 @@ +import UpdateUnread from './types'; + +// Android does not yet implement this +const updateUnread: UpdateUnread = () => {}; +export default updateUnread; diff --git a/src/libs/UnreadIndicatorUpdater/updateUnread/index.desktop.js b/src/libs/UnreadIndicatorUpdater/updateUnread/index.desktop.ts similarity index 77% rename from src/libs/UnreadIndicatorUpdater/updateUnread/index.desktop.js rename to src/libs/UnreadIndicatorUpdater/updateUnread/index.desktop.ts index b9a689e89c42..e5d2fca43bf4 100644 --- a/src/libs/UnreadIndicatorUpdater/updateUnread/index.desktop.js +++ b/src/libs/UnreadIndicatorUpdater/updateUnread/index.desktop.ts @@ -1,14 +1,14 @@ import ELECTRON_EVENTS from '../../../../desktop/ELECTRON_EVENTS'; +import UpdateUnread from './types'; /** * Set the badge on desktop * - * @param {Number} totalCount */ -function updateUnread(totalCount) { +const updateUnread: UpdateUnread = (totalCount) => { // Ask the main Electron process to update our // badge count in the Mac OS dock icon window.electron.send(ELECTRON_EVENTS.REQUEST_UPDATE_BADGE_COUNT, totalCount); -} +}; export default updateUnread; diff --git a/src/libs/UnreadIndicatorUpdater/updateUnread/index.ios.js b/src/libs/UnreadIndicatorUpdater/updateUnread/index.ios.ts similarity index 69% rename from src/libs/UnreadIndicatorUpdater/updateUnread/index.ios.js rename to src/libs/UnreadIndicatorUpdater/updateUnread/index.ios.ts index 62ee00828566..d6fac7c7771d 100644 --- a/src/libs/UnreadIndicatorUpdater/updateUnread/index.ios.js +++ b/src/libs/UnreadIndicatorUpdater/updateUnread/index.ios.ts @@ -1,13 +1,12 @@ import Airship from '@ua/react-native-airship'; +import UpdateUnread from './types'; /** * Set the App Icon badge with the number of * unread messages on iOS - * - * @param {Number} totalCount */ -function updateUnread(totalCount) { +const updateUnread: UpdateUnread = (totalCount) => { Airship.push.iOS.setBadgeNumber(totalCount); -} +}; export default updateUnread; diff --git a/src/libs/UnreadIndicatorUpdater/updateUnread/index.website.js b/src/libs/UnreadIndicatorUpdater/updateUnread/index.ts similarity index 74% rename from src/libs/UnreadIndicatorUpdater/updateUnread/index.website.js rename to src/libs/UnreadIndicatorUpdater/updateUnread/index.ts index 244eaf805d10..e6f1fc089082 100644 --- a/src/libs/UnreadIndicatorUpdater/updateUnread/index.website.js +++ b/src/libs/UnreadIndicatorUpdater/updateUnread/index.ts @@ -2,13 +2,12 @@ * Web browsers have a tab title and favicon which can be updated to show there are unread comments */ import CONFIG from '../../../CONFIG'; +import UpdateUnread from './types'; /** * Set the page title on web - * - * @param {Number} totalCount */ -function updateUnread(totalCount) { +const updateUnread: UpdateUnread = (totalCount) => { const hasUnread = totalCount !== 0; // This setTimeout is required because due to how react rendering messes with the DOM, the document title can't be modified synchronously, and we must wait until all JS is done @@ -18,8 +17,11 @@ function updateUnread(totalCount) { // seems to improve this issue. document.title = ''; document.title = hasUnread ? `(${totalCount}) ${CONFIG.SITE_TITLE}` : CONFIG.SITE_TITLE; - document.getElementById('favicon').href = hasUnread ? CONFIG.FAVICON.UNREAD : CONFIG.FAVICON.DEFAULT; + const favicon = document.getElementById('favicon'); + if (favicon && 'href' in favicon) { + favicon.href = hasUnread ? CONFIG.FAVICON.UNREAD : CONFIG.FAVICON.DEFAULT; + } }, 0); -} +}; export default updateUnread; diff --git a/src/libs/UnreadIndicatorUpdater/updateUnread/types.ts b/src/libs/UnreadIndicatorUpdater/updateUnread/types.ts new file mode 100644 index 000000000000..afbb2741a454 --- /dev/null +++ b/src/libs/UnreadIndicatorUpdater/updateUnread/types.ts @@ -0,0 +1,3 @@ +type UpdateUnread = (totalCount: number) => void; + +export default UpdateUnread; From 71d5b83558ca43652eb841897007bc5e391ddb7c Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 29 Nov 2023 12:43:16 +0100 Subject: [PATCH 02/52] Migrate src/libs/getModalState.js --- src/libs/{getModalState.js => getModalState.ts} | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) rename src/libs/{getModalState.js => getModalState.ts} (57%) diff --git a/src/libs/getModalState.js b/src/libs/getModalState.ts similarity index 57% rename from src/libs/getModalState.js rename to src/libs/getModalState.ts index 30ff8499809a..47aa0c406b29 100644 --- a/src/libs/getModalState.js +++ b/src/libs/getModalState.ts @@ -1,12 +1,13 @@ -import Onyx from 'react-native-onyx'; +import Onyx, {OnyxEntry} from 'react-native-onyx'; import ONYXKEYS from '@src/ONYXKEYS'; +import Modal from '@src/types/onyx/Modal'; -let modalState = {}; +let modalState: OnyxEntry = {}; Onyx.connect({ key: ONYXKEYS.MODAL, - callback: (val) => { - modalState = val; + callback: (value) => { + modalState = value; }, }); @@ -14,8 +15,7 @@ Onyx.connect({ * Returns the modal state from onyx. * Note: You should use the HOCs/hooks to get onyx data, instead of using this directly. * A valid use case to use this is if the value is only needed once for an initial value. - * @returns {Object} */ -export default function getModalState() { +export default function getModalState(): OnyxEntry { return modalState; } From 863114e553d487eb4dad45e58c3a40d816b0ba37 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 29 Nov 2023 12:55:29 +0100 Subject: [PATCH 03/52] Migrate src/libs/NextStepUtils.js --- src/libs/{NextStepUtils.js => NextStepUtils.ts} | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) rename src/libs/{NextStepUtils.js => NextStepUtils.ts} (68%) diff --git a/src/libs/NextStepUtils.js b/src/libs/NextStepUtils.ts similarity index 68% rename from src/libs/NextStepUtils.js rename to src/libs/NextStepUtils.ts index 303f9b2a9925..1d99da633a4e 100644 --- a/src/libs/NextStepUtils.js +++ b/src/libs/NextStepUtils.ts @@ -1,11 +1,15 @@ import Str from 'expensify-common/lib/str'; -import _ from 'underscore'; -function parseMessage(messageToParse) { +type Message = { + text: string; + type?: string; +}; + +function parseMessage(messages: Message[]) { let nextStepHTML = ''; - _.each(messageToParse, (part) => { - const tagType = part.type || 'span'; + messages?.forEach((part) => { + const tagType = part.type ?? 'span'; nextStepHTML += `<${tagType}>${Str.safeEscape(part.text)}`; }); From 194c1e14690d67ede84df568c613117153bc2eac Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 29 Nov 2023 13:00:55 +0100 Subject: [PATCH 04/52] Migrate src/libs/HeaderUtils.js --- src/libs/{HeaderUtils.js => HeaderUtils.ts} | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) rename src/libs/{HeaderUtils.js => HeaderUtils.ts} (75%) diff --git a/src/libs/HeaderUtils.js b/src/libs/HeaderUtils.ts similarity index 75% rename from src/libs/HeaderUtils.js rename to src/libs/HeaderUtils.ts index 2edca95ecf74..39dc0bc706e3 100644 --- a/src/libs/HeaderUtils.js +++ b/src/libs/HeaderUtils.ts @@ -1,13 +1,17 @@ +import {SvgProps} from 'react-native-svg'; import * as Expensicons from '@components/Icon/Expensicons'; +import OnyxReport from '@src/types/onyx/Report'; import * as Report from './actions/Report'; import * as Session from './actions/Session'; import * as Localize from './Localize'; -/** - * @param {Object} report - * @returns {Object} pin/unpin object - */ -function getPinMenuItem(report) { +type MenuItem = { + icon: string | React.FC; + text: string; + onSelected: () => void; +}; + +function getPinMenuItem(report: OnyxReport): MenuItem { if (!report.isPinned) { return { icon: Expensicons.Pin, From 6d2e5009b0bb263b9c3350820d646b6e64373bb8 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 29 Nov 2023 13:56:18 +0100 Subject: [PATCH 05/52] Migrate src/libs/DistanceRequestUtils.ts --- src/libs/DistanceRequestUtils.js | 112 ---------------------------- src/libs/DistanceRequestUtils.ts | 121 +++++++++++++++++++++++++++++++ src/libs/HeaderUtils.ts | 7 +- src/types/onyx/Policy.ts | 21 +++++- 4 files changed, 145 insertions(+), 116 deletions(-) delete mode 100644 src/libs/DistanceRequestUtils.js create mode 100644 src/libs/DistanceRequestUtils.ts diff --git a/src/libs/DistanceRequestUtils.js b/src/libs/DistanceRequestUtils.js deleted file mode 100644 index 0f994cc54f93..000000000000 --- a/src/libs/DistanceRequestUtils.js +++ /dev/null @@ -1,112 +0,0 @@ -import _ from 'underscore'; -import CONST from '@src/CONST'; -import * as CurrencyUtils from './CurrencyUtils'; -import * as PolicyUtils from './PolicyUtils'; - -/** - * Retrieves the default mileage rate based on a given policy. - * - * @param {Object} policy - The policy from which to extract the default mileage rate. - * @param {Object} [policy.customUnits] - Custom units defined in the policy. - * @param {Object[]} [policy.customUnits.rates] - Rates used in the policy. - * @param {Object} [policy.customUnits.attributes] - attributes on a custom unit - * @param {'mi' | 'km'} [policy.customUnits.attributes.unit] - unit of measurement for the distance - * - * @returns {Object|null} An object containing the rate and unit for the default mileage or null if not found. - * @returns {Number} .rate - The default rate for the mileage. - * @returns {String} .currency - The currency associated with the rate. - * @returns {String} .unit - The unit of measurement for the distance. - */ -const getDefaultMileageRate = (policy) => { - if (!policy || !policy.customUnits) { - return null; - } - - const distanceUnit = _.find(_.values(policy.customUnits), (unit) => unit.name === CONST.CUSTOM_UNITS.NAME_DISTANCE); - if (!distanceUnit) { - return null; - } - - const distanceRate = _.find(_.values(distanceUnit.rates), (rate) => rate.name === CONST.CUSTOM_UNITS.DEFAULT_RATE); - if (!distanceRate) { - return null; - } - - return { - rate: distanceRate.rate, - currency: distanceRate.currency, - unit: distanceUnit.attributes.unit, - }; -}; - -/** - * Converts a given distance in meters to the specified unit (kilometers or miles). - * - * @param {Number} distanceInMeters - The distance in meters to be converted. - * @param {'mi' | 'km'} unit - The desired unit of conversion, either 'km' for kilometers or 'mi' for miles. - * - * @returns {Number} The converted distance in the specified unit. - */ -function convertDistanceUnit(distanceInMeters, unit) { - const METERS_TO_KM = 0.001; // 1 kilometer is 1000 meters - const METERS_TO_MILES = 0.000621371; // There are approximately 0.000621371 miles in a meter - - switch (unit) { - case CONST.CUSTOM_UNITS.DISTANCE_UNIT_KILOMETERS: - return distanceInMeters * METERS_TO_KM; - case CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES: - return distanceInMeters * METERS_TO_MILES; - default: - throw new Error('Unsupported unit. Supported units are "mi" or "km".'); - } -} - -/** - * - * @param {Number} distanceInMeters Distance traveled - * @param {'mi' | 'km'} unit Unit that should be used to display the distance - * @returns {String} The distance in requested units, rounded to 2 decimals - */ -const getRoundedDistanceInUnits = (distanceInMeters, unit) => { - const convertedDistance = convertDistanceUnit(distanceInMeters, unit); - return convertedDistance.toFixed(2); -}; - -/** - * - * @param {boolean} hasRoute Whether the route exists for the distance request - * @param {Number} distanceInMeters Distance traveled - * @param {'mi' | 'km'} unit Unit that should be used to display the distance - * @param {Number} rate Expensable amount allowed per unit - * @param {String} currency The currency associated with the rate - * @param {Function} translate Translate function - * @param {Function} toLocaleDigit Function to convert to localized digit - * @returns {String} A string that describes the distance traveled and the rate used for expense calculation - */ -const getDistanceMerchant = (hasRoute, distanceInMeters, unit, rate, currency, translate, toLocaleDigit) => { - const distanceInUnits = hasRoute ? getRoundedDistanceInUnits(distanceInMeters, unit) : translate('common.tbd'); - - const distanceUnit = unit === CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES ? translate('common.miles') : translate('common.kilometers'); - const singularDistanceUnit = unit === CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES ? translate('common.mile') : translate('common.kilometer'); - const unitString = distanceInUnits === 1 ? singularDistanceUnit : distanceUnit; - const ratePerUnit = rate ? PolicyUtils.getUnitRateValue({rate}, toLocaleDigit) : translate('common.tbd'); - const currencySymbol = rate ? CurrencyUtils.getCurrencySymbol(currency) || `${currency} ` : ''; - - return `${distanceInUnits} ${unitString} @ ${currencySymbol}${ratePerUnit} / ${singularDistanceUnit}`; -}; - -/** - * Calculates the request amount based on distance, unit, and rate. - * - * @param {Number} distance - The distance traveled in meters - * @param {'mi' | 'km'} unit - The unit of measurement for the distance - * @param {Number} rate - Rate used for calculating the request amount - * @returns {Number} The computed request amount (rounded) in "cents". - */ -const getDistanceRequestAmount = (distance, unit, rate) => { - const convertedDistance = convertDistanceUnit(distance, unit); - const roundedDistance = convertedDistance.toFixed(2); - return Math.round(roundedDistance * rate); -}; - -export default {getDefaultMileageRate, getDistanceMerchant, getDistanceRequestAmount}; diff --git a/src/libs/DistanceRequestUtils.ts b/src/libs/DistanceRequestUtils.ts new file mode 100644 index 000000000000..ad0b814f1e5c --- /dev/null +++ b/src/libs/DistanceRequestUtils.ts @@ -0,0 +1,121 @@ +import type {LocaleContextProps} from '@components/LocaleContextProvider'; +import CONST from '@src/CONST'; +import Policy, {Unit} from '@src/types/onyx/Policy'; +import * as CurrencyUtils from './CurrencyUtils'; +import * as PolicyUtils from './PolicyUtils'; + +type DefaultMileageRate = { + rate: number; + currency: string; + unit: Unit; +}; + +/** + * Retrieves the default mileage rate based on a given policy. + * + * @param policy - The policy from which to extract the default mileage rate. + * + * @returns An object containing the rate and unit for the default mileage or null if not found. + * @returns [rate] - The default rate for the mileage. + * @returns [currency] - The currency associated with the rate. + * @returns [unit] - The unit of measurement for the distance. + */ +function getDefaultMileageRate(policy: Policy): DefaultMileageRate | null { + if (!policy?.customUnits) { + return null; + } + + const distanceUnit = Object.values(policy?.customUnits ?? {}).find((unit) => unit.name === CONST.CUSTOM_UNITS.NAME_DISTANCE); + if (!distanceUnit) { + return null; + } + + const distanceRate = Object.values(distanceUnit?.rates ?? {}).find((rate) => rate.name === CONST.CUSTOM_UNITS.DEFAULT_RATE); + if (!distanceRate) { + return null; + } + + return { + rate: distanceRate.rate, + currency: distanceRate.currency, + unit: distanceUnit.attributes.unit, + }; +} + +/** + * Converts a given distance in meters to the specified unit (kilometers or miles). + * + * @param distanceInMeters - The distance in meters to be converted. + * @param unit - The desired unit of conversion, either 'km' for kilometers or 'mi' for miles. + * + * @returns The converted distance in the specified unit. + */ +function convertDistanceUnit(distanceInMeters: number, unit: Unit): number { + const METERS_TO_KM = 0.001; // 1 kilometer is 1000 meters + const METERS_TO_MILES = 0.000621371; // There are approximately 0.000621371 miles in a meter + + switch (unit) { + case CONST.CUSTOM_UNITS.DISTANCE_UNIT_KILOMETERS: + return distanceInMeters * METERS_TO_KM; + case CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES: + return distanceInMeters * METERS_TO_MILES; + default: + throw new Error('Unsupported unit. Supported units are "mi" or "km".'); + } +} + +/** + * @param distanceInMeters Distance traveled + * @param unit Unit that should be used to display the distance + * @returns The distance in requested units, rounded to 2 decimals + */ +function getRoundedDistanceInUnits(distanceInMeters: number, unit: Unit): string { + const convertedDistance = convertDistanceUnit(distanceInMeters, unit); + return convertedDistance.toFixed(2); +} + +/** + * @param hasRoute Whether the route exists for the distance request + * @param distanceInMeters Distance traveled + * @param unit Unit that should be used to display the distance + * @param rate Expensable amount allowed per unit + * @param currency The currency associated with the rate + * @param translate Translate function + * @param toLocaleDigit Function to convert to localized digit + * @returns A string that describes the distance traveled and the rate used for expense calculation + */ +function getDistanceMerchant( + hasRoute: boolean, + distanceInMeters: number, + unit: Unit, + rate: number, + currency: string, + translate: LocaleContextProps['translate'], + toLocaleDigit: LocaleContextProps['toLocaleDigit'], +): string { + const distanceInUnits = hasRoute ? getRoundedDistanceInUnits(distanceInMeters, unit) : translate('common.tbd'); + + const distanceUnit = unit === CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES ? translate('common.miles') : translate('common.kilometers'); + const singularDistanceUnit = unit === CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES ? translate('common.mile') : translate('common.kilometer'); + const unitString = distanceInUnits === '1' ? singularDistanceUnit : distanceUnit; + const ratePerUnit = rate ? PolicyUtils.getUnitRateValue({rate}, toLocaleDigit) : translate('common.tbd'); + const currencySymbol = rate ? CurrencyUtils.getCurrencySymbol(currency) ?? `${currency} ` : ''; + + return `${distanceInUnits} ${unitString} @ ${currencySymbol}${ratePerUnit} / ${singularDistanceUnit}`; +} + +/** + * Calculates the request amount based on distance, unit, and rate. + * + * @param distance - The distance traveled in meters + * @param unit - The unit of measurement for the distance + * @param rate - Rate used for calculating the request amount + * @returns The computed request amount (rounded) in "cents". + */ +function getDistanceRequestAmount(distance: number, unit: Unit, rate: number): number { + const convertedDistance = convertDistanceUnit(distance, unit); + const roundedDistance = parseFloat(convertedDistance.toFixed(2)); + return Math.round(roundedDistance * rate); +} + +export default {getDefaultMileageRate, getDistanceMerchant, getDistanceRequestAmount}; diff --git a/src/libs/HeaderUtils.ts b/src/libs/HeaderUtils.ts index 39dc0bc706e3..f7779b6db52f 100644 --- a/src/libs/HeaderUtils.ts +++ b/src/libs/HeaderUtils.ts @@ -12,17 +12,18 @@ type MenuItem = { }; function getPinMenuItem(report: OnyxReport): MenuItem { - if (!report.isPinned) { + const isPinned = report?.isPinned; + if (!isPinned) { return { icon: Expensicons.Pin, text: Localize.translateLocal('common.pin'), - onSelected: Session.checkIfActionIsAllowed(() => Report.togglePinnedState(report.reportID, report.isPinned)), + onSelected: Session.checkIfActionIsAllowed(() => Report.togglePinnedState(report.reportID, !!isPinned)), }; } return { icon: Expensicons.Pin, text: Localize.translateLocal('common.unPin'), - onSelected: Session.checkIfActionIsAllowed(() => Report.togglePinnedState(report.reportID, report.isPinned)), + onSelected: Session.checkIfActionIsAllowed(() => Report.togglePinnedState(report.reportID, isPinned)), }; } diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index e6e3240d1b23..e7550713710e 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -2,6 +2,23 @@ import {ValueOf} from 'type-fest'; import CONST from '@src/CONST'; import * as OnyxCommon from './OnyxCommon'; +type Unit = 'mi' | 'km'; + +type Rate = { + name: string; + rate: number; + currency: string; +}; + +type CustomUnit = { + customUnitID?: string; + name?: string; + attributes: { + unit: Unit; + }; + rates?: Record; +}; + type Policy = { /** The ID of the policy */ id: string; @@ -43,7 +60,7 @@ type Policy = { lastModified?: string; /** The custom units data for this policy */ - customUnits?: Record; + customUnits?: Record; /** Whether chat rooms can be created and used on this policy. Enabled manually by CQ/JS snippet. Always true for free policies. */ areChatRoomsEnabled: boolean; @@ -62,3 +79,5 @@ type Policy = { }; export default Policy; + +export {Unit}; From 63a53805e65c17767c4328eab817415147a56cfa Mon Sep 17 00:00:00 2001 From: Pavlo Tsimura Date: Thu, 30 Nov 2023 11:16:28 +0100 Subject: [PATCH 06/52] Fix task title calculation --- src/components/ReportActionItem/TaskAction.js | 4 +- .../ReportActionItem/TaskPreview.js | 3 +- src/languages/en.ts | 2 + src/languages/es.ts | 2 + src/languages/types.ts | 3 ++ src/libs/OptionsListUtils.js | 3 ++ src/libs/SidebarUtils.ts | 4 +- src/libs/TaskUtils.ts | 51 +++++++++++++++++++ src/libs/actions/Task.js | 31 ----------- .../report/ContextMenu/ContextMenuActions.js | 10 ++-- 10 files changed, 73 insertions(+), 40 deletions(-) create mode 100644 src/libs/TaskUtils.ts diff --git a/src/components/ReportActionItem/TaskAction.js b/src/components/ReportActionItem/TaskAction.js index f30d8c3908de..d79bb6f78b93 100644 --- a/src/components/ReportActionItem/TaskAction.js +++ b/src/components/ReportActionItem/TaskAction.js @@ -3,8 +3,8 @@ import React from 'react'; import {View} from 'react-native'; import Text from '@components/Text'; import withLocalize, {withLocalizePropTypes} from '@components/withLocalize'; +import * as TaskUtils from '@libs/TaskUtils'; import useThemeStyles from '@styles/useThemeStyles'; -import * as Task from '@userActions/Task'; const propTypes = { /** Name of the reportAction action */ @@ -22,7 +22,7 @@ function TaskAction(props) { return ( <> - {Task.getTaskReportActionMessage(props.actionName, props.taskReportID, false)} + {TaskUtils.getTaskReportActionMessage(props.actionName)} ); diff --git a/src/components/ReportActionItem/TaskPreview.js b/src/components/ReportActionItem/TaskPreview.js index 4e405098a2ea..b48559e237a8 100644 --- a/src/components/ReportActionItem/TaskPreview.js +++ b/src/components/ReportActionItem/TaskPreview.js @@ -21,6 +21,7 @@ import getButtonState from '@libs/getButtonState'; import * as LocalePhoneNumber from '@libs/LocalePhoneNumber'; import Navigation from '@libs/Navigation/Navigation'; import * as ReportUtils from '@libs/ReportUtils'; +import * as TaskUtils from '@libs/TaskUtils'; import reportActionPropTypes from '@pages/home/report/reportActionPropTypes'; import * as StyleUtils from '@styles/StyleUtils'; import useThemeStyles from '@styles/useThemeStyles'; @@ -83,7 +84,7 @@ function TaskPreview(props) { const isTaskCompleted = !_.isEmpty(props.taskReport) ? props.taskReport.stateNum === CONST.REPORT.STATE_NUM.SUBMITTED && props.taskReport.statusNum === CONST.REPORT.STATUS.APPROVED : props.action.childStateNum === CONST.REPORT.STATE_NUM.SUBMITTED && props.action.childStatusNum === CONST.REPORT.STATUS.APPROVED; - const taskTitle = props.taskReport.reportName || props.action.childReportName; + const taskTitle = TaskUtils.getTaskTitle(props.taskReportID, props.action.childReportName); const taskAssigneeAccountID = Task.getTaskAssigneeAccountID(props.taskReport) || props.action.childManagerAccountID; const assigneeLogin = lodashGet(personalDetails, [taskAssigneeAccountID, 'login'], ''); const assigneeDisplayName = lodashGet(personalDetails, [taskAssigneeAccountID, 'displayName'], ''); diff --git a/src/languages/en.ts b/src/languages/en.ts index 7deb38b47e28..5294f2c420e2 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -62,6 +62,7 @@ import type { SplitAmountParams, StepCounterParams, TagSelectionParams, + TaskCreatedActionParams, ThreadRequestReportNameParams, ThreadSentMoneyReportNameParams, ToValidateLoginParams, @@ -1662,6 +1663,7 @@ export default { assignee: 'Assignee', completed: 'Completed', messages: { + created: ({title}: TaskCreatedActionParams) => `task for ${title}`, completed: 'marked as complete', canceled: 'deleted task', reopened: 'marked as incomplete', diff --git a/src/languages/es.ts b/src/languages/es.ts index b52975496e08..45e518a25fb6 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -62,6 +62,7 @@ import type { SplitAmountParams, StepCounterParams, TagSelectionParams, + TaskCreatedActionParams, ThreadRequestReportNameParams, ThreadSentMoneyReportNameParams, ToValidateLoginParams, @@ -1686,6 +1687,7 @@ export default { assignee: 'Usuario asignado', completed: 'Completada', messages: { + created: ({title}: TaskCreatedActionParams) => `tarea para ${title}`, completed: 'marcada como completa', canceled: 'tarea eliminado', reopened: 'marcada como incompleta', diff --git a/src/languages/types.ts b/src/languages/types.ts index a012ebdfb95b..0851174d9ed4 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -203,6 +203,8 @@ type TagSelectionParams = {tagName: string}; type WalletProgramParams = {walletProgram: string}; +type TaskCreatedActionParams = {title: string}; + /* Translation Object types */ // eslint-disable-next-line @typescript-eslint/no-explicit-any type TranslationBaseValue = string | string[] | ((...args: any[]) => string); @@ -321,4 +323,5 @@ export type { SetTheDistanceParams, UpdatedTheDistanceParams, WalletProgramParams, + TaskCreatedActionParams, }; diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index c616587c3983..19ce8abb526b 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -18,6 +18,7 @@ import Permissions from './Permissions'; import * as PersonalDetailsUtils from './PersonalDetailsUtils'; import * as ReportActionUtils from './ReportActionsUtils'; import * as ReportUtils from './ReportUtils'; +import * as TaskUtils from './TaskUtils'; import * as TransactionUtils from './TransactionUtils'; import * as UserUtils from './UserUtils'; @@ -410,6 +411,8 @@ function getLastMessageTextForReport(report) { lastActionName === CONST.REPORT.ACTIONS.TYPE.TASKCANCELLED ) { lastMessageTextFromReport = lodashGet(lastReportAction, 'message[0].text', ''); + } else if (ReportActionUtils.isCreatedTaskReportAction(lastReportAction)) { + lastMessageTextFromReport = TaskUtils.getTaskCreatedMessage(lastReportAction); } else { lastMessageTextFromReport = report ? report.lastMessageText || '' : ''; } diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index ff9486159947..8418d8a1c3f1 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -10,7 +10,6 @@ import * as OnyxCommon from '@src/types/onyx/OnyxCommon'; import Policy from '@src/types/onyx/Policy'; import Report from '@src/types/onyx/Report'; import ReportAction, {ReportActions} from '@src/types/onyx/ReportAction'; -import * as Task from './actions/Task'; import * as CollectionUtils from './CollectionUtils'; import * as LocalePhoneNumber from './LocalePhoneNumber'; import * as Localize from './Localize'; @@ -18,6 +17,7 @@ import * as OptionsListUtils from './OptionsListUtils'; import * as PersonalDetailsUtils from './PersonalDetailsUtils'; import * as ReportActionsUtils from './ReportActionsUtils'; import * as ReportUtils from './ReportUtils'; +import * as TaskUtils from './TaskUtils'; import * as UserUtils from './UserUtils'; const visibleReportActionItems: ReportActions = {}; @@ -365,7 +365,7 @@ function getOptionData( const newName = lastAction?.originalMessage?.newName ?? ''; result.alternateText = Localize.translate(preferredLocale, 'newRoomPage.roomRenamedTo', {newName}); } else if (ReportActionsUtils.isTaskAction(lastAction)) { - result.alternateText = Task.getTaskReportActionMessage(lastAction.actionName, report.reportID, false); + result.alternateText = TaskUtils.getTaskReportActionMessage(lastAction.actionName); } else if ( lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.ROOMCHANGELOG.INVITE_TO_ROOM || lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.ROOMCHANGELOG.REMOVE_FROM_ROOM || diff --git a/src/libs/TaskUtils.ts b/src/libs/TaskUtils.ts new file mode 100644 index 000000000000..3026e33edc8c --- /dev/null +++ b/src/libs/TaskUtils.ts @@ -0,0 +1,51 @@ +import Onyx, {OnyxEntry} from 'react-native-onyx'; +import CONST from '@src/CONST'; +import ONYXKEYS from '@src/ONYXKEYS'; +import {Report} from '@src/types/onyx'; +import ReportAction from '@src/types/onyx/ReportAction'; +import * as CollectionUtils from './CollectionUtils'; +import * as Localize from './Localize'; + +const allReports: Record = {}; +Onyx.connect({ + key: ONYXKEYS.COLLECTION.REPORT, + callback: (report, key) => { + if (!key || !report) { + return; + } + const reportID = CollectionUtils.extractCollectionItemID(key); + allReports[reportID] = report; + }, +}); + +/** + * Given the Task reportAction name, return the appropriate message to be displayed and copied to clipboard. + */ +function getTaskReportActionMessage(actionName: string): string { + switch (actionName) { + case CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED: + return Localize.translateLocal('task.messages.completed'); + case CONST.REPORT.ACTIONS.TYPE.TASKCANCELLED: + return Localize.translateLocal('task.messages.canceled'); + case CONST.REPORT.ACTIONS.TYPE.TASKREOPENED: + return Localize.translateLocal('task.messages.reopened'); + default: + return Localize.translateLocal('task.task'); + } +} + +function getTaskTitle(taskReportID: string, fallbackTitle = ''): string { + const taskReport = allReports[taskReportID] ?? {}; + // We need to check for reportID, not just reportName, because when a receiver opens the task for the first time, + // an optimistic report is created with the only property – reportName: 'Chat report', + // and it will be displayed as the task title without checking for reportID to be present. + return Object.hasOwn(taskReport, 'reportID') && taskReport.reportName ? taskReport.reportName : fallbackTitle; +} + +function getTaskCreatedMessage(reportAction: OnyxEntry) { + const taskReportID = reportAction?.childReportID ?? ''; + const taskTitle = getTaskTitle(taskReportID, reportAction?.childReportName); + return Localize.translateLocal('task.messages.created', {title: taskTitle}); +} + +export {getTaskReportActionMessage, getTaskTitle, getTaskCreatedMessage}; diff --git a/src/libs/actions/Task.js b/src/libs/actions/Task.js index bf816d0a62a7..e5037d250d2e 100644 --- a/src/libs/actions/Task.js +++ b/src/libs/actions/Task.js @@ -6,7 +6,6 @@ import * as API from '@libs/API'; import DateUtils from '@libs/DateUtils'; import * as ErrorUtils from '@libs/ErrorUtils'; import * as LocalePhoneNumber from '@libs/LocalePhoneNumber'; -import * as Localize from '@libs/Localize'; import Navigation from '@libs/Navigation/Navigation'; import * as OptionsListUtils from '@libs/OptionsListUtils'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; @@ -906,35 +905,6 @@ function clearTaskErrors(reportID) { }); } -/** - * @param {string} actionName - * @param {string} reportID - * @param {boolean} isCreateTaskAction - * @returns {string} - */ -function getTaskReportActionMessage(actionName, reportID, isCreateTaskAction) { - const report = ReportUtils.getReport(reportID); - if (isCreateTaskAction) { - return `task for ${report.reportName}`; - } - let taskStatusText = ''; - switch (actionName) { - case CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED: - taskStatusText = Localize.translateLocal('task.messages.completed'); - break; - case CONST.REPORT.ACTIONS.TYPE.TASKCANCELLED: - taskStatusText = Localize.translateLocal('task.messages.canceled'); - break; - case CONST.REPORT.ACTIONS.TYPE.TASKREOPENED: - taskStatusText = Localize.translateLocal('task.messages.reopened'); - break; - default: - taskStatusText = Localize.translateLocal('task.task'); - } - - return `${taskStatusText}`; -} - export { createTaskAndNavigate, editTask, @@ -956,5 +926,4 @@ export { getTaskAssigneeAccountID, clearTaskErrors, canModifyTask, - getTaskReportActionMessage, }; diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.js b/src/pages/home/report/ContextMenu/ContextMenuActions.js index 4f35926c5957..0736b60cafdf 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.js +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.js @@ -16,6 +16,7 @@ import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; import ReportActionComposeFocusManager from '@libs/ReportActionComposeFocusManager'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; +import * as TaskUtils from '@libs/TaskUtils'; import * as Download from '@userActions/Download'; import * as Report from '@userActions/Report'; import * as Task from '@userActions/Task'; @@ -258,15 +259,13 @@ export default [ type === CONTEXT_MENU_TYPES.REPORT_ACTION && !ReportActionsUtils.isReportActionAttachment(reportAction) && !ReportActionsUtils.isMessageDeleted(reportAction), // If return value is true, we switch the `text` and `icon` on - // `ContextMenuItem` with `successText` and `successIcon` which will fallback to + // `ContextMenuItem` with `successText` and `successIcon` which will fall back to // the `text` and `icon` onPress: (closePopover, {reportAction, selection}) => { const isTaskAction = ReportActionsUtils.isTaskAction(reportAction); - const isCreateTaskAction = ReportActionsUtils.isCreatedTaskReportAction(reportAction); const isReportPreviewAction = ReportActionsUtils.isReportPreviewAction(reportAction); const message = _.last(lodashGet(reportAction, 'message', [{}])); - const reportID = lodashGet(reportAction, 'originalMessage.taskReportID', '').toString(); - const messageHtml = isTaskAction || isCreateTaskAction ? Task.getTaskReportActionMessage(reportAction.actionName, reportID, isCreateTaskAction) : lodashGet(message, 'html', ''); + const messageHtml = isTaskAction ? Task.getTaskReportActionMessage(reportAction) : lodashGet(message, 'html', ''); const isAttachment = ReportActionsUtils.isReportActionAttachment(reportAction); if (!isAttachment) { @@ -281,6 +280,9 @@ export default [ } else if (ReportActionsUtils.isMoneyRequestAction(reportAction)) { const displayMessage = ReportUtils.getIOUReportActionDisplayMessage(reportAction); Clipboard.setString(displayMessage); + } else if (ReportActionsUtils.isCreatedTaskReportAction(reportAction)) { + const taskPreviewMessage = TaskUtils.getTaskCreatedMessage(reportAction); + Clipboard.setString(taskPreviewMessage); } else if (ReportActionsUtils.isChannelLogMemberAction(reportAction)) { const logMessage = ReportUtils.getChannelLogMemberMessage(reportAction); Clipboard.setString(logMessage); From 4de2b6a80b3ab93d5c2b7529328cc8568a797161 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 30 Nov 2023 15:51:04 +0100 Subject: [PATCH 07/52] Migrate src/libs/shouldReopenOnfido --- src/libs/shouldReopenOnfido/index.android.js | 1 - src/libs/shouldReopenOnfido/index.android.ts | 5 +++++ src/libs/shouldReopenOnfido/index.js | 1 - src/libs/shouldReopenOnfido/index.ts | 5 +++++ src/libs/shouldReopenOnfido/types.ts | 3 +++ src/types/onyx/Policy.ts | 2 +- 6 files changed, 14 insertions(+), 3 deletions(-) delete mode 100644 src/libs/shouldReopenOnfido/index.android.js create mode 100644 src/libs/shouldReopenOnfido/index.android.ts delete mode 100644 src/libs/shouldReopenOnfido/index.js create mode 100644 src/libs/shouldReopenOnfido/index.ts create mode 100644 src/libs/shouldReopenOnfido/types.ts diff --git a/src/libs/shouldReopenOnfido/index.android.js b/src/libs/shouldReopenOnfido/index.android.js deleted file mode 100644 index ff3177babdde..000000000000 --- a/src/libs/shouldReopenOnfido/index.android.js +++ /dev/null @@ -1 +0,0 @@ -export default true; diff --git a/src/libs/shouldReopenOnfido/index.android.ts b/src/libs/shouldReopenOnfido/index.android.ts new file mode 100644 index 000000000000..11f562575b08 --- /dev/null +++ b/src/libs/shouldReopenOnfido/index.android.ts @@ -0,0 +1,5 @@ +import ShouldReopenOnfido from './types'; + +const shouldReopenOnfido: ShouldReopenOnfido = true; + +export default shouldReopenOnfido; diff --git a/src/libs/shouldReopenOnfido/index.js b/src/libs/shouldReopenOnfido/index.js deleted file mode 100644 index 33136544dba2..000000000000 --- a/src/libs/shouldReopenOnfido/index.js +++ /dev/null @@ -1 +0,0 @@ -export default false; diff --git a/src/libs/shouldReopenOnfido/index.ts b/src/libs/shouldReopenOnfido/index.ts new file mode 100644 index 000000000000..24322b57df19 --- /dev/null +++ b/src/libs/shouldReopenOnfido/index.ts @@ -0,0 +1,5 @@ +import ShouldReopenOnfido from './types'; + +const shouldReopenOnfido: ShouldReopenOnfido = false; + +export default shouldReopenOnfido; diff --git a/src/libs/shouldReopenOnfido/types.ts b/src/libs/shouldReopenOnfido/types.ts new file mode 100644 index 000000000000..365fb95bb333 --- /dev/null +++ b/src/libs/shouldReopenOnfido/types.ts @@ -0,0 +1,3 @@ +type ShouldReopenOnfido = boolean; + +export default ShouldReopenOnfido; diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index e7550713710e..a55a7c052b01 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -80,4 +80,4 @@ type Policy = { export default Policy; -export {Unit}; +export type {Unit}; From 478c580550f03227133e416737846873e87cae17 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 30 Nov 2023 16:51:26 +0100 Subject: [PATCH 08/52] Migrate RenameReceiptFilename migration --- src/libs/migrations/RenameReceiptFilename.js | 57 -------------------- src/libs/migrations/RenameReceiptFilename.ts | 56 +++++++++++++++++++ 2 files changed, 56 insertions(+), 57 deletions(-) delete mode 100644 src/libs/migrations/RenameReceiptFilename.js create mode 100644 src/libs/migrations/RenameReceiptFilename.ts diff --git a/src/libs/migrations/RenameReceiptFilename.js b/src/libs/migrations/RenameReceiptFilename.js deleted file mode 100644 index 2fcd9662a993..000000000000 --- a/src/libs/migrations/RenameReceiptFilename.js +++ /dev/null @@ -1,57 +0,0 @@ -import lodashHas from 'lodash/has'; -import Onyx from 'react-native-onyx'; -import _ from 'underscore'; -import Log from '@libs/Log'; -import ONYXKEYS from '@src/ONYXKEYS'; - -// This migration changes the property name on a transaction from receiptFilename to filename so that it matches what is stored in the database -export default function () { - return new Promise((resolve) => { - // Connect to the TRANSACTION collection key in Onyx to get all of the stored transactions. - // Go through each transaction and change the property name - const connectionID = Onyx.connect({ - key: ONYXKEYS.COLLECTION.TRANSACTION, - waitForCollectionCallback: true, - callback: (transactions) => { - Onyx.disconnect(connectionID); - - if (!transactions || transactions.length === 0) { - Log.info('[Migrate Onyx] Skipped migration RenameReceiptFilename because there are no transactions'); - return resolve(); - } - - if (!_.compact(_.pluck(transactions, 'receiptFilename')).length) { - Log.info('[Migrate Onyx] Skipped migration RenameReceiptFilename because there were no transactions with the receiptFilename property'); - return resolve(); - } - - Log.info('[Migrate Onyx] Running RenameReceiptFilename migration'); - - const dataToSave = _.reduce( - transactions, - (result, transaction) => { - // Do nothing if there is no receiptFilename property - if (!lodashHas(transaction, 'receiptFilename')) { - return result; - } - Log.info(`[Migrate Onyx] Renaming receiptFilename ${transaction.receiptFilename} to filename`); - return { - ...result, - [`${ONYXKEYS.COLLECTION.TRANSACTION}${transaction.transactionID}`]: { - filename: transaction.receiptFilename, - receiptFilename: null, - }, - }; - }, - {}, - ); - - // eslint-disable-next-line rulesdir/prefer-actions-set-data - Onyx.mergeCollection(ONYXKEYS.COLLECTION.TRANSACTION, dataToSave).then(() => { - Log.info(`[Migrate Onyx] Ran migration RenameReceiptFilename and renamed ${_.size(dataToSave)} properties`); - resolve(); - }); - }, - }); - }); -} diff --git a/src/libs/migrations/RenameReceiptFilename.ts b/src/libs/migrations/RenameReceiptFilename.ts new file mode 100644 index 000000000000..5c18647ffe57 --- /dev/null +++ b/src/libs/migrations/RenameReceiptFilename.ts @@ -0,0 +1,56 @@ +import Onyx from 'react-native-onyx'; +import {NullishDeep, OnyxCollection} from 'react-native-onyx/lib/types'; +import Log from '@libs/Log'; +import ONYXKEYS from '@src/ONYXKEYS'; +import Transaction from '@src/types/onyx/Transaction'; +import {isEmptyObject} from '@src/types/utils/EmptyObject'; + +type OldTransaction = Transaction & {receiptFilename?: string}; + +// This migration changes the property name on a transaction from receiptFilename to filename so that it matches what is stored in the database +export default function () { + return new Promise((resolve) => { + // Connect to the TRANSACTION collection key in Onyx to get all of the stored transactions. + // Go through each transaction and change the property name + const connectionID = Onyx.connect({ + key: ONYXKEYS.COLLECTION.TRANSACTION, + waitForCollectionCallback: true, + callback: (transactions: OnyxCollection) => { + Onyx.disconnect(connectionID); + + if (!transactions || isEmptyObject(transactions)) { + Log.info('[Migrate Onyx] Skipped migration RenameReceiptFilename because there are no transactions'); + return resolve(); + } + + const transactionArray: Array = Object.values(transactions); + if (!transactionArray?.map((transaction) => transaction?.receiptFilename).filter(Boolean).length) { + Log.info('[Migrate Onyx] Skipped migration RenameReceiptFilename because there were no transactions with the receiptFilename property'); + return resolve(); + } + + Log.info('[Migrate Onyx] Running RenameReceiptFilename migration'); + const dataToSave: Record<`${typeof ONYXKEYS.COLLECTION.TRANSACTION}${string}`, NullishDeep> = {}; + + transactionArray?.forEach((transaction) => { + // Do nothing if there is no receiptFilename property + if (!transaction || !('receiptFilename' in transaction)) { + return; + } + + Log.info(`[Migrate Onyx] Renaming receiptFilename ${transaction?.receiptFilename} to filename`); + dataToSave[`${ONYXKEYS.COLLECTION.TRANSACTION}${transaction.transactionID}`] = { + filename: transaction?.receiptFilename, + receiptFilename: null, + }; + }, {}); + + // eslint-disable-next-line rulesdir/prefer-actions-set-data + Onyx.mergeCollection(ONYXKEYS.COLLECTION.TRANSACTION, dataToSave).then(() => { + Log.info(`[Migrate Onyx] Ran migration RenameReceiptFilename and renamed ${Object.keys(dataToSave)?.length} properties`); + resolve(); + }); + }, + }); + }); +} From 73e9c92eb423adc27e91155a1e088f2aa940932f Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 30 Nov 2023 17:05:31 +0100 Subject: [PATCH 09/52] Migrate KeyReportActionsDraftByReportActionID migration --- ... KeyReportActionsDraftByReportActionID.ts} | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) rename src/libs/migrations/{KeyReportActionsDraftByReportActionID.js => KeyReportActionsDraftByReportActionID.ts} (61%) diff --git a/src/libs/migrations/KeyReportActionsDraftByReportActionID.js b/src/libs/migrations/KeyReportActionsDraftByReportActionID.ts similarity index 61% rename from src/libs/migrations/KeyReportActionsDraftByReportActionID.js rename to src/libs/migrations/KeyReportActionsDraftByReportActionID.ts index e4b3ebd060f3..944b9d3e5478 100644 --- a/src/libs/migrations/KeyReportActionsDraftByReportActionID.js +++ b/src/libs/migrations/KeyReportActionsDraftByReportActionID.ts @@ -1,21 +1,21 @@ -import Onyx from 'react-native-onyx'; -import _ from 'underscore'; +import Onyx, {OnyxEntry} from 'react-native-onyx'; import Log from '@libs/Log'; import ONYXKEYS from '@src/ONYXKEYS'; +import {ReportActionsDrafts} from '@src/types/onyx'; +import {isEmptyObject} from '@src/types/utils/EmptyObject'; /** * This migration updates reportActionsDrafts data to be keyed by reportActionID. * * Before: reportActionsDrafts_reportID_reportActionID: value * After: reportActionsDrafts_reportID: {[reportActionID]: value} - * - * @returns {Promise} */ export default function () { - return new Promise((resolve) => { + return new Promise((resolve) => { const connectionID = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS, waitForCollectionCallback: true, + // eslint-disable-next-line @typescript-eslint/no-misused-promises callback: (allReportActionsDrafts) => { Onyx.disconnect(connectionID); @@ -24,34 +24,39 @@ export default function () { return resolve(); } - const newReportActionsDrafts = {}; - _.each(allReportActionsDrafts, (reportActionDraft, onyxKey) => { - if (!_.isString(reportActionDraft)) { + type ReportActionsDraftsKey = `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${string}`; + const newReportActionsDrafts: Record> = {}; + Object.entries(allReportActionsDrafts).forEach(([onyxKey, reportActionDraft]) => { + if (typeof reportActionDraft !== 'string') { return; } - newReportActionsDrafts[onyxKey] = null; + newReportActionsDrafts[onyxKey as ReportActionsDraftsKey] = null; - if (_.isEmpty(reportActionDraft)) { + if (isEmptyObject(reportActionDraft)) { return; } const reportActionID = onyxKey.split('_').pop(); - const newOnyxKey = onyxKey.replace(`_${reportActionID}`, ''); + const newOnyxKey = onyxKey.replace(`_${reportActionID}`, '') as ReportActionsDraftsKey; + + if (!reportActionID) { + return; + } // If newReportActionsDrafts[newOnyxKey] isn't set, fall back on the migrated draft if there is one - const currentActionsDrafts = newReportActionsDrafts[newOnyxKey] || allReportActionsDrafts[newOnyxKey]; + const currentActionsDrafts = newReportActionsDrafts[newOnyxKey] ?? allReportActionsDrafts[newOnyxKey]; newReportActionsDrafts[newOnyxKey] = { ...currentActionsDrafts, [reportActionID]: reportActionDraft, }; }); - if (_.isEmpty(newReportActionsDrafts)) { + if (isEmptyObject(newReportActionsDrafts)) { Log.info('[Migrate Onyx] Skipped migration KeyReportActionsDraftByReportActionID because there are no actions drafts to migrate'); return resolve(); } - Log.info(`[Migrate Onyx] Re-keying reportActionsDrafts by reportActionID for ${_.keys(newReportActionsDrafts).length} actions drafts`); + Log.info(`[Migrate Onyx] Re-keying reportActionsDrafts by reportActionID for ${Object.keys(newReportActionsDrafts).length} actions drafts`); // eslint-disable-next-line rulesdir/prefer-actions-set-data return Onyx.multiSet(newReportActionsDrafts).then(resolve); }, From 276eef40cf8706d7c6c7b2744dd0198839c1d76c Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 30 Nov 2023 17:23:04 +0100 Subject: [PATCH 10/52] Migrate UpdateMultilineInputRange --- .../{index.ios.js => index.ios.ts} | 11 ++++++----- .../{index.js => index.ts} | 14 +++++++------- src/libs/UpdateMultilineInputRange/types.ts | 5 +++++ 3 files changed, 18 insertions(+), 12 deletions(-) rename src/libs/UpdateMultilineInputRange/{index.ios.js => index.ios.ts} (82%) rename src/libs/UpdateMultilineInputRange/{index.js => index.ts} (75%) create mode 100644 src/libs/UpdateMultilineInputRange/types.ts diff --git a/src/libs/UpdateMultilineInputRange/index.ios.js b/src/libs/UpdateMultilineInputRange/index.ios.ts similarity index 82% rename from src/libs/UpdateMultilineInputRange/index.ios.js rename to src/libs/UpdateMultilineInputRange/index.ios.ts index 4c10f768a2a2..cbe271162372 100644 --- a/src/libs/UpdateMultilineInputRange/index.ios.js +++ b/src/libs/UpdateMultilineInputRange/index.ios.ts @@ -1,3 +1,5 @@ +import UpdateMultilineInputRange from './types'; + /** * Place the cursor at the end of the value (if there is a value in the input). * @@ -6,11 +8,8 @@ * focus. This provides a better user experience in cases where the text in the field has to be edited. The auto- * scroll behaviour works on all platforms except iOS native. * See https://github.com/Expensify/App/issues/20836 for more details. - * - * @param {Object} input the input element - * @param {boolean} shouldAutoFocus */ -export default function updateMultilineInputRange(input, shouldAutoFocus = true) { +const updateMultilineInputRange: UpdateMultilineInputRange = (input, shouldAutoFocus = true) => { if (!input) { return; } @@ -23,4 +22,6 @@ export default function updateMultilineInputRange(input, shouldAutoFocus = true) if (shouldAutoFocus) { input.focus(); } -} +}; + +export default updateMultilineInputRange; diff --git a/src/libs/UpdateMultilineInputRange/index.js b/src/libs/UpdateMultilineInputRange/index.ts similarity index 75% rename from src/libs/UpdateMultilineInputRange/index.js rename to src/libs/UpdateMultilineInputRange/index.ts index 66fb1889be21..30b98c05744f 100644 --- a/src/libs/UpdateMultilineInputRange/index.js +++ b/src/libs/UpdateMultilineInputRange/index.ts @@ -1,3 +1,5 @@ +import UpdateMultilineInputRange from './types'; + /** * Place the cursor at the end of the value (if there is a value in the input). * @@ -6,20 +8,18 @@ * focus. This provides a better user experience in cases where the text in the field has to be edited. The auto- * scroll behaviour works on all platforms except iOS native. * See https://github.com/Expensify/App/issues/20836 for more details. - * - * @param {Object} input the input element - * @param {boolean} shouldAutoFocus */ -// eslint-disable-next-line no-unused-vars -export default function updateMultilineInputRange(input, shouldAutoFocus = true) { +const updateMultilineInputRange: UpdateMultilineInputRange = (input) => { if (!input) { return; } - if (input.value && input.setSelectionRange) { + if ('value' in input && input.value && input.setSelectionRange) { const length = input.value.length; input.setSelectionRange(length, length); // eslint-disable-next-line no-param-reassign input.scrollTop = input.scrollHeight; } -} +}; + +export default updateMultilineInputRange; diff --git a/src/libs/UpdateMultilineInputRange/types.ts b/src/libs/UpdateMultilineInputRange/types.ts new file mode 100644 index 000000000000..95b5a8bce744 --- /dev/null +++ b/src/libs/UpdateMultilineInputRange/types.ts @@ -0,0 +1,5 @@ +import {TextInput} from 'react-native'; + +type UpdateMultilineInputRange = (input: HTMLInputElement | TextInput, shouldAutoFocus?: boolean) => void; + +export default UpdateMultilineInputRange; From de7a85b8828f068da7db2aad8ad9196c597c1d03 Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Thu, 30 Nov 2023 20:20:34 +0100 Subject: [PATCH 11/52] fix: resolve comments --- src/libs/UnreadIndicatorUpdater/updateUnread/index.android.ts | 1 + src/libs/UnreadIndicatorUpdater/updateUnread/index.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libs/UnreadIndicatorUpdater/updateUnread/index.android.ts b/src/libs/UnreadIndicatorUpdater/updateUnread/index.android.ts index 567b8dded5cf..bd7b2cbc4752 100644 --- a/src/libs/UnreadIndicatorUpdater/updateUnread/index.android.ts +++ b/src/libs/UnreadIndicatorUpdater/updateUnread/index.android.ts @@ -2,4 +2,5 @@ import UpdateUnread from './types'; // Android does not yet implement this const updateUnread: UpdateUnread = () => {}; + export default updateUnread; diff --git a/src/libs/UnreadIndicatorUpdater/updateUnread/index.ts b/src/libs/UnreadIndicatorUpdater/updateUnread/index.ts index 3695a13bd85c..a317a00e0cc1 100644 --- a/src/libs/UnreadIndicatorUpdater/updateUnread/index.ts +++ b/src/libs/UnreadIndicatorUpdater/updateUnread/index.ts @@ -18,8 +18,8 @@ const updateUnread: UpdateUnread = (totalCount) => { // seems to improve this issue. document.title = ''; document.title = hasUnread ? `(${totalCount}) ${CONFIG.SITE_TITLE}` : CONFIG.SITE_TITLE; - const favicon = document.getElementById('favicon'); - if (favicon && 'href' in favicon) { + const favicon = document.getElementById('favicon') as HTMLLinkElement | null; + if (favicon?.href) { favicon.href = hasUnread ? CONFIG.FAVICON.UNREAD : CONFIG.FAVICON.DEFAULT; } }, 0); From 7ea05ae06eb9841ba2381a57a8828faa143ae427 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Fri, 1 Dec 2023 15:43:42 +0700 Subject: [PATCH 12/52] revert transaction when not saving distance in edit page --- src/components/DistanceRequest/index.js | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/components/DistanceRequest/index.js b/src/components/DistanceRequest/index.js index 6fa5dfede620..2a2027a35bdc 100644 --- a/src/components/DistanceRequest/index.js +++ b/src/components/DistanceRequest/index.js @@ -23,6 +23,7 @@ import useThemeStyles from '@styles/useThemeStyles'; import variables from '@styles/variables'; import * as MapboxToken from '@userActions/MapboxToken'; import * as Transaction from '@userActions/Transaction'; +import * as TransactionEdit from '@userActions/TransactionEdit'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import DistanceRequestFooter from './DistanceRequestFooter'; @@ -90,12 +91,27 @@ function DistanceRequest({transactionID, report, transaction, route, isEditingRe const haveValidatedWaypointsChanged = !_.isEqual(previousValidatedWaypoints, validatedWaypoints); const isRouteAbsentWithoutErrors = !hasRoute && !hasRouteError; const shouldFetchRoute = (isRouteAbsentWithoutErrors || haveValidatedWaypointsChanged) && !isLoadingRoute && _.size(validatedWaypoints) > 1; + const transactionWasSaved = useRef(false); useEffect(() => { MapboxToken.init(); return MapboxToken.stop; }, []); + useEffect(() => { + if (isEditing) { + TransactionEdit.createBackupTransaction(transaction); + } + + return () => { + if (transactionWasSaved.current && !isEditing) { + return; + } + TransactionEdit.restoreOriginalTransactionFromBackup(transaction.transactionID); + }; + // eslint-disable-next-line react-hooks/exhaustive-deps -- we only want this effect when component is mounted + }, []); + useEffect(() => { const transactionWaypoints = lodashGet(transaction, 'comment.waypoints', {}); if (!lodashGet(transaction, 'transactionID') || !_.isEmpty(transactionWaypoints)) { @@ -182,8 +198,15 @@ function DistanceRequest({transactionID, report, transaction, route, isEditingRe setHasError(true); return; } + + if (isEditing) { + Navigation.goBack(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, reportID)); + transactionWasSaved.current = true; + return; + } + onSubmit(waypoints); - }, [onSubmit, setHasError, hasRouteError, isLoadingRoute, isLoading, validatedWaypoints, waypoints]); + }, [onSubmit, setHasError, hasRouteError, isLoadingRoute, isLoading, validatedWaypoints, waypoints, isEditing, iouType, reportID]); const content = ( <> From a313241741f55ae6a38ab31d68d46b1a3ebfbd72 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Fri, 1 Dec 2023 14:24:28 +0100 Subject: [PATCH 13/52] Adjust the code after review --- src/libs/DistanceRequestUtils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/DistanceRequestUtils.ts b/src/libs/DistanceRequestUtils.ts index ad0b814f1e5c..682567c4c6ba 100644 --- a/src/libs/DistanceRequestUtils.ts +++ b/src/libs/DistanceRequestUtils.ts @@ -25,12 +25,12 @@ function getDefaultMileageRate(policy: Policy): DefaultMileageRate | null { return null; } - const distanceUnit = Object.values(policy?.customUnits ?? {}).find((unit) => unit.name === CONST.CUSTOM_UNITS.NAME_DISTANCE); - if (!distanceUnit) { + const distanceUnit = Object.values(policy.customUnits).find((unit) => unit.name === CONST.CUSTOM_UNITS.NAME_DISTANCE); + if (!distanceUnit?.rates) { return null; } - const distanceRate = Object.values(distanceUnit?.rates ?? {}).find((rate) => rate.name === CONST.CUSTOM_UNITS.DEFAULT_RATE); + const distanceRate = Object.values(distanceUnit.rates).find((rate) => rate.name === CONST.CUSTOM_UNITS.DEFAULT_RATE); if (!distanceRate) { return null; } From 02debe0c9c1f6522a40c8362c9795bbeb75cc71b Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Mon, 4 Dec 2023 13:34:55 +0700 Subject: [PATCH 14/52] dry code --- src/components/DistanceRequest/index.js | 14 ++++++++------ src/pages/EditRequestDistancePage.js | 23 ----------------------- 2 files changed, 8 insertions(+), 29 deletions(-) diff --git a/src/components/DistanceRequest/index.js b/src/components/DistanceRequest/index.js index 2a2027a35bdc..fbfabec4b69f 100644 --- a/src/components/DistanceRequest/index.js +++ b/src/components/DistanceRequest/index.js @@ -99,12 +99,12 @@ function DistanceRequest({transactionID, report, transaction, route, isEditingRe }, []); useEffect(() => { - if (isEditing) { + if (isEditing || isEditingRequest) { TransactionEdit.createBackupTransaction(transaction); } return () => { - if (transactionWasSaved.current && !isEditing) { + if (transactionWasSaved.current || (!isEditing && !isEditingRequest)) { return; } TransactionEdit.restoreOriginalTransactionFromBackup(transaction.transactionID); @@ -199,14 +199,16 @@ function DistanceRequest({transactionID, report, transaction, route, isEditingRe return; } - if (isEditing) { - Navigation.goBack(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, reportID)); + if (isEditing || isEditingRequest) { transactionWasSaved.current = true; - return; + if (isEditing) { + Navigation.goBack(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, reportID)); + return; + } } onSubmit(waypoints); - }, [onSubmit, setHasError, hasRouteError, isLoadingRoute, isLoading, validatedWaypoints, waypoints, isEditing, iouType, reportID]); + }, [onSubmit, setHasError, hasRouteError, isLoadingRoute, isLoading, validatedWaypoints, waypoints, isEditing, iouType, reportID, isEditingRequest]); const content = ( <> diff --git a/src/pages/EditRequestDistancePage.js b/src/pages/EditRequestDistancePage.js index 48b80890dc49..0ea295c0780b 100644 --- a/src/pages/EditRequestDistancePage.js +++ b/src/pages/EditRequestDistancePage.js @@ -12,7 +12,6 @@ import useNetwork from '@hooks/useNetwork'; import usePrevious from '@hooks/usePrevious'; import Navigation from '@libs/Navigation/Navigation'; import * as IOU from '@userActions/IOU'; -import * as TransactionEdit from '@userActions/TransactionEdit'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import reportPropTypes from './reportPropTypes'; @@ -52,7 +51,6 @@ const defaultProps = { function EditRequestDistancePage({report, route, transaction, transactionBackup}) { const {isOffline} = useNetwork(); const {translate} = useLocalize(); - const transactionWasSaved = useRef(false); const hasWaypointError = useRef(false); const prevIsLoading = usePrevious(transaction.isLoading); @@ -66,26 +64,6 @@ function EditRequestDistancePage({report, route, transaction, transactionBackup} } }, [transaction, prevIsLoading, report]); - useEffect(() => { - // This effect runs when the component is mounted and unmounted. It's purpose is to be able to properly - // discard changes if the user cancels out of making any changes. This is accomplished by backing up the - // original transaction, letting the user modify the current transaction, and then if the user ever - // cancels out of the modal without saving changes, the original transaction is restored from the backup. - - // On mount, create the backup transaction. - TransactionEdit.createBackupTransaction(transaction); - - return () => { - // If the user cancels out of the modal without without saving changes, then the original transaction - // needs to be restored from the backup so that all changes are removed. - if (transactionWasSaved.current) { - return; - } - TransactionEdit.restoreOriginalTransactionFromBackup(transaction.transactionID); - }; - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - /** * Save the changes to the original transaction object * @param {Object} waypoints @@ -101,7 +79,6 @@ function EditRequestDistancePage({report, route, transaction, transactionBackup} return; } - transactionWasSaved.current = true; IOU.editMoneyRequest(transaction, report.reportID, {waypoints}); // If the client is offline, then the modal can be closed as well (because there are no errors or other feedback to show them From e799f4f88cf44f1040a50f4333c90838d90b71b9 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Mon, 4 Dec 2023 17:24:27 +0700 Subject: [PATCH 15/52] centralize logic --- src/components/DistanceRequest/index.js | 23 +++++++++++------------ src/pages/iou/NewDistanceRequestPage.js | 17 +++++++++++++++-- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/components/DistanceRequest/index.js b/src/components/DistanceRequest/index.js index fbfabec4b69f..7c62c37c010a 100644 --- a/src/components/DistanceRequest/index.js +++ b/src/components/DistanceRequest/index.js @@ -39,6 +39,9 @@ const propTypes = { /** Are we editing an existing distance request, or creating a new one? */ isEditingRequest: PropTypes.bool, + /** Are we editing a new distance request */ + isEditingNewRequest: PropTypes.bool, + /** Called on submit of this page */ onSubmit: PropTypes.func.isRequired, @@ -62,17 +65,17 @@ const defaultProps = { transactionID: '', report: {}, isEditingRequest: false, + isEditingNewRequest: false, transaction: {}, }; -function DistanceRequest({transactionID, report, transaction, route, isEditingRequest, onSubmit}) { +function DistanceRequest({transactionID, report, transaction, route, isEditingRequest, isEditingNewRequest, onSubmit}) { const styles = useThemeStyles(); const {isOffline} = useNetwork(); const {translate} = useLocalize(); const [optimisticWaypoints, setOptimisticWaypoints] = useState(null); const [hasError, setHasError] = useState(false); - const isEditing = Navigation.getActiveRoute().includes('address'); const reportID = lodashGet(report, 'reportID', ''); const waypoints = useMemo(() => optimisticWaypoints || lodashGet(transaction, 'comment.waypoints', {waypoint0: {}, waypoint1: {}}), [optimisticWaypoints, transaction]); const waypointsList = _.keys(waypoints); @@ -99,12 +102,12 @@ function DistanceRequest({transactionID, report, transaction, route, isEditingRe }, []); useEffect(() => { - if (isEditing || isEditingRequest) { + if (isEditingNewRequest || isEditingRequest) { TransactionEdit.createBackupTransaction(transaction); } return () => { - if (transactionWasSaved.current || (!isEditing && !isEditingRequest)) { + if (transactionWasSaved.current || (!isEditingNewRequest && !isEditingRequest)) { return; } TransactionEdit.restoreOriginalTransactionFromBackup(transaction.transactionID); @@ -150,7 +153,7 @@ function DistanceRequest({transactionID, report, transaction, route, isEditingRe }, [waypoints, previousWaypoints]); const navigateBack = () => { - Navigation.goBack(isEditing ? ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, reportID) : ROUTES.HOME); + Navigation.goBack(isEditingNewRequest ? ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, reportID) : ROUTES.HOME); }; /** @@ -199,16 +202,12 @@ function DistanceRequest({transactionID, report, transaction, route, isEditingRe return; } - if (isEditing || isEditingRequest) { + if (isEditingNewRequest || isEditingRequest) { transactionWasSaved.current = true; - if (isEditing) { - Navigation.goBack(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, reportID)); - return; - } } onSubmit(waypoints); - }, [onSubmit, setHasError, hasRouteError, isLoadingRoute, isLoading, validatedWaypoints, waypoints, isEditing, iouType, reportID, isEditingRequest]); + }, [onSubmit, setHasError, hasRouteError, isLoadingRoute, isLoading, validatedWaypoints, waypoints, isEditingNewRequest, isEditingRequest]); const content = ( <> @@ -263,7 +262,7 @@ function DistanceRequest({transactionID, report, transaction, route, isEditingRe ); - if (!isEditing) { + if (!isEditingNewRequest) { return content; } diff --git a/src/pages/iou/NewDistanceRequestPage.js b/src/pages/iou/NewDistanceRequestPage.js index fc4549be3b33..dd8031c6cda6 100644 --- a/src/pages/iou/NewDistanceRequestPage.js +++ b/src/pages/iou/NewDistanceRequestPage.js @@ -1,13 +1,15 @@ import lodashGet from 'lodash/get'; import PropTypes from 'prop-types'; -import React, {useEffect} from 'react'; +import React, {useCallback, useEffect} from 'react'; import {withOnyx} from 'react-native-onyx'; import _ from 'underscore'; import DistanceRequest from '@components/DistanceRequest'; +import Navigation from '@libs/Navigation/Navigation'; import reportPropTypes from '@pages/reportPropTypes'; import * as IOU from '@userActions/IOU'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; +import ROUTES from '@src/ROUTES'; import {iouPropTypes} from './propTypes'; const propTypes = { @@ -44,6 +46,8 @@ const defaultProps = { // You can't use Onyx props in the withOnyx mapping, so we need to set up and access the transactionID here, and then pass it down so that DistanceRequest can subscribe to the transaction. function NewDistanceRequestPage({iou, report, route}) { const iouType = lodashGet(route, 'params.iouType', 'request'); + const reportID = lodashGet(route, 'params.reportID', ''); + const isEditing = Navigation.getActiveRoute().includes('address'); useEffect(() => { if (iou.transactionID) { @@ -52,12 +56,21 @@ function NewDistanceRequestPage({iou, report, route}) { IOU.setUpDistanceTransaction(); }, [iou.transactionID]); + const onSubmit = useCallback(() => { + if (isEditing) { + Navigation.goBack(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, reportID)); + return; + } + IOU.navigateToNextPage(iou, iouType, report); + }, [iou, iouType, isEditing, report, reportID]); + return ( IOU.navigateToNextPage(iou, iouType, report)} + onSubmit={onSubmit} /> ); } From 1a23e1cbcb547f1005819e80967273e5a44144cc Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Mon, 4 Dec 2023 17:29:17 +0700 Subject: [PATCH 16/52] add comment --- src/components/DistanceRequest/index.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/components/DistanceRequest/index.js b/src/components/DistanceRequest/index.js index 7c62c37c010a..72b12dce3197 100644 --- a/src/components/DistanceRequest/index.js +++ b/src/components/DistanceRequest/index.js @@ -102,17 +102,28 @@ function DistanceRequest({transactionID, report, transaction, route, isEditingRe }, []); useEffect(() => { + if (!isEditingNewRequest && !isEditingRequest) { + return () => {}; + } + // This effect runs when the component is mounted and unmounted. It's purpose is to be able to properly + // discard changes if the user cancels out of making any changes. This is accomplished by backing up the + // original transaction, letting the user modify the current transaction, and then if the user ever + // cancels out of the modal without saving changes, the original transaction is restored from the backup. + + // On mount, create the backup transaction. if (isEditingNewRequest || isEditingRequest) { TransactionEdit.createBackupTransaction(transaction); } return () => { + // If the user cancels out of the modal without without saving changes, then the original transaction + // needs to be restored from the backup so that all changes are removed. if (transactionWasSaved.current || (!isEditingNewRequest && !isEditingRequest)) { return; } TransactionEdit.restoreOriginalTransactionFromBackup(transaction.transactionID); }; - // eslint-disable-next-line react-hooks/exhaustive-deps -- we only want this effect when component is mounted + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); useEffect(() => { From 7835a8b257588e1dc15855f3e047b3dcc19220c5 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Mon, 4 Dec 2023 18:04:12 +0700 Subject: [PATCH 17/52] remove un-use component --- src/components/DistanceRequest/index.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/components/DistanceRequest/index.js b/src/components/DistanceRequest/index.js index 72b12dce3197..771dc2a997ae 100644 --- a/src/components/DistanceRequest/index.js +++ b/src/components/DistanceRequest/index.js @@ -111,14 +111,12 @@ function DistanceRequest({transactionID, report, transaction, route, isEditingRe // cancels out of the modal without saving changes, the original transaction is restored from the backup. // On mount, create the backup transaction. - if (isEditingNewRequest || isEditingRequest) { - TransactionEdit.createBackupTransaction(transaction); - } + TransactionEdit.createBackupTransaction(transaction); return () => { // If the user cancels out of the modal without without saving changes, then the original transaction // needs to be restored from the backup so that all changes are removed. - if (transactionWasSaved.current || (!isEditingNewRequest && !isEditingRequest)) { + if (transactionWasSaved.current) { return; } TransactionEdit.restoreOriginalTransactionFromBackup(transaction.transactionID); From 099aef17e5d94cf7418e5f2a1b3cace97849c5f6 Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Mon, 4 Dec 2023 12:10:46 +0100 Subject: [PATCH 18/52] fix: resolve comment --- src/libs/UnreadIndicatorUpdater/updateUnread/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/UnreadIndicatorUpdater/updateUnread/index.ts b/src/libs/UnreadIndicatorUpdater/updateUnread/index.ts index a317a00e0cc1..46015f4e5e03 100644 --- a/src/libs/UnreadIndicatorUpdater/updateUnread/index.ts +++ b/src/libs/UnreadIndicatorUpdater/updateUnread/index.ts @@ -18,8 +18,8 @@ const updateUnread: UpdateUnread = (totalCount) => { // seems to improve this issue. document.title = ''; document.title = hasUnread ? `(${totalCount}) ${CONFIG.SITE_TITLE}` : CONFIG.SITE_TITLE; - const favicon = document.getElementById('favicon') as HTMLLinkElement | null; - if (favicon?.href) { + const favicon = document.getElementById('favicon'); + if (favicon instanceof HTMLLinkElement) { favicon.href = hasUnread ? CONFIG.FAVICON.UNREAD : CONFIG.FAVICON.DEFAULT; } }, 0); From e6182a3ae491db48ee4513be85856663090eba43 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Mon, 4 Dec 2023 21:20:36 +0700 Subject: [PATCH 19/52] remove reportID variable --- src/pages/iou/NewDistanceRequestPage.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pages/iou/NewDistanceRequestPage.js b/src/pages/iou/NewDistanceRequestPage.js index dd8031c6cda6..0cf85caefac4 100644 --- a/src/pages/iou/NewDistanceRequestPage.js +++ b/src/pages/iou/NewDistanceRequestPage.js @@ -46,7 +46,6 @@ const defaultProps = { // You can't use Onyx props in the withOnyx mapping, so we need to set up and access the transactionID here, and then pass it down so that DistanceRequest can subscribe to the transaction. function NewDistanceRequestPage({iou, report, route}) { const iouType = lodashGet(route, 'params.iouType', 'request'); - const reportID = lodashGet(route, 'params.reportID', ''); const isEditing = Navigation.getActiveRoute().includes('address'); useEffect(() => { @@ -58,11 +57,11 @@ function NewDistanceRequestPage({iou, report, route}) { const onSubmit = useCallback(() => { if (isEditing) { - Navigation.goBack(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, reportID)); + Navigation.goBack(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, report.reportID)); return; } IOU.navigateToNextPage(iou, iouType, report); - }, [iou, iouType, isEditing, report, reportID]); + }, [iou, iouType, isEditing, report]); return ( Date: Mon, 4 Dec 2023 15:38:39 +0100 Subject: [PATCH 20/52] Add all screens to SCREENS.ts --- src/SCREENS.ts | 168 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) diff --git a/src/SCREENS.ts b/src/SCREENS.ts index f4cbcf4f2564..59e456310fe2 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -22,6 +22,23 @@ const SCREENS = { WORKSPACES: 'Settings_Workspaces', SECURITY: 'Settings_Security', STATUS: 'Settings_Status', + PROFILE: 'Settings_Profile', + PRONOUNS: 'Settings_Pronouns', + DISPLAY_NAME: 'Settings_Display_Name', + TIMEZONE: 'Settings_Timezone', + TIMEZONE_SELECT: 'Settings_Timezone_Select', + PERSONAL_DETAILS_INITIAL: 'Settings_PersonalDetails_Initial', + PERSONAL_DETAILS_LEGAL_NAME: 'Settings_PersonalDetails_LegalName', + PERSONAL_DETAILS_DATE_OF_BIRTH: 'Settings_PersonalDetails_DateOfBirth', + PERSONAL_DETAILS_ADDRESS: 'Settings_PersonalDetails_Address', + PERSONAL_DETAILS_ADDRESS_COUNTRY: 'Settings_PersonalDetails_Address_Country', + CONTACT_METHODS: 'Settings_ContactMethods', + CONTACT_METHOD_DETAILS: 'Settings_ContactMethodDetails', + NEW_CONTACT_METHOD: 'Settings_NewContactMethod', + SHARE_CODE: 'Settings_Share_Code', + ABOUT: 'Settings_About', + APP_DOWNLOAD_LINKS: 'Settings_App_Download_Links', + LOUNGE_ACCESS: 'Settings_Lounge_Access', WALLET: 'Settings_Wallet', WALLET_DOMAIN_CARD: 'Settings_Wallet_DomainCard', WALLET_CARD_GET_PHYSICAL: { @@ -30,14 +47,165 @@ const SCREENS = { ADDRESS: 'Settings_Card_Get_Physical_Address', CONFIRM: 'Settings_Card_Get_Physical_Confirm', }, + WALLET_TRANSFER_BALANCE: 'Settings_Wallet_Transfer_Balance', + WALLET_CHOOSE_TRANSFER_ACCOUNT: 'Settings_Wallet_Choose_Transfer_Account', + WALLET_ENABLE_PAYMENTS: 'Settings_Wallet_EnablePayments', + WALLET_CARD_ACTIVATE: 'Settings_Wallet_Card_Activate', + WALLET_REPORT_VIRTUAL_CARD_FRAUD: 'Settings_Wallet_ReportVirtualCardFraud', + WALLET_CARDS_DIGITAL_DETAILS_UPDATE_ADDRESS: 'Settings_Wallet_Cards_Digital_Details_Update_Address', + ADD_DEBIT_CARD: 'Settings_Add_Debit_Card', + ADD_BANK_ACCOUNT: 'Settings_Add_Bank_Account', + PREFERENCES_PRIORITY_MODE: 'Settings_Preferences_PriorityMode', + PREFERENCES_LANGUAGE: 'Settings_Preferences_Language', + PREFERENCES_THEME: 'Settings_Preferences_Theme', + CLOSE: 'Settings_Close', + STATUS_SET: 'Settings_Status_Set', + TWO_FACTOR_AUTH: 'Settings_TwoFactorAuth', + REPORT_CARD_LOST_OR_DAMAGED: 'Settings_ReportCardLostOrDamaged', }, SAVE_THE_WORLD: { ROOT: 'SaveTheWorld_Root', }, + RIGHT_MODAL: { + SETTINGS: 'Settings', + NEW_CHAT: 'NewChat', + SEARCH: 'Search', + DETAILS: 'Details', + PROFILE: 'Profile', + REPORT_DETAILS: 'Report_Details', + REPORT_SETTINGS: 'Report_Settings', + REPORT_WELCOME_MESSAGE: 'Report_WelcomeMessage', + PARTICIPANTS: 'Participants', + MONEY_REQUEST: 'MoneyRequest', + NEW_TASK: 'NewTask', + TEACHERS_UNITE: 'TeachersUnite', + TASK_DETAILS: 'Task_Details', + ENABLE_PAYMENTS: 'EnablePayments', + SPLIT_DETAILS: 'SplitDetails', + ADD_PERSONAL_BANK_ACCOUNT: 'AddPersonalBankAccount', + WALLET_STATEMENT: 'Wallet_Statement', + FLAG_COMMENT: 'Flag_Comment', + EDIT_REQUEST: 'EditRequest', + SIGN_IN: 'SignIn', + PRIVATE_NOTES: 'Private_Notes', + ROOM_MEMBERS: 'RoomMembers', + ROOM_INVITE: 'RoomInvite', + REFERRAL: 'Referral', + }, SIGN_IN_WITH_APPLE_DESKTOP: 'AppleSignInDesktop', SIGN_IN_WITH_GOOGLE_DESKTOP: 'GoogleSignInDesktop', DESKTOP_SIGN_IN_REDIRECT: 'DesktopSignInRedirect', SAML_SIGN_IN: 'SAMLSignIn', + + MONEY_REQUEST: { + MANUAL_TAB: 'manual', + SCAN_TAB: 'scan', + DISTANCE_TAB: 'distance', + ROOT: 'Money_Request', + AMOUNT: 'Money_Request_Amount', + PARTICIPANTS: 'Money_Request_Participants', + CONFIRMATION: 'Money_Request_Confirmation', + CURRENCY: 'Money_Request_Currency', + DATE: 'Money_Request_Date', + DESCRIPTION: 'Money_Request_Description', + CATEGORY: 'Money_Request_Category', + TAG: 'Money_Request_Tag', + MERCHANT: 'Money_Request_Merchant', + WAYPOINT: 'Money_Request_Waypoint', + EDIT_WAYPOINT: 'Money_Request_Edit_Waypoint', + DISTANCE: 'Money_Request_Distance', + RECEIPT: 'Money_Request_Receipt', + }, + + IOU_SEND: { + ADD_BANK_ACCOUNT: 'IOU_Send_Add_Bank_Account', + ADD_DEBIT_CARD: 'IOU_Send_Add_Debit_Card', + ENABLE_PAYMENTS: 'IOU_Send_Enable_Payments', + }, + + REPORT_SETTINGS: { + ROOT: 'Report_Settings_Root', + ROOM_NAME: 'Report_Settings_Room_Name', + NOTIFICATION_PREFERENCES: 'Report_Settings_Notification_Preferences', + WRITE_CAPABILITY: 'Report_Settings_Write_Capability', + }, + + NEW_TASK: { + ROOT: 'NewTask_Root', + TASK_ASSIGNEE_SELECTOR: 'NewTask_TaskAssigneeSelector', + TASK_SHARE_DESTINATION_SELECTOR: 'NewTask_TaskShareDestinationSelector', + DETAILS: 'NewTask_Details', + TITLE: 'NewTask_Title', + DESCRIPTION: 'NewTask_Description', + }, + + TASK: { + TITLE: 'Task_Title', + DESCRIPTION: 'Task_Description', + ASSIGNEE: 'Task_Assignee', + }, + + PRIVATE_NOTES: { + VIEW: 'PrivateNotes_View', + LIST: 'PrivateNotes_List', + EDIT: 'PrivateNotes_Edit', + }, + + REPORT_DETAILS: { + ROOT: 'Report_Details_Root', + SHARE_CODE: 'Report_Details_Share_Code', + }, + + WORKSPACE: { + INITIAL: 'Workspace_Initial', + SETTINGS: 'Workspace_Settings', + CARD: 'Workspace_Card', + REIMBURSE: 'Workspace_Reimburse', + RATE_AND_UNIT: 'Workspace_RateAndUnit', + BILLS: 'Workspace_Bills', + INVOICES: 'Workspace_Invoices', + TRAVEL: 'Workspace_Travel', + MEMBERS: 'Workspace_Members', + INVITE: 'Workspace_Invite', + INVITE_MESSAGE: 'Workspace_Invite_Message', + CURRENCY: 'Workspace_Settings_Currency', + }, + + EDIT_REQUEST: { + ROOT: 'EditRequest_Root', + CURRENCY: 'EditRequest_Currency', + }, + + I_KNOW_A_TEACHER: 'I_Know_A_Teacher', + INTRO_SCHOOL_PRINCIPAL: 'Intro_School_Principal', + I_AM_A_TEACHER: 'I_Am_A_Teacher', + + ENABLE_PAYMENTS_ROOT: 'EnablePayments_Root', + ADD_PERSONAL_BANK_ACCOUNT_ROOT: 'AddPersonalBankAccount_Root', + REIMBURSEMENT_ACCOUNT_ROOT: 'Reimbursement_Account_Root', + WALLET_STATEMENT_ROOT: 'WalletStatement_Root', + SIGN_IN_ROOT: 'SignIn_Root', + REFERRAL_DETAILS: 'Referral_Details', + + SPLIT_DETAILS: { + ROOT: 'SplitDetails_Root', + EDIT_REQUEST: 'SplitDetails_Edit_Request', + EDIT_CURRENCY: 'SplitDetails_Edit_Currency', + }, + + DETAILS_ROOT: 'Details_Root', + PROFILE_ROOT: 'Profile_Root', + REPORT_WELCOME_MESSAGE_ROOT: 'Report_WelcomeMessage_Root', + REPORT_PARTICIPANTS_ROOT: 'ReportParticipants_Root', + ROOM_MEMBERS_ROOT: 'RoomMembers_Root', + ROOM_INVITE_ROOT: 'RoomInvite_Root', + SEARCH_ROOT: 'Search_Root', + NEW_CHAT_ROOT: 'NewChat_Root', + FLAG_COMMENT_ROOT: 'FlagComment_Root', + REIMBURSEMENT_ACCOUNT: 'ReimbursementAccount', + GET_ASSISTANCE: 'GetAssistance', + + KEYBOARD_SHORTCUTS: 'KeyboardShortcuts', } as const; export default SCREENS; From 76085ddcc5756f336e7cb92f30fa9234f98b33da Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Mon, 4 Dec 2023 15:39:10 +0100 Subject: [PATCH 21/52] Use constant names for screens from SCREENS.ts --- src/libs/Navigation/types.ts | 279 +++++++++++++++++++---------------- 1 file changed, 148 insertions(+), 131 deletions(-) diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index 41df21d8e237..4e4ade108028 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -42,313 +42,313 @@ type CentralPaneNavigatorParamList = { type SettingsNavigatorParamList = { [SCREENS.SETTINGS.ROOT]: undefined; - Settings_Share_Code: undefined; + [SCREENS.SETTINGS.SHARE_CODE]: undefined; [SCREENS.SETTINGS.WORKSPACES]: undefined; - Settings_Profile: undefined; - Settings_Pronouns: undefined; - Settings_Display_Name: undefined; - Settings_Timezone: undefined; - Settings_Timezone_Select: undefined; - Settings_PersonalDetails_Initial: undefined; - Settings_PersonalDetails_LegalName: undefined; - Settings_PersonalDetails_DateOfBirth: undefined; - Settings_PersonalDetails_Address: undefined; - Settings_PersonalDetails_Address_Country: undefined; - Settings_ContactMethods: undefined; - Settings_ContactMethodDetails: undefined; - Settings_NewContactMethod: undefined; + [SCREENS.SETTINGS.PROFILE]: undefined; + [SCREENS.SETTINGS.PRONOUNS]: undefined; + [SCREENS.SETTINGS.DISPLAY_NAME]: undefined; + [SCREENS.SETTINGS.TIMEZONE]: undefined; + [SCREENS.SETTINGS.TIMEZONE_SELECT]: undefined; + [SCREENS.SETTINGS.PERSONAL_DETAILS_INITIAL]: undefined; + [SCREENS.SETTINGS.PERSONAL_DETAILS_LEGAL_NAME]: undefined; + [SCREENS.SETTINGS.PERSONAL_DETAILS_DATE_OF_BIRTH]: undefined; + [SCREENS.SETTINGS.PERSONAL_DETAILS_ADDRESS]: undefined; + [SCREENS.SETTINGS.PERSONAL_DETAILS_ADDRESS_COUNTRY]: undefined; + [SCREENS.SETTINGS.CONTACT_METHODS]: undefined; + [SCREENS.SETTINGS.CONTACT_METHOD_DETAILS]: undefined; + [SCREENS.SETTINGS.NEW_CONTACT_METHOD]: undefined; [SCREENS.SETTINGS.PREFERENCES]: undefined; - Settings_Preferences_PriorityMode: undefined; - Settings_Preferences_Language: undefined; - Settings_Preferences_Theme: undefined; - Settings_Close: undefined; + [SCREENS.SETTINGS.PREFERENCES_PRIORITY_MODE]: undefined; + [SCREENS.SETTINGS.PREFERENCES_LANGUAGE]: undefined; + [SCREENS.SETTINGS.PREFERENCES_THEME]: undefined; + [SCREENS.SETTINGS.CLOSE]: undefined; [SCREENS.SETTINGS.SECURITY]: undefined; - Settings_About: undefined; - Settings_App_Download_Links: undefined; - Settings_Lounge_Access: undefined; - Settings_Wallet: undefined; - Settings_Wallet_Cards_Digital_Details_Update_Address: undefined; - Settings_Wallet_DomainCard: undefined; - Settings_Wallet_ReportVirtualCardFraud: undefined; - Settings_Wallet_Card_Activate: undefined; + [SCREENS.SETTINGS.ABOUT]: undefined; + [SCREENS.SETTINGS.APP_DOWNLOAD_LINKS]: undefined; + [SCREENS.SETTINGS.LOUNGE_ACCESS]: undefined; + [SCREENS.SETTINGS.WALLET]: undefined; + [SCREENS.SETTINGS.WALLET_CARDS_DIGITAL_DETAILS_UPDATE_ADDRESS]: undefined; + [SCREENS.SETTINGS.WALLET_DOMAIN_CARD]: undefined; + [SCREENS.SETTINGS.WALLET_REPORT_VIRTUAL_CARD_FRAUD]: undefined; + [SCREENS.SETTINGS.WALLET_CARD_ACTIVATE]: undefined; [SCREENS.SETTINGS.WALLET_CARD_GET_PHYSICAL.NAME]: undefined; [SCREENS.SETTINGS.WALLET_CARD_GET_PHYSICAL.PHONE]: undefined; [SCREENS.SETTINGS.WALLET_CARD_GET_PHYSICAL.ADDRESS]: undefined; [SCREENS.SETTINGS.WALLET_CARD_GET_PHYSICAL.CONFIRM]: undefined; - Settings_Wallet_Transfer_Balance: undefined; - Settings_Wallet_Choose_Transfer_Account: undefined; - Settings_Wallet_EnablePayments: undefined; - Settings_Add_Debit_Card: undefined; - Settings_Add_Bank_Account: undefined; + [SCREENS.SETTINGS.WALLET_TRANSFER_BALANCE]: undefined; + [SCREENS.SETTINGS.WALLET_CHOOSE_TRANSFER_ACCOUNT]: undefined; + [SCREENS.SETTINGS.WALLET_ENABLE_PAYMENTS]: undefined; + [SCREENS.SETTINGS.ADD_DEBIT_CARD]: undefined; + [SCREENS.SETTINGS.ADD_BANK_ACCOUNT]: undefined; [SCREENS.SETTINGS.STATUS]: undefined; - Settings_Status_Set: undefined; - Workspace_Initial: undefined; - Workspace_Settings: undefined; - Workspace_Settings_Currency: undefined; - Workspace_Card: { + [SCREENS.SETTINGS.STATUS_SET]: undefined; + [SCREENS.WORKSPACE.INITIAL]: undefined; + [SCREENS.WORKSPACE.SETTINGS]: undefined; + [SCREENS.WORKSPACE.CURRENCY]: undefined; + [SCREENS.WORKSPACE.CARD]: { policyID: string; }; - Workspace_Reimburse: { + [SCREENS.WORKSPACE.REIMBURSE]: { policyID: string; }; - Workspace_RateAndUnit: undefined; - Workspace_Bills: { + [SCREENS.WORKSPACE.RATE_AND_UNIT]: undefined; + [SCREENS.WORKSPACE.BILLS]: { policyID: string; }; - Workspace_Invoices: { + [SCREENS.WORKSPACE.INVOICES]: { policyID: string; }; - Workspace_Travel: { + [SCREENS.WORKSPACE.TRAVEL]: { policyID: string; }; - Workspace_Members: { + [SCREENS.WORKSPACE.MEMBERS]: { policyID: string; }; - Workspace_Invite: { + [SCREENS.WORKSPACE.INVITE]: { policyID: string; }; - Workspace_Invite_Message: { + [SCREENS.WORKSPACE.INVITE_MESSAGE]: { policyID: string; }; - ReimbursementAccount: { + [SCREENS.REIMBURSEMENT_ACCOUNT]: { stepToOpen: string; policyID: string; }; - GetAssistance: { + [SCREENS.GET_ASSISTANCE]: { taskID: string; }; - Settings_TwoFactorAuth: undefined; - Settings_ReportCardLostOrDamaged: undefined; - KeyboardShortcuts: undefined; + [SCREENS.SETTINGS.TWO_FACTOR_AUTH]: undefined; + [SCREENS.SETTINGS.REPORT_CARD_LOST_OR_DAMAGED]: undefined; + [SCREENS.KEYBOARD_SHORTCUTS]: undefined; }; type NewChatNavigatorParamList = { - NewChat_Root: undefined; + [SCREENS.NEW_CHAT_ROOT]: undefined; }; type SearchNavigatorParamList = { - Search_Root: undefined; + [SCREENS.SEARCH_ROOT]: undefined; }; type DetailsNavigatorParamList = { - Details_Root: { + [SCREENS.DETAILS_ROOT]: { login: string; reportID: string; }; }; type ProfileNavigatorParamList = { - Profile_Root: { + [SCREENS.PROFILE_ROOT]: { accountID: string; reportID: string; }; }; type ReportDetailsNavigatorParamList = { - Report_Details_Root: undefined; - Report_Details_Share_Code: { + [SCREENS.REPORT_DETAILS.ROOT]: undefined; + [SCREENS.REPORT_DETAILS.SHARE_CODE]: { reportID: string; }; }; type ReportSettingsNavigatorParamList = { - Report_Settings_Root: undefined; - Report_Settings_Room_Name: undefined; - Report_Settings_Notification_Preferences: undefined; - Report_Settings_Write_Capability: undefined; + [SCREENS.REPORT_SETTINGS.ROOT]: undefined; + [SCREENS.REPORT_SETTINGS.ROOM_NAME]: undefined; + [SCREENS.REPORT_SETTINGS.NOTIFICATION_PREFERENCES]: undefined; + [SCREENS.REPORT_SETTINGS.WRITE_CAPABILITY]: undefined; }; type ReportWelcomeMessageNavigatorParamList = { - Report_WelcomeMessage_Root: {reportID: string}; + [SCREENS.REPORT_WELCOME_MESSAGE_ROOT]: {reportID: string}; }; type ParticipantsNavigatorParamList = { - ReportParticipants_Root: {reportID: string}; + [SCREENS.REPORT_PARTICIPANTS_ROOT]: {reportID: string}; }; type RoomMembersNavigatorParamList = { - RoomMembers_Root: undefined; + [SCREENS.ROOM_MEMBERS_ROOT]: undefined; }; type RoomInviteNavigatorParamList = { - RoomInvite_Root: undefined; + [SCREENS.ROOM_INVITE_ROOT]: undefined; }; type MoneyRequestNavigatorParamList = { - Money_Request: undefined; - Money_Request_Amount: undefined; - Money_Request_Participants: { + [SCREENS.MONEY_REQUEST.ROOT]: undefined; + [SCREENS.MONEY_REQUEST.AMOUNT]: undefined; + [SCREENS.MONEY_REQUEST.PARTICIPANTS]: { iouType: string; reportID: string; }; - Money_Request_Confirmation: { + [SCREENS.MONEY_REQUEST.CONFIRMATION]: { iouType: string; reportID: string; }; - Money_Request_Currency: { + [SCREENS.MONEY_REQUEST.CURRENCY]: { iouType: string; reportID: string; currency: string; backTo: string; }; - Money_Request_Date: { + [SCREENS.MONEY_REQUEST.DATE]: { iouType: string; reportID: string; field: string; threadReportID: string; }; - Money_Request_Description: { + [SCREENS.MONEY_REQUEST.DESCRIPTION]: { iouType: string; reportID: string; field: string; threadReportID: string; }; - Money_Request_Category: { + [SCREENS.MONEY_REQUEST.CATEGORY]: { iouType: string; reportID: string; }; - Money_Request_Tag: { + [SCREENS.MONEY_REQUEST.TAG]: { iouType: string; reportID: string; }; - Money_Request_Merchant: { + [SCREENS.MONEY_REQUEST.MERCHANT]: { iouType: string; reportID: string; field: string; threadReportID: string; }; - IOU_Send_Enable_Payments: undefined; - IOU_Send_Add_Bank_Account: undefined; - IOU_Send_Add_Debit_Card: undefined; - Money_Request_Waypoint: { + [SCREENS.IOU_SEND.ENABLE_PAYMENTS]: undefined; + [SCREENS.IOU_SEND.ADD_BANK_ACCOUNT]: undefined; + [SCREENS.IOU_SEND.ADD_DEBIT_CARD]: undefined; + [SCREENS.MONEY_REQUEST.WAYPOINT]: { iouType: string; transactionID: string; waypointIndex: string; threadReportID: number; }; - Money_Request_Edit_Waypoint: { + [SCREENS.MONEY_REQUEST.EDIT_WAYPOINT]: { iouType: string; transactionID: string; waypointIndex: string; threadReportID: number; }; - Money_Request_Distance: { + [SCREENS.MONEY_REQUEST.DISTANCE]: { iouType: ValueOf; reportID: string; }; - Money_Request_Receipt: { + [SCREENS.MONEY_REQUEST.RECEIPT]: { iouType: string; reportID: string; }; }; type NewTaskNavigatorParamList = { - NewTask_Root: undefined; - NewTask_TaskAssigneeSelector: undefined; - NewTask_TaskShareDestinationSelector: undefined; - NewTask_Details: undefined; - NewTask_Title: undefined; - NewTask_Description: undefined; + [SCREENS.NEW_TASK.ROOT]: undefined; + [SCREENS.NEW_TASK.TASK_ASSIGNEE_SELECTOR]: undefined; + [SCREENS.NEW_TASK.TASK_SHARE_DESTINATION_SELECTOR]: undefined; + [SCREENS.NEW_TASK.DETAILS]: undefined; + [SCREENS.NEW_TASK.TITLE]: undefined; + [SCREENS.NEW_TASK.DESCRIPTION]: undefined; }; type TeachersUniteNavigatorParamList = { [SCREENS.SAVE_THE_WORLD.ROOT]: undefined; - I_Know_A_Teacher: undefined; - Intro_School_Principal: undefined; - I_Am_A_Teacher: undefined; + [SCREENS.I_KNOW_A_TEACHER]: undefined; + [SCREENS.INTRO_SCHOOL_PRINCIPAL]: undefined; + [SCREENS.I_AM_A_TEACHER]: undefined; }; type TaskDetailsNavigatorParamList = { - Task_Title: undefined; - Task_Description: undefined; - Task_Assignee: { + [SCREENS.TASK.TITLE]: undefined; + [SCREENS.TASK.DESCRIPTION]: undefined; + [SCREENS.TASK.ASSIGNEE]: { reportID: string; }; }; type EnablePaymentsNavigatorParamList = { - EnablePayments_Root: undefined; + [SCREENS.ENABLE_PAYMENTS_ROOT]: undefined; }; type SplitDetailsNavigatorParamList = { - SplitDetails_Root: { + [SCREENS.SPLIT_DETAILS.ROOT]: { reportActionID: string; }; - SplitDetails_Edit_Request: undefined; - SplitDetails_Edit_Currency: undefined; + [SCREENS.SPLIT_DETAILS.EDIT_REQUEST]: undefined; + [SCREENS.SPLIT_DETAILS.EDIT_CURRENCY]: undefined; }; type AddPersonalBankAccountNavigatorParamList = { - AddPersonalBankAccount_Root: undefined; + [SCREENS.ADD_PERSONAL_BANK_ACCOUNT_ROOT]: undefined; }; type WalletStatementNavigatorParamList = { - WalletStatement_Root: undefined; + [SCREENS.WALLET_STATEMENT_ROOT]: undefined; }; type FlagCommentNavigatorParamList = { - FlagComment_Root: { + [SCREENS.FLAG_COMMENT_ROOT]: { reportID: string; reportActionID: string; }; }; type EditRequestNavigatorParamList = { - EditRequest_Root: { + [SCREENS.EDIT_REQUEST.ROOT]: { field: string; threadReportID: string; }; - EditRequest_Currency: undefined; + [SCREENS.EDIT_REQUEST.CURRENCY]: undefined; }; type SignInNavigatorParamList = { - SignIn_Root: undefined; + [SCREENS.SIGN_IN_ROOT]: undefined; }; type ReferralDetailsNavigatorParamList = { - Referral_Details: undefined; + [SCREENS.REFERRAL_DETAILS]: undefined; }; type PrivateNotesNavigatorParamList = { - PrivateNotes_View: { + [SCREENS.PRIVATE_NOTES.VIEW]: { reportID: string; accountID: string; }; - PrivateNotes_List: { + [SCREENS.PRIVATE_NOTES.LIST]: { reportID: string; accountID: string; }; - PrivateNotes_Edit: { + [SCREENS.PRIVATE_NOTES.EDIT]: { reportID: string; accountID: string; }; }; type RightModalNavigatorParamList = { - Settings: NavigatorScreenParams; - NewChat: NavigatorScreenParams; - Search: NavigatorScreenParams; - Details: NavigatorScreenParams; - Profile: NavigatorScreenParams; - Report_Details: NavigatorScreenParams; - Report_Settings: NavigatorScreenParams; - Report_WelcomeMessage: NavigatorScreenParams; - Participants: NavigatorScreenParams; - RoomMembers: NavigatorScreenParams; - RoomInvite: NavigatorScreenParams; - MoneyRequest: NavigatorScreenParams; - NewTask: NavigatorScreenParams; - TeachersUnite: NavigatorScreenParams; - Task_Details: NavigatorScreenParams; - EnablePayments: NavigatorScreenParams; - SplitDetails: NavigatorScreenParams; - AddPersonalBankAccount: NavigatorScreenParams; - Wallet_Statement: NavigatorScreenParams; - Flag_Comment: NavigatorScreenParams; - EditRequest: NavigatorScreenParams; - SignIn: NavigatorScreenParams; - Referral: NavigatorScreenParams; - Private_Notes: NavigatorScreenParams; + [SCREENS.RIGHT_MODAL.SETTINGS]: NavigatorScreenParams; + [SCREENS.RIGHT_MODAL.NEW_CHAT]: NavigatorScreenParams; + [SCREENS.RIGHT_MODAL.SEARCH]: NavigatorScreenParams; + [SCREENS.RIGHT_MODAL.DETAILS]: NavigatorScreenParams; + [SCREENS.RIGHT_MODAL.PROFILE]: NavigatorScreenParams; + [SCREENS.RIGHT_MODAL.REPORT_DETAILS]: NavigatorScreenParams; + [SCREENS.RIGHT_MODAL.REPORT_SETTINGS]: NavigatorScreenParams; + [SCREENS.RIGHT_MODAL.REPORT_WELCOME_MESSAGE]: NavigatorScreenParams; + [SCREENS.RIGHT_MODAL.PARTICIPANTS]: NavigatorScreenParams; + [SCREENS.RIGHT_MODAL.ROOM_MEMBERS]: NavigatorScreenParams; + [SCREENS.RIGHT_MODAL.ROOM_INVITE]: NavigatorScreenParams; + [SCREENS.RIGHT_MODAL.MONEY_REQUEST]: NavigatorScreenParams; + [SCREENS.RIGHT_MODAL.NEW_TASK]: NavigatorScreenParams; + [SCREENS.RIGHT_MODAL.TEACHERS_UNITE]: NavigatorScreenParams; + [SCREENS.RIGHT_MODAL.TASK_DETAILS]: NavigatorScreenParams; + [SCREENS.RIGHT_MODAL.ENABLE_PAYMENTS]: NavigatorScreenParams; + [SCREENS.RIGHT_MODAL.SPLIT_DETAILS]: NavigatorScreenParams; + [SCREENS.RIGHT_MODAL.ADD_PERSONAL_BANK_ACCOUNT]: NavigatorScreenParams; + [SCREENS.RIGHT_MODAL.WALLET_STATEMENT]: NavigatorScreenParams; + [SCREENS.RIGHT_MODAL.FLAG_COMMENT]: NavigatorScreenParams; + [SCREENS.RIGHT_MODAL.EDIT_REQUEST]: NavigatorScreenParams; + [SCREENS.RIGHT_MODAL.SIGN_IN]: NavigatorScreenParams; + [SCREENS.RIGHT_MODAL.REFERRAL]: NavigatorScreenParams; + [SCREENS.RIGHT_MODAL.PRIVATE_NOTES]: NavigatorScreenParams; }; type PublicScreensParamList = { @@ -390,6 +390,12 @@ type AuthScreensParamList = { reportID: string; source: string; }; + [CONST.DEMO_PAGES.SAASTR]: { + name: string; + }; + [CONST.DEMO_PAGES.SBE]: { + name: string; + }; [SCREENS.NOT_FOUND]: undefined; [NAVIGATORS.RIGHT_MODAL_NAVIGATOR]: NavigatorScreenParams; [SCREENS.DESKTOP_SIGN_IN_REDIRECT]: undefined; @@ -398,4 +404,15 @@ type AuthScreensParamList = { type RootStackParamList = PublicScreensParamList & AuthScreensParamList; -export type {NavigationRef, StackNavigationAction, CentralPaneNavigatorParamList, RootStackParamList, StateOrRoute, NavigationStateRoute, NavigationRoot}; +export type { + NavigationRef, + StackNavigationAction, + CentralPaneNavigatorParamList, + RootStackParamList, + StateOrRoute, + NavigationStateRoute, + NavigationRoot, + AuthScreensParamList, + RightModalNavigatorParamList, + PublicScreensParamList, +}; From 351ab20bece93da578bff9d0a83c4717f0ae0b63 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Mon, 4 Dec 2023 15:39:26 +0100 Subject: [PATCH 22/52] Use constant names for screens in linking config from SCREENS.ts --- src/libs/Navigation/linkingConfig.ts | 266 +++++++++++++-------------- 1 file changed, 133 insertions(+), 133 deletions(-) diff --git a/src/libs/Navigation/linkingConfig.ts b/src/libs/Navigation/linkingConfig.ts index 92a04778b9a6..add2208a9bf1 100644 --- a/src/libs/Navigation/linkingConfig.ts +++ b/src/libs/Navigation/linkingConfig.ts @@ -39,7 +39,7 @@ const linkingConfig: LinkingOptions = { [NAVIGATORS.RIGHT_MODAL_NAVIGATOR]: { screens: { - Settings: { + [SCREENS.RIGHT_MODAL.SETTINGS]: { screens: { [SCREENS.SETTINGS.ROOT]: { path: ROUTES.SETTINGS, @@ -52,19 +52,19 @@ const linkingConfig: LinkingOptions = { path: ROUTES.SETTINGS_PREFERENCES, exact: true, }, - Settings_Preferences_PriorityMode: { + [SCREENS.SETTINGS.PREFERENCES_PRIORITY_MODE]: { path: ROUTES.SETTINGS_PRIORITY_MODE, exact: true, }, - Settings_Preferences_Language: { + [SCREENS.SETTINGS.PREFERENCES_LANGUAGE]: { path: ROUTES.SETTINGS_LANGUAGE, exact: true, }, - Settings_Preferences_Theme: { + [SCREENS.SETTINGS.PREFERENCES_THEME]: { path: ROUTES.SETTINGS_THEME, exact: true, }, - Settings_Close: { + [SCREENS.SETTINGS.CLOSE]: { path: ROUTES.SETTINGS_CLOSE, exact: true, }, @@ -72,15 +72,15 @@ const linkingConfig: LinkingOptions = { path: ROUTES.SETTINGS_SECURITY, exact: true, }, - Settings_Wallet: { + [SCREENS.SETTINGS.WALLET]: { path: ROUTES.SETTINGS_WALLET, exact: true, }, - Settings_Wallet_DomainCard: { + [SCREENS.SETTINGS.WALLET_DOMAIN_CARD]: { path: ROUTES.SETTINGS_WALLET_DOMAINCARD.route, exact: true, }, - Settings_Wallet_ReportVirtualCardFraud: { + [SCREENS.SETTINGS.WALLET_REPORT_VIRTUAL_CARD_FRAUD]: { path: ROUTES.SETTINGS_REPORT_FRAUD.route, exact: true, }, @@ -100,105 +100,105 @@ const linkingConfig: LinkingOptions = { path: ROUTES.SETTINGS_WALLET_CARD_GET_PHYSICAL_CONFIRM.route, exact: true, }, - Settings_Wallet_EnablePayments: { + [SCREENS.SETTINGS.WALLET_ENABLE_PAYMENTS]: { path: ROUTES.SETTINGS_ENABLE_PAYMENTS, exact: true, }, - Settings_Wallet_Transfer_Balance: { + [SCREENS.SETTINGS.WALLET_TRANSFER_BALANCE]: { path: ROUTES.SETTINGS_WALLET_TRANSFER_BALANCE, exact: true, }, - Settings_Wallet_Choose_Transfer_Account: { + [SCREENS.SETTINGS.WALLET_CHOOSE_TRANSFER_ACCOUNT]: { path: ROUTES.SETTINGS_WALLET_CHOOSE_TRANSFER_ACCOUNT, exact: true, }, - Settings_ReportCardLostOrDamaged: { + [SCREENS.SETTINGS.REPORT_CARD_LOST_OR_DAMAGED]: { path: ROUTES.SETTINGS_WALLET_REPORT_CARD_LOST_OR_DAMAGED.route, exact: true, }, - Settings_Wallet_Card_Activate: { + [SCREENS.SETTINGS.WALLET_CARD_ACTIVATE]: { path: ROUTES.SETTINGS_WALLET_CARD_ACTIVATE.route, exact: true, }, - Settings_Wallet_Cards_Digital_Details_Update_Address: { - path: ROUTES.SETTINGS_WALLET_CARD_DIGITAL_DETAILS_UPDATE_ADDRESS.route, + [SCREENS.SETTINGS.WALLET_CARDS_DIGITAL_DETAILS_UPDATE_ADDRESS]: { + path: ROUTES.SETTINGS_WALLET_CARDS_DIGITAL_DETAILS_UPDATE_ADDRESS.route, exact: true, }, - Settings_Add_Debit_Card: { + [SCREENS.SETTINGS.ADD_DEBIT_CARD]: { path: ROUTES.SETTINGS_ADD_DEBIT_CARD, exact: true, }, - Settings_Add_Bank_Account: { + [SCREENS.SETTINGS.ADD_BANK_ACCOUNT]: { path: ROUTES.SETTINGS_ADD_BANK_ACCOUNT, exact: true, }, - Settings_Profile: { + [SCREENS.SETTINGS.PROFILE]: { path: ROUTES.SETTINGS_PROFILE, exact: true, }, - Settings_Pronouns: { + [SCREENS.SETTINGS.PRONOUNS]: { path: ROUTES.SETTINGS_PRONOUNS, exact: true, }, - Settings_Display_Name: { + [SCREENS.SETTINGS.DISPLAY_NAME]: { path: ROUTES.SETTINGS_DISPLAY_NAME, exact: true, }, - Settings_Timezone: { + [SCREENS.SETTINGS.TIMEZONE]: { path: ROUTES.SETTINGS_TIMEZONE, exact: true, }, - Settings_Timezone_Select: { + [SCREENS.SETTINGS.TIMEZONE_SELECT]: { path: ROUTES.SETTINGS_TIMEZONE_SELECT, exact: true, }, - Settings_About: { + [SCREENS.SETTINGS.ABOUT]: { path: ROUTES.SETTINGS_ABOUT, exact: true, }, - Settings_App_Download_Links: { + [SCREENS.SETTINGS.APP_DOWNLOAD_LINKS]: { path: ROUTES.SETTINGS_APP_DOWNLOAD_LINKS, exact: true, }, - Settings_ContactMethods: { + [SCREENS.SETTINGS.CONTACT_METHODS]: { path: ROUTES.SETTINGS_CONTACT_METHODS.route, exact: true, }, - Settings_ContactMethodDetails: { + [SCREENS.SETTINGS.CONTACT_METHOD_DETAILS]: { path: ROUTES.SETTINGS_CONTACT_METHOD_DETAILS.route, }, - Settings_Lounge_Access: { + [SCREENS.SETTINGS.LOUNGE_ACCESS]: { path: ROUTES.SETTINGS_LOUNGE_ACCESS, }, - Settings_NewContactMethod: { + [SCREENS.SETTINGS.NEW_CONTACT_METHOD]: { path: ROUTES.SETTINGS_NEW_CONTACT_METHOD.route, exact: true, }, - Settings_PersonalDetails_Initial: { + [SCREENS.SETTINGS.PERSONAL_DETAILS_INITIAL]: { path: ROUTES.SETTINGS_PERSONAL_DETAILS, exact: true, }, - Settings_PersonalDetails_LegalName: { + [SCREENS.SETTINGS.PERSONAL_DETAILS_LEGAL_NAME]: { path: ROUTES.SETTINGS_PERSONAL_DETAILS_LEGAL_NAME, exact: true, }, - Settings_PersonalDetails_DateOfBirth: { + [SCREENS.SETTINGS.PERSONAL_DETAILS_DATE_OF_BIRTH]: { path: ROUTES.SETTINGS_PERSONAL_DETAILS_DATE_OF_BIRTH, exact: true, }, - Settings_PersonalDetails_Address: { + [SCREENS.SETTINGS.PERSONAL_DETAILS_ADDRESS]: { path: ROUTES.SETTINGS_PERSONAL_DETAILS_ADDRESS, exact: true, }, - Settings_PersonalDetails_Address_Country: { + [SCREENS.SETTINGS.PERSONAL_DETAILS_ADDRESS_COUNTRY]: { path: ROUTES.SETTINGS_PERSONAL_DETAILS_ADDRESS_COUNTRY.route, exact: true, }, - Settings_TwoFactorAuth: { + [SCREENS.SETTINGS.TWO_FACTOR_AUTH]: { path: ROUTES.SETTINGS_2FA.route, exact: true, }, - Settings_Share_Code: { + [SCREENS.SETTINGS.SHARE_CODE]: { path: ROUTES.SETTINGS_SHARE_CODE, exact: true, }, @@ -206,93 +206,93 @@ const linkingConfig: LinkingOptions = { path: ROUTES.SETTINGS_STATUS, exact: true, }, - Settings_Status_Set: { + [SCREENS.SETTINGS.STATUS_SET]: { path: ROUTES.SETTINGS_STATUS_SET, exact: true, }, - Workspace_Initial: { + [SCREENS.WORKSPACE.INITIAL]: { path: ROUTES.WORKSPACE_INITIAL.route, }, - Workspace_Settings: { + [SCREENS.WORKSPACE.SETTINGS]: { path: ROUTES.WORKSPACE_SETTINGS.route, }, - Workspace_Settings_Currency: { + [SCREENS.WORKSPACE.CURRENCY]: { path: ROUTES.WORKSPACE_SETTINGS_CURRENCY.route, }, - Workspace_Card: { + [SCREENS.WORKSPACE.CARD]: { path: ROUTES.WORKSPACE_CARD.route, }, - Workspace_Reimburse: { + [SCREENS.WORKSPACE.REIMBURSE]: { path: ROUTES.WORKSPACE_REIMBURSE.route, }, - Workspace_RateAndUnit: { + [SCREENS.WORKSPACE.RATE_AND_UNIT]: { path: ROUTES.WORKSPACE_RATE_AND_UNIT.route, }, - Workspace_Bills: { + [SCREENS.WORKSPACE.BILLS]: { path: ROUTES.WORKSPACE_BILLS.route, }, - Workspace_Invoices: { + [SCREENS.WORKSPACE.INVOICES]: { path: ROUTES.WORKSPACE_INVOICES.route, }, - Workspace_Travel: { + [SCREENS.WORKSPACE.TRAVEL]: { path: ROUTES.WORKSPACE_TRAVEL.route, }, - Workspace_Members: { + [SCREENS.WORKSPACE.MEMBERS]: { path: ROUTES.WORKSPACE_MEMBERS.route, }, - Workspace_Invite: { + [SCREENS.WORKSPACE.INVITE]: { path: ROUTES.WORKSPACE_INVITE.route, }, - Workspace_Invite_Message: { + [SCREENS.WORKSPACE.INVITE_MESSAGE]: { path: ROUTES.WORKSPACE_INVITE_MESSAGE.route, }, - ReimbursementAccount: { + [SCREENS.REIMBURSEMENT_ACCOUNT]: { path: ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.route, exact: true, }, - GetAssistance: { + [SCREENS.GET_ASSISTANCE]: { path: ROUTES.GET_ASSISTANCE.route, }, - KeyboardShortcuts: { + [SCREENS.KEYBOARD_SHORTCUTS]: { path: ROUTES.KEYBOARD_SHORTCUTS, }, }, }, - Private_Notes: { + [SCREENS.RIGHT_MODAL.PRIVATE_NOTES]: { screens: { - PrivateNotes_View: ROUTES.PRIVATE_NOTES_VIEW.route, - PrivateNotes_List: ROUTES.PRIVATE_NOTES_LIST.route, - PrivateNotes_Edit: ROUTES.PRIVATE_NOTES_EDIT.route, + [SCREENS.PRIVATE_NOTES.VIEW]: ROUTES.PRIVATE_NOTES_VIEW.route, + [SCREENS.PRIVATE_NOTES.LIST]: ROUTES.PRIVATE_NOTES_LIST.route, + [SCREENS.PRIVATE_NOTES.EDIT]: ROUTES.PRIVATE_NOTES_EDIT.route, }, }, - Report_Details: { + [SCREENS.RIGHT_MODAL.REPORT_DETAILS]: { screens: { - Report_Details_Root: ROUTES.REPORT_WITH_ID_DETAILS.route, - Report_Details_Share_Code: ROUTES.REPORT_WITH_ID_DETAILS_SHARE_CODE.route, + [SCREENS.REPORT_DETAILS.ROOT]: ROUTES.REPORT_WITH_ID_DETAILS.route, + [SCREENS.REPORT_DETAILS.SHARE_CODE]: ROUTES.REPORT_WITH_ID_DETAILS_SHARE_CODE.route, }, }, - Report_Settings: { + [SCREENS.RIGHT_MODAL.REPORT_SETTINGS]: { screens: { - Report_Settings_Root: { + [SCREENS.REPORT_SETTINGS.ROOT]: { path: ROUTES.REPORT_SETTINGS.route, }, - Report_Settings_Room_Name: { + [SCREENS.REPORT_SETTINGS.ROOM_NAME]: { path: ROUTES.REPORT_SETTINGS_ROOM_NAME.route, }, - Report_Settings_Notification_Preferences: { + [SCREENS.REPORT_SETTINGS.NOTIFICATION_PREFERENCES]: { path: ROUTES.REPORT_SETTINGS_NOTIFICATION_PREFERENCES.route, }, - Report_Settings_Write_Capability: { + [SCREENS.REPORT_SETTINGS.WRITE_CAPABILITY]: { path: ROUTES.REPORT_SETTINGS_WRITE_CAPABILITY.route, }, }, }, - Report_WelcomeMessage: { + [SCREENS.RIGHT_MODAL.REPORT_WELCOME_MESSAGE]: { screens: { - Report_WelcomeMessage_Root: ROUTES.REPORT_WELCOME_MESSAGE.route, + [SCREENS.REPORT_WELCOME_MESSAGE_ROOT]: ROUTES.REPORT_WELCOME_MESSAGE.route, }, }, - NewChat: { + [SCREENS.RIGHT_MODAL.NEW_CHAT]: { screens: { NewChat_Root: { path: ROUTES.NEW, @@ -310,140 +310,140 @@ const linkingConfig: LinkingOptions = { }, }, }, - NewTask: { + [SCREENS.RIGHT_MODAL.NEW_CHAT]: { screens: { - NewTask_Root: ROUTES.NEW_TASK, - NewTask_TaskAssigneeSelector: ROUTES.NEW_TASK_ASSIGNEE, - NewTask_TaskShareDestinationSelector: ROUTES.NEW_TASK_SHARE_DESTINATION, - NewTask_Details: ROUTES.NEW_TASK_DETAILS, - NewTask_Title: ROUTES.NEW_TASK_TITLE, - NewTask_Description: ROUTES.NEW_TASK_DESCRIPTION, + [SCREENS.NEW_TASK.ROOT]: ROUTES.NEW_TASK, + [SCREENS.NEW_TASK.TASK_ASSIGNEE_SELECTOR]: ROUTES.NEW_TASK_ASSIGNEE, + [SCREENS.NEW_TASK.TASK_SHARE_DESTINATION_SELECTOR]: ROUTES.NEW_TASK_SHARE_DESTINATION, + [SCREENS.NEW_TASK.DETAILS]: ROUTES.NEW_TASK_DETAILS, + [SCREENS.NEW_TASK.TITLE]: ROUTES.NEW_TASK_TITLE, + [SCREENS.NEW_TASK.DESCRIPTION]: ROUTES.NEW_TASK_DESCRIPTION, }, }, - TeachersUnite: { + [SCREENS.RIGHT_MODAL.TEACHERS_UNITE]: { screens: { [SCREENS.SAVE_THE_WORLD.ROOT]: ROUTES.TEACHERS_UNITE, - I_Know_A_Teacher: ROUTES.I_KNOW_A_TEACHER, - Intro_School_Principal: ROUTES.INTRO_SCHOOL_PRINCIPAL, - I_Am_A_Teacher: ROUTES.I_AM_A_TEACHER, + [SCREENS.I_KNOW_A_TEACHER]: ROUTES.I_KNOW_A_TEACHER, + [SCREENS.INTRO_SCHOOL_PRINCIPAL]: ROUTES.INTRO_SCHOOL_PRINCIPAL, + [SCREENS.I_AM_A_TEACHER]: ROUTES.I_AM_A_TEACHER, }, }, - Search: { + [SCREENS.RIGHT_MODAL.SEARCH]: { screens: { - Search_Root: ROUTES.SEARCH, + [SCREENS.SEARCH_ROOT]: ROUTES.SEARCH, }, }, - Details: { + [SCREENS.RIGHT_MODAL.DETAILS]: { screens: { - Details_Root: ROUTES.DETAILS.route, + [SCREENS.DETAILS_ROOT]: ROUTES.DETAILS.route, }, }, - Profile: { + [SCREENS.RIGHT_MODAL.PROFILE]: { screens: { - Profile_Root: ROUTES.PROFILE.route, + [SCREENS.PROFILE_ROOT]: ROUTES.PROFILE.route, }, }, - Participants: { + [SCREENS.RIGHT_MODAL.PARTICIPANTS]: { screens: { - ReportParticipants_Root: ROUTES.REPORT_PARTICIPANTS.route, + [SCREENS.REPORT_PARTICIPANTS_ROOT]: ROUTES.REPORT_PARTICIPANTS.route, }, }, - RoomInvite: { + [SCREENS.RIGHT_MODAL.ROOM_INVITE]: { screens: { - RoomInvite_Root: ROUTES.ROOM_INVITE.route, + [SCREENS.ROOM_INVITE_ROOT]: ROUTES.ROOM_INVITE.route, }, }, - RoomMembers: { + [SCREENS.RIGHT_MODAL.ROOM_MEMBERS]: { screens: { - RoomMembers_Root: ROUTES.ROOM_MEMBERS.route, + [SCREENS.ROOM_MEMBERS_ROOT]: ROUTES.ROOM_MEMBERS.route, }, }, - MoneyRequest: { + [SCREENS.RIGHT_MODAL.MONEY_REQUEST]: { screens: { - Money_Request: { + [SCREENS.MONEY_REQUEST.ROOT]: { path: ROUTES.MONEY_REQUEST.route, exact: true, screens: { - manual: { + [SCREENS.MONEY_REQUEST.MANUAL_TAB]: { path: ROUTES.MONEY_REQUEST_MANUAL_TAB, exact: true, }, - scan: { + [SCREENS.MONEY_REQUEST.SCAN_TAB]: { path: ROUTES.MONEY_REQUEST_SCAN_TAB, exact: true, }, - distance: { + [SCREENS.MONEY_REQUEST.DISTANCE_TAB]: { path: ROUTES.MONEY_REQUEST_DISTANCE_TAB.route, exact: true, }, }, }, - Money_Request_Amount: ROUTES.MONEY_REQUEST_AMOUNT.route, - Money_Request_Participants: ROUTES.MONEY_REQUEST_PARTICIPANTS.route, - Money_Request_Confirmation: ROUTES.MONEY_REQUEST_CONFIRMATION.route, - Money_Request_Date: ROUTES.MONEY_REQUEST_DATE.route, - Money_Request_Currency: ROUTES.MONEY_REQUEST_CURRENCY.route, - Money_Request_Description: ROUTES.MONEY_REQUEST_DESCRIPTION.route, - Money_Request_Category: ROUTES.MONEY_REQUEST_CATEGORY.route, - Money_Request_Tag: ROUTES.MONEY_REQUEST_TAG.route, - Money_Request_Merchant: ROUTES.MONEY_REQUEST_MERCHANT.route, - Money_Request_Waypoint: ROUTES.MONEY_REQUEST_WAYPOINT.route, - Money_Request_Edit_Waypoint: ROUTES.MONEY_REQUEST_EDIT_WAYPOINT.route, - Money_Request_Receipt: ROUTES.MONEY_REQUEST_RECEIPT.route, - Money_Request_Distance: ROUTES.MONEY_REQUEST_DISTANCE.route, - IOU_Send_Enable_Payments: ROUTES.IOU_SEND_ENABLE_PAYMENTS, - IOU_Send_Add_Bank_Account: ROUTES.IOU_SEND_ADD_BANK_ACCOUNT, - IOU_Send_Add_Debit_Card: ROUTES.IOU_SEND_ADD_DEBIT_CARD, + [SCREENS.MONEY_REQUEST.AMOUNT]: ROUTES.MONEY_REQUEST_AMOUNT.route, + [SCREENS.MONEY_REQUEST.PARTICIPANTS]: ROUTES.MONEY_REQUEST_PARTICIPANTS.route, + [SCREENS.MONEY_REQUEST.CONFIRMATION]: ROUTES.MONEY_REQUEST_CONFIRMATION.route, + [SCREENS.MONEY_REQUEST.DATE]: ROUTES.MONEY_REQUEST_DATE.route, + [SCREENS.MONEY_REQUEST.CURRENCY]: ROUTES.MONEY_REQUEST_CURRENCY.route, + [SCREENS.MONEY_REQUEST.DESCRIPTION]: ROUTES.MONEY_REQUEST_DESCRIPTION.route, + [SCREENS.MONEY_REQUEST.CATEGORY]: ROUTES.MONEY_REQUEST_CATEGORY.route, + [SCREENS.MONEY_REQUEST.TAG]: ROUTES.MONEY_REQUEST_TAG.route, + [SCREENS.MONEY_REQUEST.MERCHANT]: ROUTES.MONEY_REQUEST_MERCHANT.route, + [SCREENS.MONEY_REQUEST.WAYPOINT]: ROUTES.MONEY_REQUEST_WAYPOINT.route, + [SCREENS.MONEY_REQUEST.EDIT_WAYPOINT]: ROUTES.MONEY_REQUEST_EDIT_WAYPOINT.route, + [SCREENS.MONEY_REQUEST.RECEIPT]: ROUTES.MONEY_REQUEST_RECEIPT.route, + [SCREENS.MONEY_REQUEST.DISTANCE]: ROUTES.MONEY_REQUEST_DISTANCE.route, + [SCREENS.IOU_SEND.ENABLE_PAYMENTS]: ROUTES.IOU_SEND_ENABLE_PAYMENTS, + [SCREENS.IOU_SEND.ADD_BANK_ACCOUNT]: ROUTES.IOU_SEND_ADD_BANK_ACCOUNT, + [SCREENS.IOU_SEND.ADD_DEBIT_CARD]: ROUTES.IOU_SEND_ADD_DEBIT_CARD, }, }, - SplitDetails: { + [SCREENS.RIGHT_MODAL.SPLIT_DETAILS]: { screens: { - SplitDetails_Root: ROUTES.SPLIT_BILL_DETAILS.route, - SplitDetails_Edit_Request: ROUTES.EDIT_SPLIT_BILL.route, - SplitDetails_Edit_Currency: ROUTES.EDIT_SPLIT_BILL_CURRENCY.route, + [SCREENS.SPLIT_DETAILS.ROOT]: ROUTES.SPLIT_BILL_DETAILS.route, + [SCREENS.SPLIT_DETAILS.EDIT_REQUEST]: ROUTES.EDIT_SPLIT_BILL.route, + [SCREENS.SPLIT_DETAILS.EDIT_CURRENCY]: ROUTES.EDIT_SPLIT_BILL_CURRENCY.route, }, }, - Task_Details: { + [SCREENS.RIGHT_MODAL.TASK_DETAILS]: { screens: { - Task_Title: ROUTES.TASK_TITLE.route, - Task_Description: ROUTES.TASK_DESCRIPTION.route, - Task_Assignee: ROUTES.TASK_ASSIGNEE.route, + [SCREENS.TASK.TITLE]: ROUTES.TASK_TITLE.route, + [SCREENS.TASK.DESCRIPTION]: ROUTES.TASK_DESCRIPTION.route, + [SCREENS.TASK.ASSIGNEE]: ROUTES.TASK_ASSIGNEE.route, }, }, - AddPersonalBankAccount: { + [SCREENS.RIGHT_MODAL.ADD_PERSONAL_BANK_ACCOUNT]: { screens: { - AddPersonalBankAccount_Root: ROUTES.BANK_ACCOUNT_PERSONAL, + [SCREENS.ADD_PERSONAL_BANK_ACCOUNT_ROOT]: ROUTES.BANK_ACCOUNT_PERSONAL, }, }, - EnablePayments: { + [SCREENS.RIGHT_MODAL.ENABLE_PAYMENTS]: { screens: { - EnablePayments_Root: ROUTES.ENABLE_PAYMENTS, + [SCREENS.ENABLE_PAYMENTS_ROOT]: ROUTES.ENABLE_PAYMENTS, }, }, - Wallet_Statement: { + [SCREENS.RIGHT_MODAL.WALLET_STATEMENT]: { screens: { - WalletStatement_Root: ROUTES.WALLET_STATEMENT_WITH_DATE, + [SCREENS.WALLET_STATEMENT_ROOT]: ROUTES.WALLET_STATEMENT_WITH_DATE, }, }, - Flag_Comment: { + [SCREENS.RIGHT_MODAL.FLAG_COMMENT]: { screens: { - FlagComment_Root: ROUTES.FLAG_COMMENT.route, + [SCREENS.FLAG_COMMENT_ROOT]: ROUTES.FLAG_COMMENT.route, }, }, - EditRequest: { + [SCREENS.RIGHT_MODAL.EDIT_REQUEST]: { screens: { - EditRequest_Root: ROUTES.EDIT_REQUEST.route, - EditRequest_Currency: ROUTES.EDIT_CURRENCY_REQUEST.route, + [SCREENS.EDIT_REQUEST.ROOT]: ROUTES.EDIT_REQUEST.route, + [SCREENS.EDIT_REQUEST.CURRENCY]: ROUTES.EDIT_CURRENCY_REQUEST.route, }, }, - SignIn: { + [SCREENS.RIGHT_MODAL.SIGN_IN]: { screens: { - SignIn_Root: ROUTES.SIGN_IN_MODAL, + [SCREENS.SIGN_IN_ROOT]: ROUTES.SIGN_IN_MODAL, }, }, - Referral: { + [SCREENS.RIGHT_MODAL.REFERRAL]: { screens: { - Referral_Details: ROUTES.REFERRAL_DETAILS_MODAL.route, + [SCREENS.REFERRAL_DETAILS]: ROUTES.REFERRAL_DETAILS_MODAL.route, }, }, }, From 21fed0dab107798a274b0e0bc267b07b62964137 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Mon, 4 Dec 2023 15:39:46 +0100 Subject: [PATCH 23/52] Use constant names for screens in modal stack navigator from SCREENS.ts --- .../AppNavigator/ModalStackNavigators.js | 215 +++++++++--------- 1 file changed, 108 insertions(+), 107 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators.js b/src/libs/Navigation/AppNavigator/ModalStackNavigators.js index be803e62a98b..1c8f742e72b5 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators.js +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators.js @@ -44,195 +44,196 @@ function createModalStackNavigator(screens) { } const MoneyRequestModalStackNavigator = createModalStackNavigator({ - Money_Request: () => require('../../../pages/iou/MoneyRequestSelectorPage').default, - Money_Request_Amount: () => require('../../../pages/iou/steps/NewRequestAmountPage').default, - Money_Request_Participants: () => require('../../../pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage').default, - Money_Request_Confirmation: () => require('../../../pages/iou/steps/MoneyRequestConfirmPage').default, - Money_Request_Currency: () => require('../../../pages/iou/IOUCurrencySelection').default, - Money_Request_Date: () => require('../../../pages/iou/MoneyRequestDatePage').default, - Money_Request_Description: () => require('../../../pages/iou/MoneyRequestDescriptionPage').default, - Money_Request_Category: () => require('../../../pages/iou/MoneyRequestCategoryPage').default, - Money_Request_Tag: () => require('../../../pages/iou/MoneyRequestTagPage').default, - Money_Request_Merchant: () => require('../../../pages/iou/MoneyRequestMerchantPage').default, - IOU_Send_Add_Bank_Account: () => require('../../../pages/AddPersonalBankAccountPage').default, - IOU_Send_Add_Debit_Card: () => require('../../../pages/settings/Wallet/AddDebitCardPage').default, - IOU_Send_Enable_Payments: () => require('../../../pages/EnablePayments/EnablePaymentsPage').default, - Money_Request_Waypoint: () => require('../../../pages/iou/NewDistanceRequestWaypointEditorPage').default, - Money_Request_Edit_Waypoint: () => require('../../../pages/iou/MoneyRequestEditWaypointPage').default, - Money_Request_Distance: () => require('../../../pages/iou/NewDistanceRequestPage').default, - Money_Request_Receipt: () => require('../../../pages/EditRequestReceiptPage').default, + [SCREENS.MONEY_REQUEST.ROOT]: () => require('../../../pages/iou/MoneyRequestSelectorPage').default, + [SCREENS.MONEY_REQUEST.AMOUNT]: () => require('../../../pages/iou/steps/NewRequestAmountPage').default, + [SCREENS.MONEY_REQUEST.PARTICIPANTS]: () => require('../../../pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage').default, + [SCREENS.MONEY_REQUEST.CONFIRMATION]: () => require('../../../pages/iou/steps/MoneyRequestConfirmPage').default, + [SCREENS.MONEY_REQUEST.CURRENCY]: () => require('../../../pages/iou/IOUCurrencySelection').default, + [SCREENS.MONEY_REQUEST.DATE]: () => require('../../../pages/iou/MoneyRequestDatePage').default, + [SCREENS.MONEY_REQUEST.DESCRIPTION]: () => require('../../../pages/iou/MoneyRequestDescriptionPage').default, + [SCREENS.MONEY_REQUEST.CATEGORY]: () => require('../../../pages/iou/MoneyRequestCategoryPage').default, + [SCREENS.MONEY_REQUEST.TAG]: () => require('../../../pages/iou/MoneyRequestTagPage').default, + [SCREENS.MONEY_REQUEST.MERCHANT]: () => require('../../../pages/iou/MoneyRequestMerchantPage').default, + [SCREENS.IOU_SEND.ADD_BANK_ACCOUNT]: () => require('../../../pages/AddPersonalBankAccountPage').default, + [SCREENS.IOU_SEND.ADD_DEBIT_CARD]: () => require('../../../pages/settings/Wallet/AddDebitCardPage').default, + [SCREENS.IOU_SEND.ENABLE_PAYMENTS]: () => require('../../../pages/EnablePayments/EnablePaymentsPage').default, + [SCREENS.MONEY_REQUEST.WAYPOINT]: () => require('../../../pages/iou/NewDistanceRequestWaypointEditorPage').default, + [SCREENS.MONEY_REQUEST.EDIT_WAYPOINT]: () => require('../../../pages/iou/MoneyRequestEditWaypointPage').default, + [SCREENS.MONEY_REQUEST.DISTANCE]: () => require('../../../pages/iou/NewDistanceRequestPage').default, + [SCREENS.MONEY_REQUEST.RECEIPT]: () => require('../../../pages/EditRequestReceiptPage').default, }); const SplitDetailsModalStackNavigator = createModalStackNavigator({ - SplitDetails_Root: () => require('../../../pages/iou/SplitBillDetailsPage').default, - SplitDetails_Edit_Request: () => require('../../../pages/EditSplitBillPage').default, - SplitDetails_Edit_Currency: () => require('../../../pages/iou/IOUCurrencySelection').default, + [SCREENS.SPLIT_DETAILS.ROOT]: () => require('../../../pages/iou/SplitBillDetailsPage').default, + [SCREENS.SPLIT_DETAILS.EDIT_REQUEST]: () => require('../../../pages/EditSplitBillPage').default, + [SCREENS.SPLIT_DETAILS.EDIT_CURRENCY]: () => require('../../../pages/iou/IOUCurrencySelection').default, }); const DetailsModalStackNavigator = createModalStackNavigator({ - Details_Root: () => require('../../../pages/DetailsPage').default, + [SCREENS.DETAILS_ROOT]: () => require('../../../pages/DetailsPage').default, }); const ProfileModalStackNavigator = createModalStackNavigator({ - Profile_Root: () => require('../../../pages/ProfilePage').default, + [SCREENS.PROFILE_ROOT]: () => require('../../../pages/ProfilePage').default, }); const ReportDetailsModalStackNavigator = createModalStackNavigator({ - Report_Details_Root: () => require('../../../pages/ReportDetailsPage').default, - Report_Details_Share_Code: () => require('../../../pages/home/report/ReportDetailsShareCodePage').default, + [SCREENS.REPORT_DETAILS.ROOT]: () => require('../../../pages/ReportDetailsPage').default, + [SCREENS.REPORT_DETAILS.SHARE_CODE]: () => require('../../../pages/home/report/ReportDetailsShareCodePage').default, }); const ReportSettingsModalStackNavigator = createModalStackNavigator({ - Report_Settings_Root: () => require('../../../pages/settings/Report/ReportSettingsPage').default, - Report_Settings_Room_Name: () => require('../../../pages/settings/Report/RoomNamePage').default, - Report_Settings_Notification_Preferences: () => require('../../../pages/settings/Report/NotificationPreferencePage').default, - Report_Settings_Write_Capability: () => require('../../../pages/settings/Report/WriteCapabilityPage').default, + [SCREENS.REPORT_SETTINGS.ROOT]: () => require('../../../pages/settings/Report/ReportSettingsPage').default, + [SCREENS.REPORT_SETTINGS.ROOM_NAME]: () => require('../../../pages/settings/Report/RoomNamePage').default, + [SCREENS.REPORT_SETTINGS.NOTIFICATION_PREFERENCES]: () => require('../../../pages/settings/Report/NotificationPreferencePage').default, + [SCREENS.REPORT_SETTINGS.WRITE_CAPABILITY]: () => require('../../../pages/settings/Report/WriteCapabilityPage').default, }); const TaskModalStackNavigator = createModalStackNavigator({ - Task_Title: () => require('../../../pages/tasks/TaskTitlePage').default, - Task_Description: () => require('../../../pages/tasks/TaskDescriptionPage').default, - Task_Assignee: () => require('../../../pages/tasks/TaskAssigneeSelectorModal').default, + [SCREENS.TASK.TITLE]: () => require('../../../pages/tasks/TaskTitlePage').default, + [SCREENS.TASK.DESCRIPTION]: () => require('../../../pages/tasks/TaskDescriptionPage').default, + [SCREENS.TASK.ASSIGNEE]: () => require('../../../pages/tasks/TaskAssigneeSelectorModal').default, }); const ReportWelcomeMessageModalStackNavigator = createModalStackNavigator({ - Report_WelcomeMessage_Root: () => require('../../../pages/ReportWelcomeMessagePage').default, + [SCREENS.REPORT_WELCOME_MESSAGE_ROOT]: () => require('../../../pages/ReportWelcomeMessagePage').default, }); const ReportParticipantsModalStackNavigator = createModalStackNavigator({ - ReportParticipants_Root: () => require('../../../pages/ReportParticipantsPage').default, + [SCREENS.REPORT_PARTICIPANTS_ROOT]: () => require('../../../pages/ReportParticipantsPage').default, }); const RoomMembersModalStackNavigator = createModalStackNavigator({ - RoomMembers_Root: () => require('../../../pages/RoomMembersPage').default, + [SCREENS.ROOM_MEMBERS_ROOT]: () => require('../../../pages/RoomMembersPage').default, }); const RoomInviteModalStackNavigator = createModalStackNavigator({ - RoomInvite_Root: () => require('../../../pages/RoomInvitePage').default, + [SCREENS.ROOM_INVITE_ROOT]: () => require('../../../pages/RoomInvitePage').default, }); const SearchModalStackNavigator = createModalStackNavigator({ - Search_Root: () => require('../../../pages/SearchPage').default, + [SCREENS.SEARCH_ROOT]: () => require('../../../pages/SearchPage').default, }); const NewChatModalStackNavigator = createModalStackNavigator({ - NewChat_Root: () => require('../../../pages/NewChatSelectorPage').default, + [SCREENS.NEW_CHAT_ROOT]: () => require('../../../pages/NewChatSelectorPage').default, }); const NewTaskModalStackNavigator = createModalStackNavigator({ - NewTask_Root: () => require('../../../pages/tasks/NewTaskPage').default, - NewTask_TaskAssigneeSelector: () => require('../../../pages/tasks/TaskAssigneeSelectorModal').default, - NewTask_TaskShareDestinationSelector: () => require('../../../pages/tasks/TaskShareDestinationSelectorModal').default, - NewTask_Details: () => require('../../../pages/tasks/NewTaskDetailsPage').default, - NewTask_Title: () => require('../../../pages/tasks/NewTaskTitlePage').default, - NewTask_Description: () => require('../../../pages/tasks/NewTaskDescriptionPage').default, + [SCREENS.NEW_TASK.ROOT]: () => require('../../../pages/tasks/NewTaskPage').default, + [SCREENS.NEW_TASK.TASK_ASSIGNEE_SELECTOR]: () => require('../../../pages/tasks/TaskAssigneeSelectorModal').default, + [SCREENS.NEW_TASK.TASK_SHARE_DESTINATION_SELECTOR]: () => require('../../../pages/tasks/TaskShareDestinationSelectorModal').default, + [SCREENS.NEW_TASK.DETAILS]: () => require('../../../pages/tasks/NewTaskDetailsPage').default, + [SCREENS.NEW_TASK.TITLE]: () => require('../../../pages/tasks/NewTaskTitlePage').default, + [SCREENS.NEW_TASK.DESCRIPTION]: () => require('../../../pages/tasks/NewTaskDescriptionPage').default, }); const NewTeachersUniteNavigator = createModalStackNavigator({ [SCREENS.SAVE_THE_WORLD.ROOT]: () => require('../../../pages/TeachersUnite/SaveTheWorldPage').default, - I_Know_A_Teacher: () => require('../../../pages/TeachersUnite/KnowATeacherPage').default, - Intro_School_Principal: () => require('../../../pages/TeachersUnite/ImTeacherPage').default, - I_Am_A_Teacher: () => require('../../../pages/TeachersUnite/ImTeacherPage').default, + [SCREENS.I_KNOW_A_TEACHER]: () => require('../../../pages/TeachersUnite/KnowATeacherPage').default, + [SCREENS.INTRO_SCHOOL_PRINCIPAL]: () => require('../../../pages/TeachersUnite/ImTeacherPage').default, + [SCREENS.I_AM_A_TEACHER]: () => require('../../../pages/TeachersUnite/ImTeacherPage').default, }); const SettingsModalStackNavigator = createModalStackNavigator({ [SCREENS.SETTINGS.ROOT]: () => require('../../../pages/settings/InitialSettingsPage').default, - Settings_Share_Code: () => require('../../../pages/ShareCodePage').default, + [SCREENS.SETTINGS.SHARE_CODE]: () => require('../../../pages/ShareCodePage').default, [SCREENS.SETTINGS.WORKSPACES]: () => require('../../../pages/workspace/WorkspacesListPage').default, - Settings_Profile: () => require('../../../pages/settings/Profile/ProfilePage').default, - Settings_Pronouns: () => require('../../../pages/settings/Profile/PronounsPage').default, - Settings_Display_Name: () => require('../../../pages/settings/Profile/DisplayNamePage').default, - Settings_Timezone: () => require('../../../pages/settings/Profile/TimezoneInitialPage').default, - Settings_Timezone_Select: () => require('../../../pages/settings/Profile/TimezoneSelectPage').default, - Settings_PersonalDetails_Initial: () => require('../../../pages/settings/Profile/PersonalDetails/PersonalDetailsInitialPage').default, - Settings_PersonalDetails_LegalName: () => require('../../../pages/settings/Profile/PersonalDetails/LegalNamePage').default, - Settings_PersonalDetails_DateOfBirth: () => require('../../../pages/settings/Profile/PersonalDetails/DateOfBirthPage').default, - Settings_PersonalDetails_Address: () => require('../../../pages/settings/Profile/PersonalDetails/AddressPage').default, - Settings_PersonalDetails_Address_Country: () => require('../../../pages/settings/Profile/PersonalDetails/CountrySelectionPage').default, - Settings_ContactMethods: () => require('../../../pages/settings/Profile/Contacts/ContactMethodsPage').default, - Settings_ContactMethodDetails: () => require('../../../pages/settings/Profile/Contacts/ContactMethodDetailsPage').default, - Settings_NewContactMethod: () => require('../../../pages/settings/Profile/Contacts/NewContactMethodPage').default, + [SCREENS.SETTINGS.PROFILE]: () => require('../../../pages/settings/Profile/ProfilePage').default, + [SCREENS.SETTINGS.PRONOUNS]: () => require('../../../pages/settings/Profile/PronounsPage').default, + [SCREENS.SETTINGS.DISPLAY_NAME]: () => require('../../../pages/settings/Profile/DisplayNamePage').default, + [SCREENS.SETTINGS.TIMEZONE]: () => require('../../../pages/settings/Profile/TimezoneInitialPage').default, + [SCREENS.SETTINGS.TIMEZONE_SELECT]: () => require('../../../pages/settings/Profile/TimezoneSelectPage').default, + [SCREENS.SETTINGS.PERSONAL_DETAILS_INITIAL]: () => require('../../../pages/settings/Profile/PersonalDetails/PersonalDetailsInitialPage').default, + [SCREENS.SETTINGS.PERSONAL_DETAILS_LEGAL_NAME]: () => require('../../../pages/settings/Profile/PersonalDetails/LegalNamePage').default, + [SCREENS.SETTINGS.PERSONAL_DETAILS_DATE_OF_BIRTH]: () => require('../../../pages/settings/Profile/PersonalDetails/DateOfBirthPage').default, + [SCREENS.SETTINGS.PERSONAL_DETAILS_ADDRESS]: () => require('../../../pages/settings/Profile/PersonalDetails/AddressPage').default, + [SCREENS.SETTINGS.PERSONAL_DETAILS_ADDRESS_COUNTRY]: () => require('../../../pages/settings/Profile/PersonalDetails/CountrySelectionPage').default, + [SCREENS.SETTINGS.CONTACT_METHODS]: () => require('../../../pages/settings/Profile/Contacts/ContactMethodsPage').default, + [SCREENS.SETTINGS.CONTACT_METHOD_DETAILS]: () => require('../../../pages/settings/Profile/Contacts/ContactMethodDetailsPage').default, + [SCREENS.SETTINGS.NEW_CONTACT_METHOD]: () => require('../../../pages/settings/Profile/Contacts/NewContactMethodPage').default, [SCREENS.SETTINGS.PREFERENCES]: () => require('../../../pages/settings/Preferences/PreferencesPage').default, - Settings_Preferences_PriorityMode: () => require('../../../pages/settings/Preferences/PriorityModePage').default, - Settings_Preferences_Language: () => require('../../../pages/settings/Preferences/LanguagePage').default, + [SCREENS.SETTINGS.PREFERENCES_PRIORITY_MODE]: () => require('../../../pages/settings/Preferences/PriorityModePage').default, + [SCREENS.SETTINGS.PREFERENCES_LANGUAGE]: () => require('../../../pages/settings/Preferences/LanguagePage').default, // Will be uncommented as part of https://github.com/Expensify/App/issues/21670 - // Settings_Preferences_Theme: () => require('../../../pages/settings/Preferences/ThemePage').default, - Settings_Close: () => require('../../../pages/settings/Security/CloseAccountPage').default, + // [SCREENS.SETTINGS.PREFERENCES_THEME]: () => require('../../../pages/settings/Preferences/ThemePage').default, + [SCREENS.SETTINGS.CLOSE]: () => require('../../../pages/settings/Security/CloseAccountPage').default, [SCREENS.SETTINGS.SECURITY]: () => require('../../../pages/settings/Security/SecuritySettingsPage').default, - Settings_About: () => require('../../../pages/settings/AboutPage/AboutPage').default, - Settings_App_Download_Links: () => require('../../../pages/settings/AppDownloadLinks').default, - Settings_Lounge_Access: () => require('../../../pages/settings/Profile/LoungeAccessPage').default, - Settings_Wallet: () => require('../../../pages/settings/Wallet/WalletPage').default, - Settings_Wallet_Cards_Digital_Details_Update_Address: () => require('../../../pages/settings/Profile/PersonalDetails/AddressPage').default, - Settings_Wallet_DomainCard: () => require('../../../pages/settings/Wallet/ExpensifyCardPage').default, - Settings_Wallet_ReportVirtualCardFraud: () => require('../../../pages/settings/Wallet/ReportVirtualCardFraudPage').default, - Settings_Wallet_Card_Activate: () => require('../../../pages/settings/Wallet/ActivatePhysicalCardPage').default, + [SCREENS.SETTINGS.ABOUT]: () => require('../../../pages/settings/AboutPage/AboutPage').default, + [SCREENS.SETTINGS.APP_DOWNLOAD_LINKS]: () => require('../../../pages/settings/AppDownloadLinks').default, + [SCREENS.SETTINGS.LOUNGE_ACCESS]: () => require('../../../pages/settings/Profile/LoungeAccessPage').default, + [SCREENS.SETTINGS.WALLET]: () => require('../../../pages/settings/Wallet/WalletPage').default, + [SCREENS.SETTINGS.WALLET_CARDS_DIGITAL_DETAILS_UPDATE_ADDRESS]: () => require('../../../pages/settings/Profile/PersonalDetails/AddressPage').default, + [SCREENS.SETTINGS.WALLET_DOMAIN_CARD]: () => require('../../../pages/settings/Wallet/ExpensifyCardPage').default, + [SCREENS.SETTINGS.WALLET_REPORT_VIRTUAL_CARD_FRAUD]: () => require('../../../pages/settings/Wallet/ReportVirtualCardFraudPage').default, + [SCREENS.SETTINGS.WALLET_CARD_ACTIVATE]: () => require('../../../pages/settings/Wallet/ActivatePhysicalCardPage').default, [SCREENS.SETTINGS.WALLET_CARD_GET_PHYSICAL.NAME]: () => require('../../../pages/settings/Wallet/Card/GetPhysicalCardName').default, [SCREENS.SETTINGS.WALLET_CARD_GET_PHYSICAL.PHONE]: () => require('../../../pages/settings/Wallet/Card/GetPhysicalCardPhone').default, [SCREENS.SETTINGS.WALLET_CARD_GET_PHYSICAL.ADDRESS]: () => require('../../../pages/settings/Wallet/Card/GetPhysicalCardAddress').default, [SCREENS.SETTINGS.WALLET_CARD_GET_PHYSICAL.CONFIRM]: () => require('../../../pages/settings/Wallet/Card/GetPhysicalCardConfirm').default, - Settings_Wallet_Transfer_Balance: () => require('../../../pages/settings/Wallet/TransferBalancePage').default, - Settings_Wallet_Choose_Transfer_Account: () => require('../../../pages/settings/Wallet/ChooseTransferAccountPage').default, - Settings_Wallet_EnablePayments: () => require('../../../pages/EnablePayments/EnablePaymentsPage').default, - Settings_Add_Debit_Card: () => require('../../../pages/settings/Wallet/AddDebitCardPage').default, - Settings_Add_Bank_Account: () => require('../../../pages/AddPersonalBankAccountPage').default, + [SCREENS.SETTINGS.WALLET_TRANSFER_BALANCE]: () => require('../../../pages/settings/Wallet/TransferBalancePage').default, + [SCREENS.SETTINGS.WALLET_CHOOSE_TRANSFER_ACCOUNT]: () => require('../../../pages/settings/Wallet/ChooseTransferAccountPage').default, + [SCREENS.SETTINGS.WALLET_ENABLE_PAYMENTS]: () => require('../../../pages/EnablePayments/EnablePaymentsPage').default, + [SCREENS.SETTINGS.ADD_DEBIT_CARD]: () => require('../../../pages/settings/Wallet/AddDebitCardPage').default, + [SCREENS.SETTINGS.ADD_BANK_ACCOUNT]: () => require('../../../pages/AddPersonalBankAccountPage').default, [SCREENS.SETTINGS.STATUS]: () => require('../../../pages/settings/Profile/CustomStatus/StatusPage').default, - Settings_Status_Set: () => require('../../../pages/settings/Profile/CustomStatus/StatusSetPage').default, - Workspace_Initial: () => require('../../../pages/workspace/WorkspaceInitialPage').default, - Workspace_Settings: () => require('../../../pages/workspace/WorkspaceSettingsPage').default, - Workspace_Settings_Currency: () => require('../../../pages/workspace/WorkspaceSettingsCurrencyPage').default, - Workspace_Card: () => require('../../../pages/workspace/card/WorkspaceCardPage').default, - Workspace_Reimburse: () => require('../../../pages/workspace/reimburse/WorkspaceReimbursePage').default, - Workspace_RateAndUnit: () => require('../../../pages/workspace/reimburse/WorkspaceRateAndUnitPage').default, - Workspace_Bills: () => require('../../../pages/workspace/bills/WorkspaceBillsPage').default, - Workspace_Invoices: () => require('../../../pages/workspace/invoices/WorkspaceInvoicesPage').default, - Workspace_Travel: () => require('../../../pages/workspace/travel/WorkspaceTravelPage').default, - Workspace_Members: () => require('../../../pages/workspace/WorkspaceMembersPage').default, - Workspace_Invite: () => require('../../../pages/workspace/WorkspaceInvitePage').default, - Workspace_Invite_Message: () => require('../../../pages/workspace/WorkspaceInviteMessagePage').default, - ReimbursementAccount: () => require('../../../pages/ReimbursementAccount/ReimbursementAccountPage').default, - GetAssistance: () => require('../../../pages/GetAssistancePage').default, - Settings_TwoFactorAuth: () => require('../../../pages/settings/Security/TwoFactorAuth/TwoFactorAuthPage').default, - Settings_ReportCardLostOrDamaged: () => require('../../../pages/settings/Wallet/ReportCardLostPage').default, - KeyboardShortcuts: () => require('../../../pages/KeyboardShortcutsPage').default, + [SCREENS.SETTINGS.STATUS_SET]: () => require('../../../pages/settings/Profile/CustomStatus/StatusSetPage').default, + [SCREENS.WORKSPACE.INITIAL]: () => require('../../../pages/workspace/WorkspaceInitialPage').default, + [SCREENS.WORKSPACE.SETTINGS]: () => require('../../../pages/workspace/WorkspaceSettingsPage').default, + [SCREENS.WORKSPACE.CURRENCY]: () => require('../../../pages/workspace/WorkspaceSettingsCurrencyPage').default, + [SCREENS.WORKSPACE.CARD]: () => require('../../../pages/workspace/card/WorkspaceCardPage').default, + [SCREENS.WORKSPACE.REIMBURSE]: () => require('../../../pages/workspace/reimburse/WorkspaceReimbursePage').default, + [SCREENS.WORKSPACE.RATE_AND_UNIT]: () => require('../../../pages/workspace/reimburse/WorkspaceRateAndUnitPage').default, + [SCREENS.WORKSPACE.BILLS]: () => require('../../../pages/workspace/bills/WorkspaceBillsPage').default, + [SCREENS.WORKSPACE.INVOICES]: () => require('../../../pages/workspace/invoices/WorkspaceInvoicesPage').default, + [SCREENS.WORKSPACE.TRAVEL]: () => require('../../../pages/workspace/travel/WorkspaceTravelPage').default, + [SCREENS.WORKSPACE.MEMBERS]: () => require('../../../pages/workspace/WorkspaceMembersPage').default, + [SCREENS.WORKSPACE.INVITE]: () => require('../../../pages/workspace/WorkspaceInvitePage').default, + [SCREENS.WORKSPACE.INVITE_MESSAGE]: () => require('../../../pages/workspace/WorkspaceInviteMessagePage').default, + [SCREENS.REIMBURSEMENT_ACCOUNT]: () => require('../../../pages/ReimbursementAccount/ReimbursementAccountPage').default, + [SCREENS.GET_ASSISTANCE]: () => require('../../../pages/GetAssistancePage').default, + [SCREENS.SETTINGS.TWO_FACTOR_AUTH]: () => require('../../../pages/settings/Security/TwoFactorAuth/TwoFactorAuthPage').default, + [SCREENS.SETTINGS.REPORT_CARD_LOST_OR_DAMAGED]: () => require('../../../pages/settings/Wallet/ReportCardLostPage').default, + [SCREENS.KEYBOARD_SHORTCUTS]: () => require('../../../pages/KeyboardShortcutsPage').default, }); const EnablePaymentsStackNavigator = createModalStackNavigator({ - EnablePayments_Root: () => require('../../../pages/EnablePayments/EnablePaymentsPage').default, + [SCREENS.ENABLE_PAYMENTS_ROOT]: () => require('../../../pages/EnablePayments/EnablePaymentsPage').default, }); const AddPersonalBankAccountModalStackNavigator = createModalStackNavigator({ - AddPersonalBankAccount_Root: () => require('../../../pages/AddPersonalBankAccountPage').default, + [SCREENS.ADD_PERSONAL_BANK_ACCOUNT_ROOT]: () => require('../../../pages/AddPersonalBankAccountPage').default, }); const ReimbursementAccountModalStackNavigator = createModalStackNavigator({ - ReimbursementAccount_Root: () => require('../../../pages/ReimbursementAccount/ReimbursementAccountPage').default, + [SCREENS.REIMBURSEMENT_ACCOUNT_ROOT]: () => require('../../../pages/ReimbursementAccount/ReimbursementAccountPage').default, }); const WalletStatementStackNavigator = createModalStackNavigator({ - WalletStatement_Root: () => require('../../../pages/wallet/WalletStatementPage').default, + [SCREENS.WALLET_STATEMENT_ROOT]: () => require('../../../pages/wallet/WalletStatementPage').default, }); const FlagCommentStackNavigator = createModalStackNavigator({ - FlagComment_Root: () => require('../../../pages/FlagCommentPage').default, + [SCREENS.FLAG_COMMENT_ROOT]: () => require('../../../pages/FlagCommentPage').default, }); const EditRequestStackNavigator = createModalStackNavigator({ - EditRequest_Root: () => require('../../../pages/EditRequestPage').default, - EditRequest_Currency: () => require('../../../pages/iou/IOUCurrencySelection').default, + [SCREENS.EDIT_REQUEST.ROOT]: () => require('../../../pages/EditRequestPage').default, + [SCREENS.EDIT_REQUEST.CURRENCY]: () => require('../../../pages/iou/IOUCurrencySelection').default, }); const PrivateNotesModalStackNavigator = createModalStackNavigator({ - PrivateNotes_View: () => require('../../../pages/PrivateNotes/PrivateNotesViewPage').default, - PrivateNotes_List: () => require('../../../pages/PrivateNotes/PrivateNotesListPage').default, - PrivateNotes_Edit: () => require('../../../pages/PrivateNotes/PrivateNotesEditPage').default, + [SCREENS.PRIVATE_NOTES.VIEW]: () => require('../../../pages/PrivateNotes/PrivateNotesViewPage').default, + [SCREENS.PRIVATE_NOTES.LIST]: () => require('../../../pages/PrivateNotes/PrivateNotesListPage').default, + [SCREENS.PRIVATE_NOTES.EDIT]: () => require('../../../pages/PrivateNotes/PrivateNotesEditPage').default, }); const SignInModalStackNavigator = createModalStackNavigator({ - SignIn_Root: () => require('../../../pages/signin/SignInModal').default, + [SCREENS.SIGN_IN_ROOT]: () => require('../../../pages/signin/SignInModal').default, }); + const ReferralModalStackNavigator = createModalStackNavigator({ - Referral_Details: () => require('../../../pages/ReferralDetailsPage').default, + [SCREENS.REFERRAL_DETAILS]: () => require('../../../pages/ReferralDetailsPage').default, }); export { From b30090467e00bcdbdfaa4e29febba4f01ee00081 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Mon, 4 Dec 2023 16:32:22 +0100 Subject: [PATCH 24/52] Fix linkingConfig --- src/SCREENS.ts | 2 +- src/libs/Navigation/linkingConfig.ts | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/SCREENS.ts b/src/SCREENS.ts index 59e456310fe2..9b2ba43d841c 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -200,7 +200,7 @@ const SCREENS = { ROOM_MEMBERS_ROOT: 'RoomMembers_Root', ROOM_INVITE_ROOT: 'RoomInvite_Root', SEARCH_ROOT: 'Search_Root', - NEW_CHAT_ROOT: 'NewChat_Root', + NEW_CHAT: {ROOT: 'NewChat_Root', NEW_CHAT: 'chat', NEW_ROOM: 'room'}, FLAG_COMMENT_ROOT: 'FlagComment_Root', REIMBURSEMENT_ACCOUNT: 'ReimbursementAccount', GET_ASSISTANCE: 'GetAssistance', diff --git a/src/libs/Navigation/linkingConfig.ts b/src/libs/Navigation/linkingConfig.ts index add2208a9bf1..62fb06dff72d 100644 --- a/src/libs/Navigation/linkingConfig.ts +++ b/src/libs/Navigation/linkingConfig.ts @@ -121,7 +121,7 @@ const linkingConfig: LinkingOptions = { exact: true, }, [SCREENS.SETTINGS.WALLET_CARDS_DIGITAL_DETAILS_UPDATE_ADDRESS]: { - path: ROUTES.SETTINGS_WALLET_CARDS_DIGITAL_DETAILS_UPDATE_ADDRESS.route, + path: ROUTES.SETTINGS_WALLET_CARD_DIGITAL_DETAILS_UPDATE_ADDRESS.route, exact: true, }, [SCREENS.SETTINGS.ADD_DEBIT_CARD]: { @@ -294,15 +294,15 @@ const linkingConfig: LinkingOptions = { }, [SCREENS.RIGHT_MODAL.NEW_CHAT]: { screens: { - NewChat_Root: { + [SCREENS.NEW_CHAT.ROOT]: { path: ROUTES.NEW, exact: true, screens: { - chat: { + [SCREENS.NEW_CHAT.NEW_CHAT]: { path: ROUTES.NEW_CHAT, exact: true, }, - room: { + [SCREENS.NEW_CHAT.NEW_ROOM]: { path: ROUTES.NEW_ROOM, exact: true, }, @@ -310,7 +310,7 @@ const linkingConfig: LinkingOptions = { }, }, }, - [SCREENS.RIGHT_MODAL.NEW_CHAT]: { + [SCREENS.RIGHT_MODAL.NEW_TASK]: { screens: { [SCREENS.NEW_TASK.ROOT]: ROUTES.NEW_TASK, [SCREENS.NEW_TASK.TASK_ASSIGNEE_SELECTOR]: ROUTES.NEW_TASK_ASSIGNEE, From eab43351194dae8f682b4a5c566c7f9bdd43c5e7 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Mon, 4 Dec 2023 16:49:05 +0100 Subject: [PATCH 25/52] Last fixes in ModalStackNavigators --- src/libs/Navigation/AppNavigator/ModalStackNavigators.js | 2 +- src/libs/Navigation/types.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators.js b/src/libs/Navigation/AppNavigator/ModalStackNavigators.js index 1c8f742e72b5..075e818820f7 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators.js +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators.js @@ -116,7 +116,7 @@ const SearchModalStackNavigator = createModalStackNavigator({ }); const NewChatModalStackNavigator = createModalStackNavigator({ - [SCREENS.NEW_CHAT_ROOT]: () => require('../../../pages/NewChatSelectorPage').default, + [SCREENS.NEW_CHAT.ROOT]: () => require('../../../pages/NewChatSelectorPage').default, }); const NewTaskModalStackNavigator = createModalStackNavigator({ diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index 4e4ade108028..012856f0807d 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -123,7 +123,7 @@ type SettingsNavigatorParamList = { }; type NewChatNavigatorParamList = { - [SCREENS.NEW_CHAT_ROOT]: undefined; + [SCREENS.NEW_CHAT.ROOT]: undefined; }; type SearchNavigatorParamList = { From ca5e2fa949253bf1edc83291aee778509f7dad56 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Mon, 4 Dec 2023 17:07:54 +0100 Subject: [PATCH 26/52] Use constants in Right modal --- .../Navigators/RightModalNavigator.js | 49 ++++++++++--------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.js b/src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.js index c5786a0fcfe4..06d35e9f995d 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.js +++ b/src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.js @@ -7,6 +7,7 @@ import useWindowDimensions from '@hooks/useWindowDimensions'; import * as ModalStackNavigators from '@libs/Navigation/AppNavigator/ModalStackNavigators'; import RHPScreenOptions from '@libs/Navigation/AppNavigator/RHPScreenOptions'; import useThemeStyles from '@styles/useThemeStyles'; +import SCREENS from '@src/SCREENS'; import Overlay from './Overlay'; const Stack = createStackNavigator(); @@ -29,99 +30,99 @@ function RightModalNavigator(props) { From fbc11ca729ffa4676fb3bc8cd110ac3890debff6 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Mon, 4 Dec 2023 17:08:28 +0100 Subject: [PATCH 27/52] Use SCREEN.ts constant in a component --- src/libs/actions/Welcome.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/Welcome.ts b/src/libs/actions/Welcome.ts index 7fd7adeafa96..02109804efb9 100644 --- a/src/libs/actions/Welcome.ts +++ b/src/libs/actions/Welcome.ts @@ -119,7 +119,7 @@ function show({routes, showCreateMenu = () => {}, showPopoverMenu = () => false} // If we are rendering the SidebarScreen at the same time as a workspace route that means we've already created a workspace via workspace/new and should not open the global // create menu right now. We should also stay on the workspace page if that is our destination. const topRoute = routes.length > 0 ? routes[routes.length - 1] : undefined; - const isWorkspaceRoute = topRoute !== undefined && topRoute.name === 'Settings' && topRoute.params?.path.includes('workspace'); + const isWorkspaceRoute = topRoute !== undefined && topRoute.name === SCREENS.RIGHT_MODAL.SETTINGS && topRoute.params?.path.includes('workspace'); const transitionRoute = routes.find((route) => route.name === SCREENS.TRANSITION_BETWEEN_APPS); const exitingToWorkspaceRoute = transitionRoute?.params?.exitTo === 'workspace/new'; const openOnAdminRoom = topRoute?.params?.openOnAdminRoom ?? false; From c257943d8de41f136187e43803d400d46f0f488d Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Mon, 4 Dec 2023 17:19:02 +0100 Subject: [PATCH 28/52] update nav docs --- contributingGuides/NAVIGATION.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/contributingGuides/NAVIGATION.md b/contributingGuides/NAVIGATION.md index 32d3919efbe4..d4e4b81bead0 100644 --- a/contributingGuides/NAVIGATION.md +++ b/contributingGuides/NAVIGATION.md @@ -40,7 +40,17 @@ When creating RHP flows, you have to remember a couple things: An example of adding `Settings_Workspaces` page: -1. Add path to `ROUTES.ts`: https://github.com/Expensify/App/blob/main/src/ROUTES.ts +1. Add the page name to `SCREENS.ts` which will be reused throughout the app (linkingConfig, navigators, etc.): + +```ts +const SCREENS = { + SETTINGS: { + WORKSPACES: 'Settings_Workspaces', + }, +} as const; +``` + +2. Add path to `ROUTES.ts`: https://github.com/Expensify/App/blob/main/src/ROUTES.ts ```ts export const ROUTES = { @@ -55,11 +65,11 @@ export const ROUTES = { ``` -2. Add `Settings_Workspaces` page to proper RHP flow in `linkingConfig.ts`: https://github.com/Expensify/App/blob/3531af22dcadaa94ed11eccf370517dca0b8c305/src/libs/Navigation/linkingConfig.js#L40-L42 +3. Add `Settings_Workspaces` page to proper RHP flow in `linkingConfig.ts`: https://github.com/software-mansion-labs/expensify-app-fork/blob/fbc11ca729ffa4676fb3bc8cd110ac3890debff6/src/libs/Navigation/linkingConfig.ts#L47-L50 -3. Add your page to proper navigator (it should be aligned with where you've put it in the previous step) https://github.com/Expensify/App/blob/3531af22dcadaa94ed11eccf370517dca0b8c305/src/libs/Navigation/AppNavigator/ModalStackNavigators.js#L334-L338 +4. Add your page to proper navigator (it should be aligned with where you've put it in the previous step) https://github.com/software-mansion-labs/expensify-app-fork/blob/fbc11ca729ffa4676fb3bc8cd110ac3890debff6/src/libs/Navigation/AppNavigator/ModalStackNavigators.js#L141 -4. Make sure `HeaderWithBackButton` leads to the previous page in navigation flow of your page: https://github.com/Expensify/App/blob/3531af22dcadaa94ed11eccf370517dca0b8c305/src/pages/workspace/WorkspacesListPage.js#L186 +5. Make sure `HeaderWithBackButton` leads to the previous page in navigation flow of your page: https://github.com/Expensify/App/blob/3531af22dcadaa94ed11eccf370517dca0b8c305/src/pages/workspace/WorkspacesListPage.js#L186 ## Performance solutions From 8341e91daac1792135a2019e71dff21a2acec5d0 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Tue, 5 Dec 2023 14:31:08 +0700 Subject: [PATCH 29/52] rename variable --- src/components/DistanceRequest/index.js | 2 +- src/pages/iou/NewDistanceRequestPage.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/DistanceRequest/index.js b/src/components/DistanceRequest/index.js index 771dc2a997ae..20deac09c721 100644 --- a/src/components/DistanceRequest/index.js +++ b/src/components/DistanceRequest/index.js @@ -39,7 +39,7 @@ const propTypes = { /** Are we editing an existing distance request, or creating a new one? */ isEditingRequest: PropTypes.bool, - /** Are we editing a new distance request */ + /** Are we editing the distance while creating a new distance request */ isEditingNewRequest: PropTypes.bool, /** Called on submit of this page */ diff --git a/src/pages/iou/NewDistanceRequestPage.js b/src/pages/iou/NewDistanceRequestPage.js index 0cf85caefac4..e8479d4700d3 100644 --- a/src/pages/iou/NewDistanceRequestPage.js +++ b/src/pages/iou/NewDistanceRequestPage.js @@ -46,7 +46,7 @@ const defaultProps = { // You can't use Onyx props in the withOnyx mapping, so we need to set up and access the transactionID here, and then pass it down so that DistanceRequest can subscribe to the transaction. function NewDistanceRequestPage({iou, report, route}) { const iouType = lodashGet(route, 'params.iouType', 'request'); - const isEditing = Navigation.getActiveRoute().includes('address'); + const isEditingNewRequest = Navigation.getActiveRoute().includes('address'); useEffect(() => { if (iou.transactionID) { @@ -56,12 +56,12 @@ function NewDistanceRequestPage({iou, report, route}) { }, [iou.transactionID]); const onSubmit = useCallback(() => { - if (isEditing) { + if (isEditingNewRequest) { Navigation.goBack(ROUTES.MONEY_REQUEST_CONFIRMATION.getRoute(iouType, report.reportID)); return; } IOU.navigateToNextPage(iou, iouType, report); - }, [iou, iouType, isEditing, report]); + }, [iou, iouType, isEditingNewRequest, report]); return ( Date: Tue, 5 Dec 2023 14:44:32 +0700 Subject: [PATCH 30/52] fix lint --- src/pages/iou/NewDistanceRequestPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/iou/NewDistanceRequestPage.js b/src/pages/iou/NewDistanceRequestPage.js index e8479d4700d3..750ac5d0141e 100644 --- a/src/pages/iou/NewDistanceRequestPage.js +++ b/src/pages/iou/NewDistanceRequestPage.js @@ -67,7 +67,7 @@ function NewDistanceRequestPage({iou, report, route}) { From 9fb1085b2b7d23c43cc2e1d134dcfe23179526a7 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 5 Dec 2023 13:55:43 +0100 Subject: [PATCH 31/52] Modify links to og repo --- contributingGuides/NAVIGATION.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contributingGuides/NAVIGATION.md b/contributingGuides/NAVIGATION.md index d4e4b81bead0..c76a46ab8c06 100644 --- a/contributingGuides/NAVIGATION.md +++ b/contributingGuides/NAVIGATION.md @@ -65,9 +65,9 @@ export const ROUTES = { ``` -3. Add `Settings_Workspaces` page to proper RHP flow in `linkingConfig.ts`: https://github.com/software-mansion-labs/expensify-app-fork/blob/fbc11ca729ffa4676fb3bc8cd110ac3890debff6/src/libs/Navigation/linkingConfig.ts#L47-L50 +3. Add `Settings_Workspaces` page to proper RHP flow in `linkingConfig.ts`: https://github.com/Expensify/App/blob/fbc11ca729ffa4676fb3bc8cd110ac3890debff6/src/libs/Navigation/linkingConfig.ts#L47-L50 -4. Add your page to proper navigator (it should be aligned with where you've put it in the previous step) https://github.com/software-mansion-labs/expensify-app-fork/blob/fbc11ca729ffa4676fb3bc8cd110ac3890debff6/src/libs/Navigation/AppNavigator/ModalStackNavigators.js#L141 +4. Add your page to proper navigator (it should be aligned with where you've put it in the previous step) https://github.com/Expensify/App/blob/fbc11ca729ffa4676fb3bc8cd110ac3890debff6/src/libs/Navigation/AppNavigator/ModalStackNavigators.js#L141 5. Make sure `HeaderWithBackButton` leads to the previous page in navigation flow of your page: https://github.com/Expensify/App/blob/3531af22dcadaa94ed11eccf370517dca0b8c305/src/pages/workspace/WorkspacesListPage.js#L186 From 17f59baf4cb0b3b46ca18b6e5685418e9763fe90 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 5 Dec 2023 14:07:31 +0100 Subject: [PATCH 32/52] Add OnyxEntry to functions, adjust ?? to || --- src/libs/DistanceRequestUtils.ts | 6 ++++-- src/libs/HeaderUtils.ts | 3 ++- src/libs/NextStepUtils.ts | 5 +++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/libs/DistanceRequestUtils.ts b/src/libs/DistanceRequestUtils.ts index 682567c4c6ba..477bfb4b61f9 100644 --- a/src/libs/DistanceRequestUtils.ts +++ b/src/libs/DistanceRequestUtils.ts @@ -1,3 +1,4 @@ +import {OnyxEntry} from 'react-native-onyx'; import type {LocaleContextProps} from '@components/LocaleContextProvider'; import CONST from '@src/CONST'; import Policy, {Unit} from '@src/types/onyx/Policy'; @@ -20,7 +21,7 @@ type DefaultMileageRate = { * @returns [currency] - The currency associated with the rate. * @returns [unit] - The unit of measurement for the distance. */ -function getDefaultMileageRate(policy: Policy): DefaultMileageRate | null { +function getDefaultMileageRate(policy: OnyxEntry): DefaultMileageRate | null { if (!policy?.customUnits) { return null; } @@ -99,7 +100,8 @@ function getDistanceMerchant( const singularDistanceUnit = unit === CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES ? translate('common.mile') : translate('common.kilometer'); const unitString = distanceInUnits === '1' ? singularDistanceUnit : distanceUnit; const ratePerUnit = rate ? PolicyUtils.getUnitRateValue({rate}, toLocaleDigit) : translate('common.tbd'); - const currencySymbol = rate ? CurrencyUtils.getCurrencySymbol(currency) ?? `${currency} ` : ''; + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + const currencySymbol = rate ? CurrencyUtils.getCurrencySymbol(currency) || `${currency} ` : ''; return `${distanceInUnits} ${unitString} @ ${currencySymbol}${ratePerUnit} / ${singularDistanceUnit}`; } diff --git a/src/libs/HeaderUtils.ts b/src/libs/HeaderUtils.ts index f7779b6db52f..c8dfc20df204 100644 --- a/src/libs/HeaderUtils.ts +++ b/src/libs/HeaderUtils.ts @@ -1,3 +1,4 @@ +import {OnyxEntry} from 'react-native-onyx'; import {SvgProps} from 'react-native-svg'; import * as Expensicons from '@components/Icon/Expensicons'; import OnyxReport from '@src/types/onyx/Report'; @@ -11,7 +12,7 @@ type MenuItem = { onSelected: () => void; }; -function getPinMenuItem(report: OnyxReport): MenuItem { +function getPinMenuItem(report: OnyxEntry): MenuItem { const isPinned = report?.isPinned; if (!isPinned) { return { diff --git a/src/libs/NextStepUtils.ts b/src/libs/NextStepUtils.ts index 1d99da633a4e..538e8dbe81f0 100644 --- a/src/libs/NextStepUtils.ts +++ b/src/libs/NextStepUtils.ts @@ -5,11 +5,12 @@ type Message = { type?: string; }; -function parseMessage(messages: Message[]) { +function parseMessage(messages: Message[] | undefined) { let nextStepHTML = ''; messages?.forEach((part) => { - const tagType = part.type ?? 'span'; + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + const tagType = part.type || 'span'; nextStepHTML += `<${tagType}>${Str.safeEscape(part.text)}`; }); From 688dec676aeda7f4e9a3b18ff8aca2a251e4d34d Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 5 Dec 2023 14:10:19 +0100 Subject: [PATCH 33/52] Rename '@libs/UpdateMultilineInputRange' --- .../index.ios.ts | 0 .../index.ts | 0 .../types.ts | 0 src/pages/EditRequestDescriptionPage.js | 2 +- src/pages/PrivateNotes/PrivateNotesEditPage.js | 2 +- src/pages/ReportWelcomeMessagePage.js | 2 +- .../ComposerWithSuggestions/ComposerWithSuggestions.js | 2 +- src/pages/iou/MoneyRequestDescriptionPage.js | 2 +- src/pages/tasks/NewTaskDescriptionPage.js | 2 +- src/pages/tasks/TaskDescriptionPage.js | 2 +- 10 files changed, 7 insertions(+), 7 deletions(-) rename src/libs/{UpdateMultilineInputRange => updateMultilineInputRange}/index.ios.ts (100%) rename src/libs/{UpdateMultilineInputRange => updateMultilineInputRange}/index.ts (100%) rename src/libs/{UpdateMultilineInputRange => updateMultilineInputRange}/types.ts (100%) diff --git a/src/libs/UpdateMultilineInputRange/index.ios.ts b/src/libs/updateMultilineInputRange/index.ios.ts similarity index 100% rename from src/libs/UpdateMultilineInputRange/index.ios.ts rename to src/libs/updateMultilineInputRange/index.ios.ts diff --git a/src/libs/UpdateMultilineInputRange/index.ts b/src/libs/updateMultilineInputRange/index.ts similarity index 100% rename from src/libs/UpdateMultilineInputRange/index.ts rename to src/libs/updateMultilineInputRange/index.ts diff --git a/src/libs/UpdateMultilineInputRange/types.ts b/src/libs/updateMultilineInputRange/types.ts similarity index 100% rename from src/libs/UpdateMultilineInputRange/types.ts rename to src/libs/updateMultilineInputRange/types.ts diff --git a/src/pages/EditRequestDescriptionPage.js b/src/pages/EditRequestDescriptionPage.js index f6779ac83ead..1f60be85ce94 100644 --- a/src/pages/EditRequestDescriptionPage.js +++ b/src/pages/EditRequestDescriptionPage.js @@ -9,7 +9,7 @@ import ScreenWrapper from '@components/ScreenWrapper'; import TextInput from '@components/TextInput'; import useLocalize from '@hooks/useLocalize'; import * as Browser from '@libs/Browser'; -import updateMultilineInputRange from '@libs/UpdateMultilineInputRange'; +import updateMultilineInputRange from '@libs/updateMultilineInputRange'; import useThemeStyles from '@styles/useThemeStyles'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; diff --git a/src/pages/PrivateNotes/PrivateNotesEditPage.js b/src/pages/PrivateNotes/PrivateNotesEditPage.js index 2c3064d199ef..dce572c7dd6c 100644 --- a/src/pages/PrivateNotes/PrivateNotesEditPage.js +++ b/src/pages/PrivateNotes/PrivateNotesEditPage.js @@ -19,7 +19,7 @@ import useLocalize from '@hooks/useLocalize'; import compose from '@libs/compose'; import Navigation from '@libs/Navigation/Navigation'; import * as ReportUtils from '@libs/ReportUtils'; -import updateMultilineInputRange from '@libs/UpdateMultilineInputRange'; +import updateMultilineInputRange from '@libs/updateMultilineInputRange'; import withReportAndPrivateNotesOrNotFound from '@pages/home/report/withReportAndPrivateNotesOrNotFound'; import personalDetailsPropType from '@pages/personalDetailsPropType'; import reportPropTypes from '@pages/reportPropTypes'; diff --git a/src/pages/ReportWelcomeMessagePage.js b/src/pages/ReportWelcomeMessagePage.js index a0e471d00df6..17329139c63f 100644 --- a/src/pages/ReportWelcomeMessagePage.js +++ b/src/pages/ReportWelcomeMessagePage.js @@ -14,7 +14,7 @@ import withLocalize, {withLocalizePropTypes} from '@components/withLocalize'; import compose from '@libs/compose'; import Navigation from '@libs/Navigation/Navigation'; import * as ReportUtils from '@libs/ReportUtils'; -import updateMultilineInputRange from '@libs/UpdateMultilineInputRange'; +import updateMultilineInputRange from '@libs/updateMultilineInputRange'; import useThemeStyles from '@styles/useThemeStyles'; import * as Report from '@userActions/Report'; import CONST from '@src/CONST'; diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.js b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.js index ea48f9cc931e..ba50f5503aff 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.js +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.js @@ -22,7 +22,7 @@ import ReportActionComposeFocusManager from '@libs/ReportActionComposeFocusManag import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; import * as SuggestionUtils from '@libs/SuggestionUtils'; -import updateMultilineInputRange from '@libs/UpdateMultilineInputRange'; +import updateMultilineInputRange from '@libs/updateMultilineInputRange'; import willBlurTextInputOnTapOutsideFunc from '@libs/willBlurTextInputOnTapOutside'; import SilentCommentUpdater from '@pages/home/report/ReportActionCompose/SilentCommentUpdater'; import Suggestions from '@pages/home/report/ReportActionCompose/Suggestions'; diff --git a/src/pages/iou/MoneyRequestDescriptionPage.js b/src/pages/iou/MoneyRequestDescriptionPage.js index 43d7b58bfc7f..3937de006d8d 100644 --- a/src/pages/iou/MoneyRequestDescriptionPage.js +++ b/src/pages/iou/MoneyRequestDescriptionPage.js @@ -15,7 +15,7 @@ import * as IOU from '@libs/actions/IOU'; import * as Browser from '@libs/Browser'; import * as MoneyRequestUtils from '@libs/MoneyRequestUtils'; import Navigation from '@libs/Navigation/Navigation'; -import updateMultilineInputRange from '@libs/UpdateMultilineInputRange'; +import updateMultilineInputRange from '@libs/updateMultilineInputRange'; import useThemeStyles from '@styles/useThemeStyles'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; diff --git a/src/pages/tasks/NewTaskDescriptionPage.js b/src/pages/tasks/NewTaskDescriptionPage.js index 002ca2944e52..09ecbc6284e6 100644 --- a/src/pages/tasks/NewTaskDescriptionPage.js +++ b/src/pages/tasks/NewTaskDescriptionPage.js @@ -13,7 +13,7 @@ import useAutoFocusInput from '@hooks/useAutoFocusInput'; import * as Browser from '@libs/Browser'; import compose from '@libs/compose'; import Navigation from '@libs/Navigation/Navigation'; -import updateMultilineInputRange from '@libs/UpdateMultilineInputRange'; +import updateMultilineInputRange from '@libs/updateMultilineInputRange'; import useThemeStyles from '@styles/useThemeStyles'; import * as Task from '@userActions/Task'; import CONST from '@src/CONST'; diff --git a/src/pages/tasks/TaskDescriptionPage.js b/src/pages/tasks/TaskDescriptionPage.js index 6901f2562ee3..93d8828ff662 100644 --- a/src/pages/tasks/TaskDescriptionPage.js +++ b/src/pages/tasks/TaskDescriptionPage.js @@ -16,7 +16,7 @@ import compose from '@libs/compose'; import Navigation from '@libs/Navigation/Navigation'; import * as ReportUtils from '@libs/ReportUtils'; import StringUtils from '@libs/StringUtils'; -import updateMultilineInputRange from '@libs/UpdateMultilineInputRange'; +import updateMultilineInputRange from '@libs/updateMultilineInputRange'; import withReportOrNotFound from '@pages/home/report/withReportOrNotFound'; import reportPropTypes from '@pages/reportPropTypes'; import useThemeStyles from '@styles/useThemeStyles'; From 30d6aadc7abb3413d10a0c6bed7ab4a02b435a44 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 5 Dec 2023 14:21:29 +0100 Subject: [PATCH 34/52] Fix getPinMenuItem logic and typecheck failing --- src/libs/HeaderUtils.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/libs/HeaderUtils.ts b/src/libs/HeaderUtils.ts index c8dfc20df204..d258cecb3d11 100644 --- a/src/libs/HeaderUtils.ts +++ b/src/libs/HeaderUtils.ts @@ -12,18 +12,16 @@ type MenuItem = { onSelected: () => void; }; -function getPinMenuItem(report: OnyxEntry): MenuItem { - const isPinned = report?.isPinned; - if (!isPinned) { - return { - icon: Expensicons.Pin, - text: Localize.translateLocal('common.pin'), - onSelected: Session.checkIfActionIsAllowed(() => Report.togglePinnedState(report.reportID, !!isPinned)), - }; +function getPinMenuItem(report: OnyxEntry): MenuItem | undefined { + if (!report) { + return; } + + const isPinned = !!report?.isPinned; + return { icon: Expensicons.Pin, - text: Localize.translateLocal('common.unPin'), + text: Localize.translateLocal(isPinned ? 'common.pin' : 'common.unPin'), onSelected: Session.checkIfActionIsAllowed(() => Report.togglePinnedState(report.reportID, isPinned)), }; } From baff909425d1e52a62b10dc6604b451ac2d0a4e2 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 5 Dec 2023 14:26:43 +0100 Subject: [PATCH 35/52] Remove optional chaining --- src/libs/HeaderUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/HeaderUtils.ts b/src/libs/HeaderUtils.ts index d258cecb3d11..57c7bc22a31e 100644 --- a/src/libs/HeaderUtils.ts +++ b/src/libs/HeaderUtils.ts @@ -17,7 +17,7 @@ function getPinMenuItem(report: OnyxEntry): MenuItem | undefined { return; } - const isPinned = !!report?.isPinned; + const isPinned = !!report.isPinned; return { icon: Expensicons.Pin, From c106a013fcc2db3aba1c3f11a89405c44dd0733b Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 7 Dec 2023 10:00:55 +0100 Subject: [PATCH 36/52] Fix pin menu --- src/libs/HeaderUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/HeaderUtils.ts b/src/libs/HeaderUtils.ts index 57c7bc22a31e..6ef8445f707b 100644 --- a/src/libs/HeaderUtils.ts +++ b/src/libs/HeaderUtils.ts @@ -21,7 +21,7 @@ function getPinMenuItem(report: OnyxEntry): MenuItem | undefined { return { icon: Expensicons.Pin, - text: Localize.translateLocal(isPinned ? 'common.pin' : 'common.unPin'), + text: Localize.translateLocal(isPinned ? 'common.unPin' : 'common.pin'), onSelected: Session.checkIfActionIsAllowed(() => Report.togglePinnedState(report.reportID, isPinned)), }; } From 7f308b8642842b88c4ca4eb86a4adecbe8f59030 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 7 Dec 2023 11:06:56 +0100 Subject: [PATCH 37/52] Extract WALLET screens --- src/SCREENS.ts | 46 +++++++++++-------- .../AppNavigator/ModalStackNavigators.tsx | 24 +++++----- src/libs/Navigation/linkingConfig.ts | 24 +++++----- src/libs/Navigation/types.ts | 24 +++++----- src/pages/settings/Wallet/WalletEmptyState.js | 2 +- src/styles/themes/default.ts | 2 +- src/styles/themes/light.ts | 2 +- 7 files changed, 67 insertions(+), 57 deletions(-) diff --git a/src/SCREENS.ts b/src/SCREENS.ts index 3ad23aae627e..74f88c96e91d 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -19,11 +19,37 @@ const SCREENS = { UNLINK_LOGIN: 'UnlinkLogin', SETTINGS: { ROOT: 'Settings_Root', - PREFERENCES: 'Settings_Preferences', + + SHARE_CODE: 'Settings_Share_Code', + WORKSPACES: 'Settings_Workspaces', + + PROFILE: 'Settings_Profile', + + PREFERENCES: 'Settings_Preferences', + SECURITY: 'Settings_Security', + + WALLET: { + ROOT: 'Settings_Wallet', + DOMAIN_CARD: 'Settings_Wallet_DomainCard', + CARD_GET_PHYSICAL: { + NAME: 'Settings_Card_Get_Physical_Name', + PHONE: 'Settings_Card_Get_Physical_Phone', + ADDRESS: 'Settings_Card_Get_Physical_Address', + CONFIRM: 'Settings_Card_Get_Physical_Confirm', + }, + TRANSFER_BALANCE: 'Settings_Wallet_Transfer_Balance', + CHOOSE_TRANSFER_ACCOUNT: 'Settings_Wallet_Choose_Transfer_Account', + ENABLE_PAYMENTS: 'Settings_Wallet_EnablePayments', + CARD_ACTIVATE: 'Settings_Wallet_Card_Activate', + REPORT_VIRTUAL_CARD_FRAUD: 'Settings_Wallet_ReportVirtualCardFraud', + CARDS_DIGITAL_DETAILS_UPDATE_ADDRESS: 'Settings_Wallet_Cards_Digital_Details_Update_Address', + }, + + ABOUT: 'Settings_About', + STATUS: 'Settings_Status', - PROFILE: 'Settings_Profile', PRONOUNS: 'Settings_Pronouns', DISPLAY_NAME: 'Settings_Display_Name', TIMEZONE: 'Settings_Timezone', @@ -36,24 +62,8 @@ const SCREENS = { CONTACT_METHODS: 'Settings_ContactMethods', CONTACT_METHOD_DETAILS: 'Settings_ContactMethodDetails', NEW_CONTACT_METHOD: 'Settings_NewContactMethod', - SHARE_CODE: 'Settings_Share_Code', - ABOUT: 'Settings_About', APP_DOWNLOAD_LINKS: 'Settings_App_Download_Links', LOUNGE_ACCESS: 'Settings_Lounge_Access', - WALLET: 'Settings_Wallet', - WALLET_DOMAIN_CARD: 'Settings_Wallet_DomainCard', - WALLET_CARD_GET_PHYSICAL: { - NAME: 'Settings_Card_Get_Physical_Name', - PHONE: 'Settings_Card_Get_Physical_Phone', - ADDRESS: 'Settings_Card_Get_Physical_Address', - CONFIRM: 'Settings_Card_Get_Physical_Confirm', - }, - WALLET_TRANSFER_BALANCE: 'Settings_Wallet_Transfer_Balance', - WALLET_CHOOSE_TRANSFER_ACCOUNT: 'Settings_Wallet_Choose_Transfer_Account', - WALLET_ENABLE_PAYMENTS: 'Settings_Wallet_EnablePayments', - WALLET_CARD_ACTIVATE: 'Settings_Wallet_Card_Activate', - WALLET_REPORT_VIRTUAL_CARD_FRAUD: 'Settings_Wallet_ReportVirtualCardFraud', - WALLET_CARDS_DIGITAL_DETAILS_UPDATE_ADDRESS: 'Settings_Wallet_Cards_Digital_Details_Update_Address', ADD_DEBIT_CARD: 'Settings_Add_Debit_Card', ADD_BANK_ACCOUNT: 'Settings_Add_Bank_Account', PREFERENCES_PRIORITY_MODE: 'Settings_Preferences_PriorityMode', diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators.tsx index 163423036362..c04a0989b636 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators.tsx @@ -191,18 +191,18 @@ const SettingsModalStackNavigator = createModalStackNavigator require('../../../pages/settings/AboutPage/AboutPage').default as React.ComponentType, [SCREENS.SETTINGS.APP_DOWNLOAD_LINKS]: () => require('../../../pages/settings/AppDownloadLinks').default as React.ComponentType, [SCREENS.SETTINGS.LOUNGE_ACCESS]: () => require('../../../pages/settings/Profile/LoungeAccessPage').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET]: () => require('../../../pages/settings/Wallet/WalletPage').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET_CARDS_DIGITAL_DETAILS_UPDATE_ADDRESS]: () => require('../../../pages/settings/Profile/PersonalDetails/AddressPage').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET_DOMAIN_CARD]: () => require('../../../pages/settings/Wallet/ExpensifyCardPage').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET_REPORT_VIRTUAL_CARD_FRAUD]: () => require('../../../pages/settings/Wallet/ReportVirtualCardFraudPage').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET_CARD_ACTIVATE]: () => require('../../../pages/settings/Wallet/ActivatePhysicalCardPage').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET_CARD_GET_PHYSICAL.NAME]: () => require('../../../pages/settings/Wallet/Card/GetPhysicalCardName').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET_CARD_GET_PHYSICAL.PHONE]: () => require('../../../pages/settings/Wallet/Card/GetPhysicalCardPhone').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET_CARD_GET_PHYSICAL.ADDRESS]: () => require('../../../pages/settings/Wallet/Card/GetPhysicalCardAddress').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET_CARD_GET_PHYSICAL.CONFIRM]: () => require('../../../pages/settings/Wallet/Card/GetPhysicalCardConfirm').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET_TRANSFER_BALANCE]: () => require('../../../pages/settings/Wallet/TransferBalancePage').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET_CHOOSE_TRANSFER_ACCOUNT]: () => require('../../../pages/settings/Wallet/ChooseTransferAccountPage').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET_ENABLE_PAYMENTS]: () => require('../../../pages/EnablePayments/EnablePaymentsPage').default as React.ComponentType, + [SCREENS.SETTINGS.WALLET.ROOT]: () => require('../../../pages/settings/Wallet/WalletPage').default as React.ComponentType, + [SCREENS.SETTINGS.WALLET.CARDS_DIGITAL_DETAILS_UPDATE_ADDRESS]: () => require('../../../pages/settings/Profile/PersonalDetails/AddressPage').default as React.ComponentType, + [SCREENS.SETTINGS.WALLET.DOMAIN_CARD]: () => require('../../../pages/settings/Wallet/ExpensifyCardPage').default as React.ComponentType, + [SCREENS.SETTINGS.WALLET.REPORT_VIRTUAL_CARD_FRAUD]: () => require('../../../pages/settings/Wallet/ReportVirtualCardFraudPage').default as React.ComponentType, + [SCREENS.SETTINGS.WALLET.CARD_ACTIVATE]: () => require('../../../pages/settings/Wallet/ActivatePhysicalCardPage').default as React.ComponentType, + [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.NAME]: () => require('../../../pages/settings/Wallet/Card/GetPhysicalCardName').default as React.ComponentType, + [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.PHONE]: () => require('../../../pages/settings/Wallet/Card/GetPhysicalCardPhone').default as React.ComponentType, + [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.ADDRESS]: () => require('../../../pages/settings/Wallet/Card/GetPhysicalCardAddress').default as React.ComponentType, + [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.CONFIRM]: () => require('../../../pages/settings/Wallet/Card/GetPhysicalCardConfirm').default as React.ComponentType, + [SCREENS.SETTINGS.WALLET.TRANSFER_BALANCE]: () => require('../../../pages/settings/Wallet/TransferBalancePage').default as React.ComponentType, + [SCREENS.SETTINGS.WALLET.CHOOSE_TRANSFER_ACCOUNT]: () => require('../../../pages/settings/Wallet/ChooseTransferAccountPage').default as React.ComponentType, + [SCREENS.SETTINGS.WALLET.ENABLE_PAYMENTS]: () => require('../../../pages/EnablePayments/EnablePaymentsPage').default as React.ComponentType, [SCREENS.SETTINGS.ADD_DEBIT_CARD]: () => require('../../../pages/settings/Wallet/AddDebitCardPage').default as React.ComponentType, [SCREENS.SETTINGS.ADD_BANK_ACCOUNT]: () => require('../../../pages/AddPersonalBankAccountPage').default as React.ComponentType, [SCREENS.SETTINGS.STATUS]: () => require('../../../pages/settings/Profile/CustomStatus/StatusPage').default as React.ComponentType, diff --git a/src/libs/Navigation/linkingConfig.ts b/src/libs/Navigation/linkingConfig.ts index 62fb06dff72d..e9f3a9f488ae 100644 --- a/src/libs/Navigation/linkingConfig.ts +++ b/src/libs/Navigation/linkingConfig.ts @@ -72,43 +72,43 @@ const linkingConfig: LinkingOptions = { path: ROUTES.SETTINGS_SECURITY, exact: true, }, - [SCREENS.SETTINGS.WALLET]: { + [SCREENS.SETTINGS.WALLET.ROOT]: { path: ROUTES.SETTINGS_WALLET, exact: true, }, - [SCREENS.SETTINGS.WALLET_DOMAIN_CARD]: { + [SCREENS.SETTINGS.WALLET.DOMAIN_CARD]: { path: ROUTES.SETTINGS_WALLET_DOMAINCARD.route, exact: true, }, - [SCREENS.SETTINGS.WALLET_REPORT_VIRTUAL_CARD_FRAUD]: { + [SCREENS.SETTINGS.WALLET.REPORT_VIRTUAL_CARD_FRAUD]: { path: ROUTES.SETTINGS_REPORT_FRAUD.route, exact: true, }, - [SCREENS.SETTINGS.WALLET_CARD_GET_PHYSICAL.NAME]: { + [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.NAME]: { path: ROUTES.SETTINGS_WALLET_CARD_GET_PHYSICAL_NAME.route, exact: true, }, - [SCREENS.SETTINGS.WALLET_CARD_GET_PHYSICAL.PHONE]: { + [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.PHONE]: { path: ROUTES.SETTINGS_WALLET_CARD_GET_PHYSICAL_PHONE.route, exact: true, }, - [SCREENS.SETTINGS.WALLET_CARD_GET_PHYSICAL.ADDRESS]: { + [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.ADDRESS]: { path: ROUTES.SETTINGS_WALLET_CARD_GET_PHYSICAL_ADDRESS.route, exact: true, }, - [SCREENS.SETTINGS.WALLET_CARD_GET_PHYSICAL.CONFIRM]: { + [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.CONFIRM]: { path: ROUTES.SETTINGS_WALLET_CARD_GET_PHYSICAL_CONFIRM.route, exact: true, }, - [SCREENS.SETTINGS.WALLET_ENABLE_PAYMENTS]: { + [SCREENS.SETTINGS.WALLET.ENABLE_PAYMENTS]: { path: ROUTES.SETTINGS_ENABLE_PAYMENTS, exact: true, }, - [SCREENS.SETTINGS.WALLET_TRANSFER_BALANCE]: { + [SCREENS.SETTINGS.WALLET.TRANSFER_BALANCE]: { path: ROUTES.SETTINGS_WALLET_TRANSFER_BALANCE, exact: true, }, - [SCREENS.SETTINGS.WALLET_CHOOSE_TRANSFER_ACCOUNT]: { + [SCREENS.SETTINGS.WALLET.CHOOSE_TRANSFER_ACCOUNT]: { path: ROUTES.SETTINGS_WALLET_CHOOSE_TRANSFER_ACCOUNT, exact: true, }, @@ -116,11 +116,11 @@ const linkingConfig: LinkingOptions = { path: ROUTES.SETTINGS_WALLET_REPORT_CARD_LOST_OR_DAMAGED.route, exact: true, }, - [SCREENS.SETTINGS.WALLET_CARD_ACTIVATE]: { + [SCREENS.SETTINGS.WALLET.CARD_ACTIVATE]: { path: ROUTES.SETTINGS_WALLET_CARD_ACTIVATE.route, exact: true, }, - [SCREENS.SETTINGS.WALLET_CARDS_DIGITAL_DETAILS_UPDATE_ADDRESS]: { + [SCREENS.SETTINGS.WALLET.CARDS_DIGITAL_DETAILS_UPDATE_ADDRESS]: { path: ROUTES.SETTINGS_WALLET_CARD_DIGITAL_DETAILS_UPDATE_ADDRESS.route, exact: true, }, diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index d48e14083c4c..4f29308a8f0e 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -67,18 +67,18 @@ type SettingsNavigatorParamList = { [SCREENS.SETTINGS.ABOUT]: undefined; [SCREENS.SETTINGS.APP_DOWNLOAD_LINKS]: undefined; [SCREENS.SETTINGS.LOUNGE_ACCESS]: undefined; - [SCREENS.SETTINGS.WALLET]: undefined; - [SCREENS.SETTINGS.WALLET_CARDS_DIGITAL_DETAILS_UPDATE_ADDRESS]: undefined; - [SCREENS.SETTINGS.WALLET_DOMAIN_CARD]: undefined; - [SCREENS.SETTINGS.WALLET_REPORT_VIRTUAL_CARD_FRAUD]: undefined; - [SCREENS.SETTINGS.WALLET_CARD_ACTIVATE]: undefined; - [SCREENS.SETTINGS.WALLET_CARD_GET_PHYSICAL.NAME]: undefined; - [SCREENS.SETTINGS.WALLET_CARD_GET_PHYSICAL.PHONE]: undefined; - [SCREENS.SETTINGS.WALLET_CARD_GET_PHYSICAL.ADDRESS]: undefined; - [SCREENS.SETTINGS.WALLET_CARD_GET_PHYSICAL.CONFIRM]: undefined; - [SCREENS.SETTINGS.WALLET_TRANSFER_BALANCE]: undefined; - [SCREENS.SETTINGS.WALLET_CHOOSE_TRANSFER_ACCOUNT]: undefined; - [SCREENS.SETTINGS.WALLET_ENABLE_PAYMENTS]: undefined; + [SCREENS.SETTINGS.WALLET.ROOT]: undefined; + [SCREENS.SETTINGS.WALLET.CARDS_DIGITAL_DETAILS_UPDATE_ADDRESS]: undefined; + [SCREENS.SETTINGS.WALLET.DOMAIN_CARD]: undefined; + [SCREENS.SETTINGS.WALLET.REPORT_VIRTUAL_CARD_FRAUD]: undefined; + [SCREENS.SETTINGS.WALLET.CARD_ACTIVATE]: undefined; + [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.NAME]: undefined; + [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.PHONE]: undefined; + [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.ADDRESS]: undefined; + [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.CONFIRM]: undefined; + [SCREENS.SETTINGS.WALLET.TRANSFER_BALANCE]: undefined; + [SCREENS.SETTINGS.WALLET.CHOOSE_TRANSFER_ACCOUNT]: undefined; + [SCREENS.SETTINGS.WALLET.ENABLE_PAYMENTS]: undefined; [SCREENS.SETTINGS.ADD_DEBIT_CARD]: undefined; [SCREENS.SETTINGS.ADD_BANK_ACCOUNT]: undefined; [SCREENS.SETTINGS.STATUS]: undefined; diff --git a/src/pages/settings/Wallet/WalletEmptyState.js b/src/pages/settings/Wallet/WalletEmptyState.js index f2235dfafef2..f4609bdc8534 100644 --- a/src/pages/settings/Wallet/WalletEmptyState.js +++ b/src/pages/settings/Wallet/WalletEmptyState.js @@ -36,7 +36,7 @@ function WalletEmptyState({onAddPaymentMethod}) { const {translate} = useLocalize(); return ( Navigation.goBack(ROUTES.SETTINGS)} title={translate('common.wallet')} diff --git a/src/styles/themes/default.ts b/src/styles/themes/default.ts index 59de9b7269a8..97dd0469fcea 100644 --- a/src/styles/themes/default.ts +++ b/src/styles/themes/default.ts @@ -111,7 +111,7 @@ const darkTheme = { backgroundColor: colors.pink800, statusBarStyle: CONST.STATUS_BAR_STYLE.LIGHT_CONTENT, }, - [SCREENS.SETTINGS.WALLET]: { + [SCREENS.SETTINGS.WALLET.ROOT]: { backgroundColor: colors.darkAppBackground, statusBarStyle: CONST.STATUS_BAR_STYLE.LIGHT_CONTENT, }, diff --git a/src/styles/themes/light.ts b/src/styles/themes/light.ts index 1541c0e723d7..4f40c3fa274d 100644 --- a/src/styles/themes/light.ts +++ b/src/styles/themes/light.ts @@ -111,7 +111,7 @@ const lightTheme = { backgroundColor: colors.pink800, statusBarStyle: CONST.STATUS_BAR_STYLE.LIGHT_CONTENT, }, - [SCREENS.SETTINGS.WALLET]: { + [SCREENS.SETTINGS.WALLET.ROOT]: { backgroundColor: colors.darkAppBackground, statusBarStyle: CONST.STATUS_BAR_STYLE.LIGHT_CONTENT, }, From b34f8e1badeb862080798fcf51cdded8dc3a6b43 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 7 Dec 2023 11:10:56 +0100 Subject: [PATCH 38/52] Reorder SCREENS --- src/SCREENS.ts | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/SCREENS.ts b/src/SCREENS.ts index 74f88c96e91d..f8ad8e277cd5 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -25,8 +25,26 @@ const SCREENS = { WORKSPACES: 'Settings_Workspaces', PROFILE: 'Settings_Profile', + DISPLAY_NAME: 'Settings_Display_Name', + CONTACT_METHODS: 'Settings_ContactMethods', + CONTACT_METHOD_DETAILS: 'Settings_ContactMethodDetails', + NEW_CONTACT_METHOD: 'Settings_NewContactMethod', + STATUS: 'Settings_Status', + STATUS_SET: 'Settings_Status_Set', + PRONOUNS: 'Settings_Pronouns', + TIMEZONE: 'Settings_Timezone', + TIMEZONE_SELECT: 'Settings_Timezone_Select', + + PERSONAL_DETAILS_INITIAL: 'Settings_PersonalDetails_Initial', + PERSONAL_DETAILS_LEGAL_NAME: 'Settings_PersonalDetails_LegalName', + PERSONAL_DETAILS_DATE_OF_BIRTH: 'Settings_PersonalDetails_DateOfBirth', + PERSONAL_DETAILS_ADDRESS: 'Settings_PersonalDetails_Address', + PERSONAL_DETAILS_ADDRESS_COUNTRY: 'Settings_PersonalDetails_Address_Country', PREFERENCES: 'Settings_Preferences', + PREFERENCES_PRIORITY_MODE: 'Settings_Preferences_PriorityMode', + PREFERENCES_LANGUAGE: 'Settings_Preferences_Language', + PREFERENCES_THEME: 'Settings_Preferences_Theme', SECURITY: 'Settings_Security', @@ -49,28 +67,11 @@ const SCREENS = { ABOUT: 'Settings_About', - STATUS: 'Settings_Status', - PRONOUNS: 'Settings_Pronouns', - DISPLAY_NAME: 'Settings_Display_Name', - TIMEZONE: 'Settings_Timezone', - TIMEZONE_SELECT: 'Settings_Timezone_Select', - PERSONAL_DETAILS_INITIAL: 'Settings_PersonalDetails_Initial', - PERSONAL_DETAILS_LEGAL_NAME: 'Settings_PersonalDetails_LegalName', - PERSONAL_DETAILS_DATE_OF_BIRTH: 'Settings_PersonalDetails_DateOfBirth', - PERSONAL_DETAILS_ADDRESS: 'Settings_PersonalDetails_Address', - PERSONAL_DETAILS_ADDRESS_COUNTRY: 'Settings_PersonalDetails_Address_Country', - CONTACT_METHODS: 'Settings_ContactMethods', - CONTACT_METHOD_DETAILS: 'Settings_ContactMethodDetails', - NEW_CONTACT_METHOD: 'Settings_NewContactMethod', APP_DOWNLOAD_LINKS: 'Settings_App_Download_Links', LOUNGE_ACCESS: 'Settings_Lounge_Access', ADD_DEBIT_CARD: 'Settings_Add_Debit_Card', ADD_BANK_ACCOUNT: 'Settings_Add_Bank_Account', - PREFERENCES_PRIORITY_MODE: 'Settings_Preferences_PriorityMode', - PREFERENCES_LANGUAGE: 'Settings_Preferences_Language', - PREFERENCES_THEME: 'Settings_Preferences_Theme', CLOSE: 'Settings_Close', - STATUS_SET: 'Settings_Status_Set', TWO_FACTOR_AUTH: 'Settings_TwoFactorAuth', REPORT_CARD_LOST_OR_DAMAGED: 'Settings_ReportCardLostOrDamaged', }, From b71d6f8668feef3f0fc22f25b6df18a4e6de8071 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 7 Dec 2023 11:16:04 +0100 Subject: [PATCH 39/52] Group PROFILE and PERSONAL DETAILS --- src/SCREENS.ts | 36 ++++++++++--------- .../AppNavigator/ModalStackNavigators.tsx | 32 ++++++++--------- src/libs/Navigation/linkingConfig.ts | 30 ++++++++-------- src/libs/Navigation/types.ts | 30 ++++++++-------- .../Profile/CustomStatus/StatusPage.js | 2 +- src/styles/themes/default.ts | 2 +- src/styles/themes/light.ts | 2 +- 7 files changed, 69 insertions(+), 65 deletions(-) diff --git a/src/SCREENS.ts b/src/SCREENS.ts index f8ad8e277cd5..7e7c422777d8 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -24,22 +24,26 @@ const SCREENS = { WORKSPACES: 'Settings_Workspaces', - PROFILE: 'Settings_Profile', - DISPLAY_NAME: 'Settings_Display_Name', - CONTACT_METHODS: 'Settings_ContactMethods', - CONTACT_METHOD_DETAILS: 'Settings_ContactMethodDetails', - NEW_CONTACT_METHOD: 'Settings_NewContactMethod', - STATUS: 'Settings_Status', - STATUS_SET: 'Settings_Status_Set', - PRONOUNS: 'Settings_Pronouns', - TIMEZONE: 'Settings_Timezone', - TIMEZONE_SELECT: 'Settings_Timezone_Select', - - PERSONAL_DETAILS_INITIAL: 'Settings_PersonalDetails_Initial', - PERSONAL_DETAILS_LEGAL_NAME: 'Settings_PersonalDetails_LegalName', - PERSONAL_DETAILS_DATE_OF_BIRTH: 'Settings_PersonalDetails_DateOfBirth', - PERSONAL_DETAILS_ADDRESS: 'Settings_PersonalDetails_Address', - PERSONAL_DETAILS_ADDRESS_COUNTRY: 'Settings_PersonalDetails_Address_Country', + PROFILE: { + ROOT: 'Settings_Profile', + DISPLAY_NAME: 'Settings_Display_Name', + CONTACT_METHODS: 'Settings_ContactMethods', + CONTACT_METHOD_DETAILS: 'Settings_ContactMethodDetails', + NEW_CONTACT_METHOD: 'Settings_NewContactMethod', + STATUS: 'Settings_Status', + STATUS_SET: 'Settings_Status_Set', + PRONOUNS: 'Settings_Pronouns', + TIMEZONE: 'Settings_Timezone', + TIMEZONE_SELECT: 'Settings_Timezone_Select', + + PERSONAL_DETAILS: { + INITIAL: 'Settings_PersonalDetails_Initial', + LEGAL_NAME: 'Settings_PersonalDetails_LegalName', + DATE_OF_BIRTH: 'Settings_PersonalDetails_DateOfBirth', + ADDRESS: 'Settings_PersonalDetails_Address', + ADDRESS_COUNTRY: 'Settings_PersonalDetails_Address_Country', + }, + }, PREFERENCES: 'Settings_Preferences', PREFERENCES_PRIORITY_MODE: 'Settings_Preferences_PriorityMode', diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators.tsx index c04a0989b636..73fdefe06b8f 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators.tsx @@ -145,7 +145,7 @@ const SearchModalStackNavigator = createModalStackNavigator({ - [SCREENS.NEW_CHAT_ROOT]: () => require('../../../pages/NewChatSelectorPage').default as React.ComponentType, + [SCREENS.NEW_CHAT.ROOT]: () => require('../../../pages/NewChatSelectorPage').default as React.ComponentType, }); const NewTaskModalStackNavigator = createModalStackNavigator({ @@ -168,19 +168,19 @@ const SettingsModalStackNavigator = createModalStackNavigator require('../../../pages/settings/InitialSettingsPage').default as React.ComponentType, [SCREENS.SETTINGS.SHARE_CODE]: () => require('../../../pages/ShareCodePage').default as React.ComponentType, [SCREENS.SETTINGS.WORKSPACES]: () => require('../../../pages/workspace/WorkspacesListPage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE]: () => require('../../../pages/settings/Profile/ProfilePage').default as React.ComponentType, - [SCREENS.SETTINGS.PRONOUNS]: () => require('../../../pages/settings/Profile/PronounsPage').default as React.ComponentType, - [SCREENS.SETTINGS.DISPLAY_NAME]: () => require('../../../pages/settings/Profile/DisplayNamePage').default as React.ComponentType, - [SCREENS.SETTINGS.TIMEZONE]: () => require('../../../pages/settings/Profile/TimezoneInitialPage').default as React.ComponentType, - [SCREENS.SETTINGS.TIMEZONE_SELECT]: () => require('../../../pages/settings/Profile/TimezoneSelectPage').default as React.ComponentType, - [SCREENS.SETTINGS.PERSONAL_DETAILS_INITIAL]: () => require('../../../pages/settings/Profile/PersonalDetails/PersonalDetailsInitialPage').default as React.ComponentType, - [SCREENS.SETTINGS.PERSONAL_DETAILS_LEGAL_NAME]: () => require('../../../pages/settings/Profile/PersonalDetails/LegalNamePage').default as React.ComponentType, - [SCREENS.SETTINGS.PERSONAL_DETAILS_DATE_OF_BIRTH]: () => require('../../../pages/settings/Profile/PersonalDetails/DateOfBirthPage').default as React.ComponentType, - [SCREENS.SETTINGS.PERSONAL_DETAILS_ADDRESS]: () => require('../../../pages/settings/Profile/PersonalDetails/AddressPage').default as React.ComponentType, - [SCREENS.SETTINGS.PERSONAL_DETAILS_ADDRESS_COUNTRY]: () => require('../../../pages/settings/Profile/PersonalDetails/CountrySelectionPage').default as React.ComponentType, - [SCREENS.SETTINGS.CONTACT_METHODS]: () => require('../../../pages/settings/Profile/Contacts/ContactMethodsPage').default as React.ComponentType, - [SCREENS.SETTINGS.CONTACT_METHOD_DETAILS]: () => require('../../../pages/settings/Profile/Contacts/ContactMethodDetailsPage').default as React.ComponentType, - [SCREENS.SETTINGS.NEW_CONTACT_METHOD]: () => require('../../../pages/settings/Profile/Contacts/NewContactMethodPage').default as React.ComponentType, + [SCREENS.SETTINGS.PROFILE.ROOT]: () => require('../../../pages/settings/Profile/ProfilePage').default as React.ComponentType, + [SCREENS.SETTINGS.PROFILE.PRONOUNS]: () => require('../../../pages/settings/Profile/PronounsPage').default as React.ComponentType, + [SCREENS.SETTINGS.PROFILE.DISPLAY_NAME]: () => require('../../../pages/settings/Profile/DisplayNamePage').default as React.ComponentType, + [SCREENS.SETTINGS.PROFILE.TIMEZONE]: () => require('../../../pages/settings/Profile/TimezoneInitialPage').default as React.ComponentType, + [SCREENS.SETTINGS.PROFILE.TIMEZONE_SELECT]: () => require('../../../pages/settings/Profile/TimezoneSelectPage').default as React.ComponentType, + [SCREENS.SETTINGS.PROFILE.PERSONAL_DETAILS.INITIAL]: () => require('../../../pages/settings/Profile/PersonalDetails/PersonalDetailsInitialPage').default as React.ComponentType, + [SCREENS.SETTINGS.PROFILE.PERSONAL_DETAILS.LEGAL_NAME]: () => require('../../../pages/settings/Profile/PersonalDetails/LegalNamePage').default as React.ComponentType, + [SCREENS.SETTINGS.PROFILE.PERSONAL_DETAILS.DATE_OF_BIRTH]: () => require('../../../pages/settings/Profile/PersonalDetails/DateOfBirthPage').default as React.ComponentType, + [SCREENS.SETTINGS.PROFILE.PERSONAL_DETAILS.ADDRESS]: () => require('../../../pages/settings/Profile/PersonalDetails/AddressPage').default as React.ComponentType, + [SCREENS.SETTINGS.PROFILE.PERSONAL_DETAILS.ADDRESS_COUNTRY]: () => require('../../../pages/settings/Profile/PersonalDetails/CountrySelectionPage').default as React.ComponentType, + [SCREENS.SETTINGS.PROFILE.CONTACT_METHODS]: () => require('../../../pages/settings/Profile/Contacts/ContactMethodsPage').default as React.ComponentType, + [SCREENS.SETTINGS.PROFILE.CONTACT_METHOD_DETAILS]: () => require('../../../pages/settings/Profile/Contacts/ContactMethodDetailsPage').default as React.ComponentType, + [SCREENS.SETTINGS.PROFILE.NEW_CONTACT_METHOD]: () => require('../../../pages/settings/Profile/Contacts/NewContactMethodPage').default as React.ComponentType, [SCREENS.SETTINGS.PREFERENCES]: () => require('../../../pages/settings/Preferences/PreferencesPage').default as React.ComponentType, [SCREENS.SETTINGS.PREFERENCES_PRIORITY_MODE]: () => require('../../../pages/settings/Preferences/PriorityModePage').default as React.ComponentType, [SCREENS.SETTINGS.PREFERENCES_LANGUAGE]: () => require('../../../pages/settings/Preferences/LanguagePage').default as React.ComponentType, @@ -205,8 +205,8 @@ const SettingsModalStackNavigator = createModalStackNavigator require('../../../pages/EnablePayments/EnablePaymentsPage').default as React.ComponentType, [SCREENS.SETTINGS.ADD_DEBIT_CARD]: () => require('../../../pages/settings/Wallet/AddDebitCardPage').default as React.ComponentType, [SCREENS.SETTINGS.ADD_BANK_ACCOUNT]: () => require('../../../pages/AddPersonalBankAccountPage').default as React.ComponentType, - [SCREENS.SETTINGS.STATUS]: () => require('../../../pages/settings/Profile/CustomStatus/StatusPage').default as React.ComponentType, - [SCREENS.SETTINGS.STATUS_SET]: () => require('../../../pages/settings/Profile/CustomStatus/StatusSetPage').default as React.ComponentType, + [SCREENS.SETTINGS.PROFILE.STATUS]: () => require('../../../pages/settings/Profile/CustomStatus/StatusPage').default as React.ComponentType, + [SCREENS.SETTINGS.PROFILE.STATUS_SET]: () => require('../../../pages/settings/Profile/CustomStatus/StatusSetPage').default as React.ComponentType, [SCREENS.WORKSPACE.INITIAL]: () => require('../../../pages/workspace/WorkspaceInitialPage').default as React.ComponentType, [SCREENS.WORKSPACE.SETTINGS]: () => require('../../../pages/workspace/WorkspaceSettingsPage').default as React.ComponentType, [SCREENS.WORKSPACE.CURRENCY]: () => require('../../../pages/workspace/WorkspaceSettingsCurrencyPage').default as React.ComponentType, diff --git a/src/libs/Navigation/linkingConfig.ts b/src/libs/Navigation/linkingConfig.ts index e9f3a9f488ae..5767ad116370 100644 --- a/src/libs/Navigation/linkingConfig.ts +++ b/src/libs/Navigation/linkingConfig.ts @@ -132,23 +132,23 @@ const linkingConfig: LinkingOptions = { path: ROUTES.SETTINGS_ADD_BANK_ACCOUNT, exact: true, }, - [SCREENS.SETTINGS.PROFILE]: { + [SCREENS.SETTINGS.PROFILE.ROOT]: { path: ROUTES.SETTINGS_PROFILE, exact: true, }, - [SCREENS.SETTINGS.PRONOUNS]: { + [SCREENS.SETTINGS.PROFILE.PRONOUNS]: { path: ROUTES.SETTINGS_PRONOUNS, exact: true, }, - [SCREENS.SETTINGS.DISPLAY_NAME]: { + [SCREENS.SETTINGS.PROFILE.DISPLAY_NAME]: { path: ROUTES.SETTINGS_DISPLAY_NAME, exact: true, }, - [SCREENS.SETTINGS.TIMEZONE]: { + [SCREENS.SETTINGS.PROFILE.TIMEZONE]: { path: ROUTES.SETTINGS_TIMEZONE, exact: true, }, - [SCREENS.SETTINGS.TIMEZONE_SELECT]: { + [SCREENS.SETTINGS.PROFILE.TIMEZONE_SELECT]: { path: ROUTES.SETTINGS_TIMEZONE_SELECT, exact: true, }, @@ -160,37 +160,37 @@ const linkingConfig: LinkingOptions = { path: ROUTES.SETTINGS_APP_DOWNLOAD_LINKS, exact: true, }, - [SCREENS.SETTINGS.CONTACT_METHODS]: { + [SCREENS.SETTINGS.PROFILE.CONTACT_METHODS]: { path: ROUTES.SETTINGS_CONTACT_METHODS.route, exact: true, }, - [SCREENS.SETTINGS.CONTACT_METHOD_DETAILS]: { + [SCREENS.SETTINGS.PROFILE.CONTACT_METHOD_DETAILS]: { path: ROUTES.SETTINGS_CONTACT_METHOD_DETAILS.route, }, [SCREENS.SETTINGS.LOUNGE_ACCESS]: { path: ROUTES.SETTINGS_LOUNGE_ACCESS, }, - [SCREENS.SETTINGS.NEW_CONTACT_METHOD]: { + [SCREENS.SETTINGS.PROFILE.NEW_CONTACT_METHOD]: { path: ROUTES.SETTINGS_NEW_CONTACT_METHOD.route, exact: true, }, - [SCREENS.SETTINGS.PERSONAL_DETAILS_INITIAL]: { + [SCREENS.SETTINGS.PROFILE.PERSONAL_DETAILS.INITIAL]: { path: ROUTES.SETTINGS_PERSONAL_DETAILS, exact: true, }, - [SCREENS.SETTINGS.PERSONAL_DETAILS_LEGAL_NAME]: { + [SCREENS.SETTINGS.PROFILE.PERSONAL_DETAILS.LEGAL_NAME]: { path: ROUTES.SETTINGS_PERSONAL_DETAILS_LEGAL_NAME, exact: true, }, - [SCREENS.SETTINGS.PERSONAL_DETAILS_DATE_OF_BIRTH]: { + [SCREENS.SETTINGS.PROFILE.PERSONAL_DETAILS.DATE_OF_BIRTH]: { path: ROUTES.SETTINGS_PERSONAL_DETAILS_DATE_OF_BIRTH, exact: true, }, - [SCREENS.SETTINGS.PERSONAL_DETAILS_ADDRESS]: { + [SCREENS.SETTINGS.PROFILE.PERSONAL_DETAILS.ADDRESS]: { path: ROUTES.SETTINGS_PERSONAL_DETAILS_ADDRESS, exact: true, }, - [SCREENS.SETTINGS.PERSONAL_DETAILS_ADDRESS_COUNTRY]: { + [SCREENS.SETTINGS.PROFILE.PERSONAL_DETAILS.ADDRESS_COUNTRY]: { path: ROUTES.SETTINGS_PERSONAL_DETAILS_ADDRESS_COUNTRY.route, exact: true, }, @@ -202,11 +202,11 @@ const linkingConfig: LinkingOptions = { path: ROUTES.SETTINGS_SHARE_CODE, exact: true, }, - [SCREENS.SETTINGS.STATUS]: { + [SCREENS.SETTINGS.PROFILE.STATUS]: { path: ROUTES.SETTINGS_STATUS, exact: true, }, - [SCREENS.SETTINGS.STATUS_SET]: { + [SCREENS.SETTINGS.PROFILE.STATUS_SET]: { path: ROUTES.SETTINGS_STATUS_SET, exact: true, }, diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index 4f29308a8f0e..2d4496b2c314 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -45,19 +45,19 @@ type SettingsNavigatorParamList = { [SCREENS.SETTINGS.ROOT]: undefined; [SCREENS.SETTINGS.SHARE_CODE]: undefined; [SCREENS.SETTINGS.WORKSPACES]: undefined; - [SCREENS.SETTINGS.PROFILE]: undefined; - [SCREENS.SETTINGS.PRONOUNS]: undefined; - [SCREENS.SETTINGS.DISPLAY_NAME]: undefined; - [SCREENS.SETTINGS.TIMEZONE]: undefined; - [SCREENS.SETTINGS.TIMEZONE_SELECT]: undefined; - [SCREENS.SETTINGS.PERSONAL_DETAILS_INITIAL]: undefined; - [SCREENS.SETTINGS.PERSONAL_DETAILS_LEGAL_NAME]: undefined; - [SCREENS.SETTINGS.PERSONAL_DETAILS_DATE_OF_BIRTH]: undefined; - [SCREENS.SETTINGS.PERSONAL_DETAILS_ADDRESS]: undefined; - [SCREENS.SETTINGS.PERSONAL_DETAILS_ADDRESS_COUNTRY]: undefined; - [SCREENS.SETTINGS.CONTACT_METHODS]: undefined; - [SCREENS.SETTINGS.CONTACT_METHOD_DETAILS]: undefined; - [SCREENS.SETTINGS.NEW_CONTACT_METHOD]: undefined; + [SCREENS.SETTINGS.PROFILE.ROOT]: undefined; + [SCREENS.SETTINGS.PROFILE.PRONOUNS]: undefined; + [SCREENS.SETTINGS.PROFILE.DISPLAY_NAME]: undefined; + [SCREENS.SETTINGS.PROFILE.TIMEZONE]: undefined; + [SCREENS.SETTINGS.PROFILE.TIMEZONE_SELECT]: undefined; + [SCREENS.SETTINGS.PROFILE.PERSONAL_DETAILS.INITIAL]: undefined; + [SCREENS.SETTINGS.PROFILE.PERSONAL_DETAILS.LEGAL_NAME]: undefined; + [SCREENS.SETTINGS.PROFILE.PERSONAL_DETAILS.DATE_OF_BIRTH]: undefined; + [SCREENS.SETTINGS.PROFILE.PERSONAL_DETAILS.ADDRESS]: undefined; + [SCREENS.SETTINGS.PROFILE.PERSONAL_DETAILS.ADDRESS_COUNTRY]: undefined; + [SCREENS.SETTINGS.PROFILE.CONTACT_METHODS]: undefined; + [SCREENS.SETTINGS.PROFILE.CONTACT_METHOD_DETAILS]: undefined; + [SCREENS.SETTINGS.PROFILE.NEW_CONTACT_METHOD]: undefined; [SCREENS.SETTINGS.PREFERENCES]: undefined; [SCREENS.SETTINGS.PREFERENCES_PRIORITY_MODE]: undefined; [SCREENS.SETTINGS.PREFERENCES_LANGUAGE]: undefined; @@ -81,8 +81,8 @@ type SettingsNavigatorParamList = { [SCREENS.SETTINGS.WALLET.ENABLE_PAYMENTS]: undefined; [SCREENS.SETTINGS.ADD_DEBIT_CARD]: undefined; [SCREENS.SETTINGS.ADD_BANK_ACCOUNT]: undefined; - [SCREENS.SETTINGS.STATUS]: undefined; - [SCREENS.SETTINGS.STATUS_SET]: undefined; + [SCREENS.SETTINGS.PROFILE.STATUS]: undefined; + [SCREENS.SETTINGS.PROFILE.STATUS_SET]: undefined; [SCREENS.WORKSPACE.INITIAL]: undefined; [SCREENS.WORKSPACE.SETTINGS]: undefined; [SCREENS.WORKSPACE.CURRENCY]: undefined; diff --git a/src/pages/settings/Profile/CustomStatus/StatusPage.js b/src/pages/settings/Profile/CustomStatus/StatusPage.js index 6850684cfda2..226d0fed8044 100644 --- a/src/pages/settings/Profile/CustomStatus/StatusPage.js +++ b/src/pages/settings/Profile/CustomStatus/StatusPage.js @@ -91,7 +91,7 @@ function StatusPage({draftStatus, currentUserPersonalDetails}) { /> } headerContainerStyles={[styles.staticHeaderImage]} - backgroundColor={theme.PAGE_THEMES[SCREENS.SETTINGS.STATUS].backgroundColor} + backgroundColor={theme.PAGE_THEMES[SCREENS.SETTINGS.PROFILE.STATUS].backgroundColor} footer={footerComponent} > diff --git a/src/styles/themes/default.ts b/src/styles/themes/default.ts index 97dd0469fcea..a551c3751b9f 100644 --- a/src/styles/themes/default.ts +++ b/src/styles/themes/default.ts @@ -119,7 +119,7 @@ const darkTheme = { backgroundColor: colors.ice500, statusBarStyle: CONST.STATUS_BAR_STYLE.DARK_CONTENT, }, - [SCREENS.SETTINGS.STATUS]: { + [SCREENS.SETTINGS.PROFILE.STATUS]: { backgroundColor: colors.green700, statusBarStyle: CONST.STATUS_BAR_STYLE.LIGHT_CONTENT, }, diff --git a/src/styles/themes/light.ts b/src/styles/themes/light.ts index 4f40c3fa274d..bba3a9f1083a 100644 --- a/src/styles/themes/light.ts +++ b/src/styles/themes/light.ts @@ -119,7 +119,7 @@ const lightTheme = { backgroundColor: colors.ice500, statusBarStyle: CONST.STATUS_BAR_STYLE.DARK_CONTENT, }, - [SCREENS.SETTINGS.STATUS]: { + [SCREENS.SETTINGS.PROFILE.STATUS]: { backgroundColor: colors.green700, statusBarStyle: CONST.STATUS_BAR_STYLE.LIGHT_CONTENT, }, From cb2d7cc89f786dd710ab7504352f32610cf5f8da Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 7 Dec 2023 11:34:54 +0100 Subject: [PATCH 40/52] Group PREFERENCES --- src/SCREENS.ts | 33 +++++++++---------- .../AppNavigator/ModalStackNavigators.tsx | 8 ++--- src/libs/Navigation/linkingConfig.ts | 8 ++--- src/libs/Navigation/types.ts | 8 ++--- .../settings/Preferences/PreferencesPage.js | 2 +- .../Wallet/ActivatePhysicalCardPage.js | 2 +- src/styles/themes/default.ts | 2 +- src/styles/themes/light.ts | 2 +- 8 files changed, 31 insertions(+), 34 deletions(-) diff --git a/src/SCREENS.ts b/src/SCREENS.ts index 7e7c422777d8..42c66bb49b9d 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -19,10 +19,17 @@ const SCREENS = { UNLINK_LOGIN: 'UnlinkLogin', SETTINGS: { ROOT: 'Settings_Root', - SHARE_CODE: 'Settings_Share_Code', - WORKSPACES: 'Settings_Workspaces', + SECURITY: 'Settings_Security', + ABOUT: 'Settings_About', + APP_DOWNLOAD_LINKS: 'Settings_App_Download_Links', + LOUNGE_ACCESS: 'Settings_Lounge_Access', + ADD_DEBIT_CARD: 'Settings_Add_Debit_Card', + ADD_BANK_ACCOUNT: 'Settings_Add_Bank_Account', + CLOSE: 'Settings_Close', + TWO_FACTOR_AUTH: 'Settings_TwoFactorAuth', + REPORT_CARD_LOST_OR_DAMAGED: 'Settings_ReportCardLostOrDamaged', PROFILE: { ROOT: 'Settings_Profile', @@ -45,12 +52,12 @@ const SCREENS = { }, }, - PREFERENCES: 'Settings_Preferences', - PREFERENCES_PRIORITY_MODE: 'Settings_Preferences_PriorityMode', - PREFERENCES_LANGUAGE: 'Settings_Preferences_Language', - PREFERENCES_THEME: 'Settings_Preferences_Theme', - - SECURITY: 'Settings_Security', + PREFERENCES: { + ROOT: 'Settings_Preferences', + PRIORITY_MODE: 'Settings_Preferences_PriorityMode', + LANGUAGE: 'Settings_Preferences_Language', + THEME: 'Settings_Preferences_Theme', + }, WALLET: { ROOT: 'Settings_Wallet', @@ -68,16 +75,6 @@ const SCREENS = { REPORT_VIRTUAL_CARD_FRAUD: 'Settings_Wallet_ReportVirtualCardFraud', CARDS_DIGITAL_DETAILS_UPDATE_ADDRESS: 'Settings_Wallet_Cards_Digital_Details_Update_Address', }, - - ABOUT: 'Settings_About', - - APP_DOWNLOAD_LINKS: 'Settings_App_Download_Links', - LOUNGE_ACCESS: 'Settings_Lounge_Access', - ADD_DEBIT_CARD: 'Settings_Add_Debit_Card', - ADD_BANK_ACCOUNT: 'Settings_Add_Bank_Account', - CLOSE: 'Settings_Close', - TWO_FACTOR_AUTH: 'Settings_TwoFactorAuth', - REPORT_CARD_LOST_OR_DAMAGED: 'Settings_ReportCardLostOrDamaged', }, SAVE_THE_WORLD: { ROOT: 'SaveTheWorld_Root', diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators.tsx index 73fdefe06b8f..39dcce7891a8 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators.tsx @@ -181,11 +181,11 @@ const SettingsModalStackNavigator = createModalStackNavigator require('../../../pages/settings/Profile/Contacts/ContactMethodsPage').default as React.ComponentType, [SCREENS.SETTINGS.PROFILE.CONTACT_METHOD_DETAILS]: () => require('../../../pages/settings/Profile/Contacts/ContactMethodDetailsPage').default as React.ComponentType, [SCREENS.SETTINGS.PROFILE.NEW_CONTACT_METHOD]: () => require('../../../pages/settings/Profile/Contacts/NewContactMethodPage').default as React.ComponentType, - [SCREENS.SETTINGS.PREFERENCES]: () => require('../../../pages/settings/Preferences/PreferencesPage').default as React.ComponentType, - [SCREENS.SETTINGS.PREFERENCES_PRIORITY_MODE]: () => require('../../../pages/settings/Preferences/PriorityModePage').default as React.ComponentType, - [SCREENS.SETTINGS.PREFERENCES_LANGUAGE]: () => require('../../../pages/settings/Preferences/LanguagePage').default as React.ComponentType, + [SCREENS.SETTINGS.PREFERENCES.ROOT]: () => require('../../../pages/settings/Preferences/PreferencesPage').default as React.ComponentType, + [SCREENS.SETTINGS.PREFERENCES.PRIORITY_MODE]: () => require('../../../pages/settings/Preferences/PriorityModePage').default as React.ComponentType, + [SCREENS.SETTINGS.PREFERENCES.LANGUAGE]: () => require('../../../pages/settings/Preferences/LanguagePage').default as React.ComponentType, // Will be uncommented as part of https://github.com/Expensify/App/issues/21670 - // [SCREENS.SETTINGS.PREFERENCES_THEME]: () => require('../../../pages/settings/Preferences/ThemePage').default as React.ComponentType, + // [SCREENS.SETTINGS.PREFERENCES.THEME]: () => require('../../../pages/settings/Preferences/ThemePage').default as React.ComponentType, [SCREENS.SETTINGS.CLOSE]: () => require('../../../pages/settings/Security/CloseAccountPage').default as React.ComponentType, [SCREENS.SETTINGS.SECURITY]: () => require('../../../pages/settings/Security/SecuritySettingsPage').default as React.ComponentType, [SCREENS.SETTINGS.ABOUT]: () => require('../../../pages/settings/AboutPage/AboutPage').default as React.ComponentType, diff --git a/src/libs/Navigation/linkingConfig.ts b/src/libs/Navigation/linkingConfig.ts index 5767ad116370..15f5f6fc9a60 100644 --- a/src/libs/Navigation/linkingConfig.ts +++ b/src/libs/Navigation/linkingConfig.ts @@ -48,19 +48,19 @@ const linkingConfig: LinkingOptions = { path: ROUTES.SETTINGS_WORKSPACES, exact: true, }, - [SCREENS.SETTINGS.PREFERENCES]: { + [SCREENS.SETTINGS.PREFERENCES.ROOT]: { path: ROUTES.SETTINGS_PREFERENCES, exact: true, }, - [SCREENS.SETTINGS.PREFERENCES_PRIORITY_MODE]: { + [SCREENS.SETTINGS.PREFERENCES.PRIORITY_MODE]: { path: ROUTES.SETTINGS_PRIORITY_MODE, exact: true, }, - [SCREENS.SETTINGS.PREFERENCES_LANGUAGE]: { + [SCREENS.SETTINGS.PREFERENCES.LANGUAGE]: { path: ROUTES.SETTINGS_LANGUAGE, exact: true, }, - [SCREENS.SETTINGS.PREFERENCES_THEME]: { + [SCREENS.SETTINGS.PREFERENCES.THEME]: { path: ROUTES.SETTINGS_THEME, exact: true, }, diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index 2d4496b2c314..b69552f6fe0f 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -58,10 +58,10 @@ type SettingsNavigatorParamList = { [SCREENS.SETTINGS.PROFILE.CONTACT_METHODS]: undefined; [SCREENS.SETTINGS.PROFILE.CONTACT_METHOD_DETAILS]: undefined; [SCREENS.SETTINGS.PROFILE.NEW_CONTACT_METHOD]: undefined; - [SCREENS.SETTINGS.PREFERENCES]: undefined; - [SCREENS.SETTINGS.PREFERENCES_PRIORITY_MODE]: undefined; - [SCREENS.SETTINGS.PREFERENCES_LANGUAGE]: undefined; - [SCREENS.SETTINGS.PREFERENCES_THEME]: undefined; + [SCREENS.SETTINGS.PREFERENCES.ROOT]: undefined; + [SCREENS.SETTINGS.PREFERENCES.PRIORITY_MODE]: undefined; + [SCREENS.SETTINGS.PREFERENCES.LANGUAGE]: undefined; + [SCREENS.SETTINGS.PREFERENCES.THEME]: undefined; [SCREENS.SETTINGS.CLOSE]: undefined; [SCREENS.SETTINGS.SECURITY]: undefined; [SCREENS.SETTINGS.ABOUT]: undefined; diff --git a/src/pages/settings/Preferences/PreferencesPage.js b/src/pages/settings/Preferences/PreferencesPage.js index b010c3790056..6fa3e2df3474 100755 --- a/src/pages/settings/Preferences/PreferencesPage.js +++ b/src/pages/settings/Preferences/PreferencesPage.js @@ -46,7 +46,7 @@ function PreferencesPage(props) { Navigation.goBack(ROUTES.SETTINGS)} - backgroundColor={theme.PAGE_THEMES[SCREENS.SETTINGS.PREFERENCES].backgroundColor} + backgroundColor={theme.PAGE_THEMES[SCREENS.SETTINGS.PREFERENCES.ROOT].backgroundColor} illustration={LottieAnimations.PreferencesDJ} > diff --git a/src/pages/settings/Wallet/ActivatePhysicalCardPage.js b/src/pages/settings/Wallet/ActivatePhysicalCardPage.js index e45b4ad67f4e..788c571d9e7d 100644 --- a/src/pages/settings/Wallet/ActivatePhysicalCardPage.js +++ b/src/pages/settings/Wallet/ActivatePhysicalCardPage.js @@ -134,7 +134,7 @@ function ActivatePhysicalCardPage({ Navigation.navigate(ROUTES.SETTINGS_WALLET_DOMAINCARD.getRoute(domain))} - backgroundColor={theme.PAGE_THEMES[SCREENS.SETTINGS.PREFERENCES].backgroundColor} + backgroundColor={theme.PAGE_THEMES[SCREENS.SETTINGS.PREFERENCES.ROOT].backgroundColor} illustration={LottieAnimations.Magician} scrollViewContainerStyles={[styles.mnh100]} childrenContainerStyles={[styles.flex1]} diff --git a/src/styles/themes/default.ts b/src/styles/themes/default.ts index a551c3751b9f..2952ac02b5c2 100644 --- a/src/styles/themes/default.ts +++ b/src/styles/themes/default.ts @@ -103,7 +103,7 @@ const darkTheme = { backgroundColor: colors.tangerine800, statusBarStyle: CONST.STATUS_BAR_STYLE.LIGHT_CONTENT, }, - [SCREENS.SETTINGS.PREFERENCES]: { + [SCREENS.SETTINGS.PREFERENCES.ROOT]: { backgroundColor: colors.blue500, statusBarStyle: CONST.STATUS_BAR_STYLE.LIGHT_CONTENT, }, diff --git a/src/styles/themes/light.ts b/src/styles/themes/light.ts index bba3a9f1083a..630cbae37cea 100644 --- a/src/styles/themes/light.ts +++ b/src/styles/themes/light.ts @@ -103,7 +103,7 @@ const lightTheme = { backgroundColor: colors.tangerine800, statusBarStyle: CONST.STATUS_BAR_STYLE.LIGHT_CONTENT, }, - [SCREENS.SETTINGS.PREFERENCES]: { + [SCREENS.SETTINGS.PREFERENCES.ROOT]: { backgroundColor: colors.blue500, statusBarStyle: CONST.STATUS_BAR_STYLE.LIGHT_CONTENT, }, From 1da9216572baaefca7a5ca4eec07721f0e11cdcf Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 7 Dec 2023 11:40:31 +0100 Subject: [PATCH 41/52] Clean git diff --- src/SCREENS.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/SCREENS.ts b/src/SCREENS.ts index 42c66bb49b9d..9c569bc914ab 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -198,14 +198,6 @@ const SCREENS = { REIMBURSEMENT_ACCOUNT_ROOT: 'Reimbursement_Account_Root', WALLET_STATEMENT_ROOT: 'WalletStatement_Root', SIGN_IN_ROOT: 'SignIn_Root', - REFERRAL_DETAILS: 'Referral_Details', - - SPLIT_DETAILS: { - ROOT: 'SplitDetails_Root', - EDIT_REQUEST: 'SplitDetails_Edit_Request', - EDIT_CURRENCY: 'SplitDetails_Edit_Currency', - }, - DETAILS_ROOT: 'Details_Root', PROFILE_ROOT: 'Profile_Root', REPORT_WELCOME_MESSAGE_ROOT: 'Report_WelcomeMessage_Root', @@ -215,9 +207,16 @@ const SCREENS = { SEARCH_ROOT: 'Search_Root', NEW_CHAT: {ROOT: 'NewChat_Root', NEW_CHAT: 'chat', NEW_ROOM: 'room'}, FLAG_COMMENT_ROOT: 'FlagComment_Root', + + SPLIT_DETAILS: { + ROOT: 'SplitDetails_Root', + EDIT_REQUEST: 'SplitDetails_Edit_Request', + EDIT_CURRENCY: 'SplitDetails_Edit_Currency', + }, + REIMBURSEMENT_ACCOUNT: 'ReimbursementAccount', GET_ASSISTANCE: 'GetAssistance', - + REFERRAL_DETAILS: 'Referral_Details', KEYBOARD_SHORTCUTS: 'KeyboardShortcuts', } as const; From ff49052bedff77b39e58c6908683226a8e7cc4eb Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 7 Dec 2023 11:41:57 +0100 Subject: [PATCH 42/52] Reorder screens --- src/SCREENS.ts | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/SCREENS.ts b/src/SCREENS.ts index 9c569bc914ab..986c1158c6ea 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -189,10 +189,21 @@ const SCREENS = { CURRENCY: 'EditRequest_Currency', }, + NEW_CHAT: { + ROOT: 'NewChat_Root', + NEW_CHAT: 'chat', + NEW_ROOM: 'room', + }, + + SPLIT_DETAILS: { + ROOT: 'SplitDetails_Root', + EDIT_REQUEST: 'SplitDetails_Edit_Request', + EDIT_CURRENCY: 'SplitDetails_Edit_Currency', + }, + I_KNOW_A_TEACHER: 'I_Know_A_Teacher', INTRO_SCHOOL_PRINCIPAL: 'Intro_School_Principal', I_AM_A_TEACHER: 'I_Am_A_Teacher', - ENABLE_PAYMENTS_ROOT: 'EnablePayments_Root', ADD_PERSONAL_BANK_ACCOUNT_ROOT: 'AddPersonalBankAccount_Root', REIMBURSEMENT_ACCOUNT_ROOT: 'Reimbursement_Account_Root', @@ -205,15 +216,7 @@ const SCREENS = { ROOM_MEMBERS_ROOT: 'RoomMembers_Root', ROOM_INVITE_ROOT: 'RoomInvite_Root', SEARCH_ROOT: 'Search_Root', - NEW_CHAT: {ROOT: 'NewChat_Root', NEW_CHAT: 'chat', NEW_ROOM: 'room'}, FLAG_COMMENT_ROOT: 'FlagComment_Root', - - SPLIT_DETAILS: { - ROOT: 'SplitDetails_Root', - EDIT_REQUEST: 'SplitDetails_Edit_Request', - EDIT_CURRENCY: 'SplitDetails_Edit_Currency', - }, - REIMBURSEMENT_ACCOUNT: 'ReimbursementAccount', GET_ASSISTANCE: 'GetAssistance', REFERRAL_DETAILS: 'Referral_Details', From dfee4aeb2fce2033fa37ecd2db34f19ec303fb01 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 7 Dec 2023 12:06:21 +0100 Subject: [PATCH 43/52] Fix imports --- .../Navigation/AppNavigator/Navigators/RightModalNavigator.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx index 7bb044db5081..10b8129bc3e7 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx @@ -7,8 +7,8 @@ import * as ModalStackNavigators from '@libs/Navigation/AppNavigator/ModalStackN import RHPScreenOptions from '@libs/Navigation/AppNavigator/RHPScreenOptions'; import type {AuthScreensParamList, RightModalNavigatorParamList} from '@navigation/types'; import useThemeStyles from '@styles/useThemeStyles'; -import SCREENS from '@src/SCREENS'; import NAVIGATORS from '@src/NAVIGATORS'; +import SCREENS from '@src/SCREENS'; import Overlay from './Overlay'; type RightModalNavigatorProps = StackScreenProps; From 94a051601d85c2304c13f2ad48563e61b7207875 Mon Sep 17 00:00:00 2001 From: Artem Makushov Date: Thu, 7 Dec 2023 15:30:10 +0100 Subject: [PATCH 44/52] updated copy --- src/languages/en.ts | 8 ++++---- src/languages/es.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 817f06f6b344..5337d104a202 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -1970,10 +1970,10 @@ export default { body1: `You gotta send money to make money! Send money to a new Expensify account and get $${CONST.REFERRAL_PROGRAM.REVENUE} if they become an Expensify customer.`, }, [CONST.REFERRAL_PROGRAM.CONTENT_TYPES.REFER_FRIEND]: { - buttonText1: 'Refer a friend, ', + buttonText1: 'Invite a friend, ', buttonText2: `get $${CONST.REFERRAL_PROGRAM.REVENUE}.`, - header: `Refer a friend, get $${CONST.REFERRAL_PROGRAM.REVENUE}`, - body1: `Send your Expensify referral link to a friend or anyone else you know who spends too much time on expenses. When they start an annual subscription, you'll get $${CONST.REFERRAL_PROGRAM.REVENUE}.`, + header: `Invite a friend, get $${CONST.REFERRAL_PROGRAM.REVENUE}`, + body1: `Send your Expensify invite link to a friend or anyone else you know who spends too much time on expenses. When they start an annual subscription, you'll get $${CONST.REFERRAL_PROGRAM.REVENUE}.`, }, [CONST.REFERRAL_PROGRAM.CONTENT_TYPES.SHARE_CODE]: { buttonText1: `Get $${CONST.REFERRAL_PROGRAM.REVENUE}`, @@ -1981,7 +1981,7 @@ export default { body1: 'If you know anyone who’s spending too much time on expenses (literally anyone – your neighbor, your boss, your friend in accounting), send them your Expensify referral link:', body2: `When they start an annual subscription, you’ll get $${CONST.REFERRAL_PROGRAM.REVENUE}. Easy as that.`, }, - copyReferralLink: 'Copy referral link', + copyReferralLink: 'Copy invite link', }, violations: { allTagLevelsRequired: 'dummy.violations.allTagLevelsRequired', diff --git a/src/languages/es.ts b/src/languages/es.ts index b219021daa0f..53c47cf7f5a1 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -2455,9 +2455,9 @@ export default { body1: `¡Hay que enviar dinero para ganar dinero! Envía dinero a una cuenta nueva de Expensify y obtiene $${CONST.REFERRAL_PROGRAM.REVENUE} si se convierten en clientes de Expensify.`, }, [CONST.REFERRAL_PROGRAM.CONTENT_TYPES.REFER_FRIEND]: { - buttonText1: 'Recomienda a un amigo y ', + buttonText1: 'Invita a un amigo y ', buttonText2: `recibe $${CONST.REFERRAL_PROGRAM.REVENUE}`, - header: `Recomienda a un amigo y recibe $${CONST.REFERRAL_PROGRAM.REVENUE}`, + header: `Invita a un amigo y recibe $${CONST.REFERRAL_PROGRAM.REVENUE}`, body1: `Envía tu enlace de invitación de Expensify a un amigo o a cualquier otra persona que conozcas que dedique demasiado tiempo a los gastos. Cuando comiencen una suscripción anual, obtendrás $${CONST.REFERRAL_PROGRAM.REVENUE}.`, }, [CONST.REFERRAL_PROGRAM.CONTENT_TYPES.SHARE_CODE]: { From 8f06dadd5cae24fa70de74f1fda8fcc20b96ce23 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Fri, 8 Dec 2023 10:12:16 +0100 Subject: [PATCH 45/52] Clean migration files code --- .../KeyReportActionsDraftByReportActionID.ts | 3 ++- src/libs/migrations/RenameReceiptFilename.ts | 27 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/libs/migrations/KeyReportActionsDraftByReportActionID.ts b/src/libs/migrations/KeyReportActionsDraftByReportActionID.ts index 944b9d3e5478..1abe5a6114bb 100644 --- a/src/libs/migrations/KeyReportActionsDraftByReportActionID.ts +++ b/src/libs/migrations/KeyReportActionsDraftByReportActionID.ts @@ -4,6 +4,8 @@ import ONYXKEYS from '@src/ONYXKEYS'; import {ReportActionsDrafts} from '@src/types/onyx'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; +type ReportActionsDraftsKey = `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${string}`; + /** * This migration updates reportActionsDrafts data to be keyed by reportActionID. * @@ -24,7 +26,6 @@ export default function () { return resolve(); } - type ReportActionsDraftsKey = `${typeof ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${string}`; const newReportActionsDrafts: Record> = {}; Object.entries(allReportActionsDrafts).forEach(([onyxKey, reportActionDraft]) => { if (typeof reportActionDraft !== 'string') { diff --git a/src/libs/migrations/RenameReceiptFilename.ts b/src/libs/migrations/RenameReceiptFilename.ts index 5c18647ffe57..b2c19848aedb 100644 --- a/src/libs/migrations/RenameReceiptFilename.ts +++ b/src/libs/migrations/RenameReceiptFilename.ts @@ -6,6 +6,7 @@ import Transaction from '@src/types/onyx/Transaction'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; type OldTransaction = Transaction & {receiptFilename?: string}; +type TransactionKey = `${typeof ONYXKEYS.COLLECTION.TRANSACTION}${string}`; // This migration changes the property name on a transaction from receiptFilename to filename so that it matches what is stored in the database export default function () { @@ -23,25 +24,23 @@ export default function () { return resolve(); } - const transactionArray: Array = Object.values(transactions); - if (!transactionArray?.map((transaction) => transaction?.receiptFilename).filter(Boolean).length) { + const transactionsWithReceipt: Array = Object.values(transactions).filter((transaction) => transaction?.receiptFilename); + if (!transactionsWithReceipt?.length) { Log.info('[Migrate Onyx] Skipped migration RenameReceiptFilename because there were no transactions with the receiptFilename property'); return resolve(); } - Log.info('[Migrate Onyx] Running RenameReceiptFilename migration'); - const dataToSave: Record<`${typeof ONYXKEYS.COLLECTION.TRANSACTION}${string}`, NullishDeep> = {}; - - transactionArray?.forEach((transaction) => { - // Do nothing if there is no receiptFilename property - if (!transaction || !('receiptFilename' in transaction)) { - return; + const dataToSave: Record> = transactionsWithReceipt?.reduce((result, transaction) => { + if (!transaction) { + return result; } - - Log.info(`[Migrate Onyx] Renaming receiptFilename ${transaction?.receiptFilename} to filename`); - dataToSave[`${ONYXKEYS.COLLECTION.TRANSACTION}${transaction.transactionID}`] = { - filename: transaction?.receiptFilename, - receiptFilename: null, + Log.info(`[Migrate Onyx] Renaming receiptFilename ${transaction.receiptFilename} to filename`); + return { + ...result, + [`${ONYXKEYS.COLLECTION.TRANSACTION}${transaction.transactionID}`]: { + filename: transaction.receiptFilename, + receiptFilename: null, + }, }; }, {}); From aa30d35c70823693e4bb1477ee03010ef317f2f0 Mon Sep 17 00:00:00 2001 From: Georgia Monahan Date: Fri, 8 Dec 2023 09:37:02 -0500 Subject: [PATCH 46/52] fix split button highlight color --- src/components/OptionRow.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/OptionRow.js b/src/components/OptionRow.js index 8d100b466d1b..9618b894c90f 100644 --- a/src/components/OptionRow.js +++ b/src/components/OptionRow.js @@ -196,7 +196,7 @@ function OptionRow(props) { accessibilityLabel={props.option.text} role={CONST.ACCESSIBILITY_ROLE.BUTTON} hoverDimmingValue={1} - hoverStyle={props.hoverStyle || styles.sidebarLinkHover} + hoverStyle={!props.optionIsFocused ? (props.hoverStyle || styles.sidebarLinkHover) : undefined} needsOffscreenAlphaCompositing={lodashGet(props.option, 'icons.length', 0) >= 2} onMouseDown={props.shouldPreventDefaultFocusOnSelectRow ? (e) => e.preventDefault() : undefined} > @@ -264,6 +264,10 @@ function OptionRow(props) { text={props.selectedStateButtonText} onPress={() => props.onSelectedStatePressed(props.option)} small + innerStyles={[ + hovered && !isDisabled ? StyleUtils.getBackgroundColorStyle(theme.buttonDefaultBG) : undefined, + props.optionIsFocused && !isDisabled ? styles.buttonDefaultHovered : undefined, + ]} /> ) : ( Date: Fri, 8 Dec 2023 09:44:27 -0500 Subject: [PATCH 47/52] prettier --- src/components/OptionRow.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/OptionRow.js b/src/components/OptionRow.js index 9618b894c90f..1bb9fee72a73 100644 --- a/src/components/OptionRow.js +++ b/src/components/OptionRow.js @@ -196,7 +196,7 @@ function OptionRow(props) { accessibilityLabel={props.option.text} role={CONST.ACCESSIBILITY_ROLE.BUTTON} hoverDimmingValue={1} - hoverStyle={!props.optionIsFocused ? (props.hoverStyle || styles.sidebarLinkHover) : undefined} + hoverStyle={!props.optionIsFocused ? props.hoverStyle || styles.sidebarLinkHover : undefined} needsOffscreenAlphaCompositing={lodashGet(props.option, 'icons.length', 0) >= 2} onMouseDown={props.shouldPreventDefaultFocusOnSelectRow ? (e) => e.preventDefault() : undefined} > From 87fd4de17fba18844cb9750c35c05cc0ad30764d Mon Sep 17 00:00:00 2001 From: Georgia Monahan Date: Fri, 8 Dec 2023 10:42:30 -0500 Subject: [PATCH 48/52] do not change button color, modify appBG menuItem hover color to use product500 --- src/components/OptionRow.js | 5 +---- src/styles/styles.ts | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/components/OptionRow.js b/src/components/OptionRow.js index 1bb9fee72a73..eaf3ccc7ead2 100644 --- a/src/components/OptionRow.js +++ b/src/components/OptionRow.js @@ -264,10 +264,7 @@ function OptionRow(props) { text={props.selectedStateButtonText} onPress={() => props.onSelectedStatePressed(props.option)} small - innerStyles={[ - hovered && !isDisabled ? StyleUtils.getBackgroundColorStyle(theme.buttonDefaultBG) : undefined, - props.optionIsFocused && !isDisabled ? styles.buttonDefaultHovered : undefined, - ]} + shouldUseDefaultHover={false} /> ) : ( }, sidebarLinkActive: { - backgroundColor: theme.border, + backgroundColor: theme.buttonHoveredBG, textDecorationLine: 'none', }, From d94c1e3ce2ab634e741284c954c3524cf3a35adb Mon Sep 17 00:00:00 2001 From: Georgia Monahan Date: Fri, 8 Dec 2023 10:48:05 -0500 Subject: [PATCH 49/52] revert skeleton UI color --- src/styles/themes/default.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/styles/themes/default.ts b/src/styles/themes/default.ts index 891eb1e9bf8e..00ff9d05cbff 100644 --- a/src/styles/themes/default.ts +++ b/src/styles/themes/default.ts @@ -79,7 +79,7 @@ const darkTheme = { tooltipSupportingText: colors.productLight800, tooltipPrimaryText: colors.productLight900, skeletonLHNIn: colors.productDark400, - skeletonLHNOut: colors.productDark400, + skeletonLHNOut: colors.productDark600, QRLogo: colors.green400, starDefaultBG: 'rgb(254, 228, 94)', loungeAccessOverlay: colors.blue800, From 8472d23bc3e69e7cdf673aacb2571c3c68053079 Mon Sep 17 00:00:00 2001 From: Georgia Monahan Date: Fri, 8 Dec 2023 11:04:28 -0500 Subject: [PATCH 50/52] fix eReceipt image crash --- src/components/EReceiptThumbnail.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/EReceiptThumbnail.js b/src/components/EReceiptThumbnail.js index 5eb35538af80..1f719862412b 100644 --- a/src/components/EReceiptThumbnail.js +++ b/src/components/EReceiptThumbnail.js @@ -72,7 +72,7 @@ function EReceiptThumbnail({transaction}) { receiptMCCSize = variables.eReceiptMCCHeightWidthMedium; } - const getBackgroundImage = useMemo((trans) => backgroundImages[StyleUtils.getEReceiptColorCode(trans)], [StyleUtils]); + const backgroundImage = useMemo(() => backgroundImages[StyleUtils.getEReceiptColorCode(transaction)], [StyleUtils, transaction]); return ( From da0eb4721bacb8545048d3dea8ed31d80adf4167 Mon Sep 17 00:00:00 2001 From: situchan Date: Sat, 9 Dec 2023 02:14:29 +0600 Subject: [PATCH 51/52] fix style regressions --- src/components/FocusModeNotification.js | 3 ++- src/components/SAMLLoadingIndicator.js | 3 ++- src/pages/iou/request/step/IOURequestStepDescription.js | 2 +- src/pages/iou/request/step/IOURequestStepDistance.js | 3 ++- src/pages/iou/request/step/StepScreenDragAndDropWrapper.js | 4 +++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/components/FocusModeNotification.js b/src/components/FocusModeNotification.js index 37d8e4848b98..ea6db244091a 100644 --- a/src/components/FocusModeNotification.js +++ b/src/components/FocusModeNotification.js @@ -1,7 +1,7 @@ import React, {useEffect} from 'react'; import useEnvironment from '@hooks/useEnvironment'; import useLocalize from '@hooks/useLocalize'; -import styles from '@styles/styles'; +import useThemeStyles from '@styles/useThemeStyles'; import * as Link from '@userActions/Link'; import * as User from '@userActions/User'; import CONST from '@src/CONST'; @@ -12,6 +12,7 @@ import TextLinkWithRef from './TextLink'; function FocusModeNotification() { const {environmentURL} = useEnvironment(); const {translate} = useLocalize(); + const styles = useThemeStyles(); useEffect(() => { User.updateChatPriorityMode(CONST.PRIORITY_MODE.GSD, true); }, []); diff --git a/src/components/SAMLLoadingIndicator.js b/src/components/SAMLLoadingIndicator.js index d00c5a032a72..d6d061122eff 100644 --- a/src/components/SAMLLoadingIndicator.js +++ b/src/components/SAMLLoadingIndicator.js @@ -1,8 +1,8 @@ import React from 'react'; import {StyleSheet, View} from 'react-native'; import useLocalize from '@hooks/useLocalize'; -import styles from '@styles/styles'; import themeColors from '@styles/themes/default'; +import useThemeStyles from '@styles/useThemeStyles'; import Icon from './Icon'; import * as Expensicons from './Icon/Expensicons'; import * as Illustrations from './Icon/Illustrations'; @@ -10,6 +10,7 @@ import Text from './Text'; function SAMLLoadingIndicator() { const {translate} = useLocalize(); + const styles = useThemeStyles(); return ( diff --git a/src/pages/iou/request/step/IOURequestStepDescription.js b/src/pages/iou/request/step/IOURequestStepDescription.js index 446a6fabdbb5..6cf9f86068a6 100644 --- a/src/pages/iou/request/step/IOURequestStepDescription.js +++ b/src/pages/iou/request/step/IOURequestStepDescription.js @@ -10,7 +10,7 @@ import useLocalize from '@hooks/useLocalize'; import * as Browser from '@libs/Browser'; import compose from '@libs/compose'; import Navigation from '@libs/Navigation/Navigation'; -import updateMultilineInputRange from '@libs/UpdateMultilineInputRange'; +import updateMultilineInputRange from '@libs/updateMultilineInputRange'; import useThemeStyles from '@styles/useThemeStyles'; import * as IOU from '@userActions/IOU'; import CONST from '@src/CONST'; diff --git a/src/pages/iou/request/step/IOURequestStepDistance.js b/src/pages/iou/request/step/IOURequestStepDistance.js index 4ac0f3649b98..39e9d6f03afa 100644 --- a/src/pages/iou/request/step/IOURequestStepDistance.js +++ b/src/pages/iou/request/step/IOURequestStepDistance.js @@ -16,7 +16,7 @@ import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; import * as TransactionUtils from '@libs/TransactionUtils'; import reportPropTypes from '@pages/reportPropTypes'; -import styles from '@styles/styles'; +import useThemeStyles from '@styles/useThemeStyles'; import variables from '@styles/variables'; import * as IOU from '@userActions/IOU'; import * as MapboxToken from '@userActions/MapboxToken'; @@ -53,6 +53,7 @@ function IOURequestStepDistance({ }) { const {isOffline} = useNetwork(); const {translate} = useLocalize(); + const styles = useThemeStyles(); const [optimisticWaypoints, setOptimisticWaypoints] = useState(null); const [hasError, setHasError] = useState(false); diff --git a/src/pages/iou/request/step/StepScreenDragAndDropWrapper.js b/src/pages/iou/request/step/StepScreenDragAndDropWrapper.js index e7247422e1f2..a369775d7110 100644 --- a/src/pages/iou/request/step/StepScreenDragAndDropWrapper.js +++ b/src/pages/iou/request/step/StepScreenDragAndDropWrapper.js @@ -5,7 +5,7 @@ import DragAndDropProvider from '@components/DragAndDrop/Provider'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; -import styles from '@styles/styles'; +import useThemeStyles from '@styles/useThemeStyles'; const propTypes = { /** The things to display inside the screenwrapper */ @@ -33,6 +33,8 @@ const defaultProps = { function StepScreenDragAndDropWrapper({testID, headerTitle, onBackButtonPress, onEntryTransitionEnd, children, shouldShowWrapper}) { const [isDraggingOver, setIsDraggingOver] = useState(false); + const styles = useThemeStyles(); + if (!shouldShowWrapper) { return children; } From 271b0a5f26555920dcf518e5d12cc31608e3a0d1 Mon Sep 17 00:00:00 2001 From: OSBotify Date: Fri, 8 Dec 2023 22:03:49 +0000 Subject: [PATCH 52/52] Update version to 1.4.10-1 --- android/app/build.gradle | 4 ++-- ios/NewExpensify/Info.plist | 2 +- ios/NewExpensifyTests/Info.plist | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 25bb327eb97a..f58e92f66ae8 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -91,8 +91,8 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion multiDexEnabled rootProject.ext.multiDexEnabled - versionCode 1001041000 - versionName "1.4.10-0" + versionCode 1001041001 + versionName "1.4.10-1" } flavorDimensions "default" diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist index 61a597638cca..a97ae1101937 100644 --- a/ios/NewExpensify/Info.plist +++ b/ios/NewExpensify/Info.plist @@ -40,7 +40,7 @@ CFBundleVersion - 1.4.10.0 + 1.4.10.1 ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist index 189451c9ffdd..7eabdca438bc 100644 --- a/ios/NewExpensifyTests/Info.plist +++ b/ios/NewExpensifyTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 1.4.10.0 + 1.4.10.1 diff --git a/package-lock.json b/package-lock.json index 20ba84846b69..6d125e2f6b27 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "new.expensify", - "version": "1.4.10-0", + "version": "1.4.10-1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "new.expensify", - "version": "1.4.10-0", + "version": "1.4.10-1", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index db0e0c15a3f2..dc1964eac407 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "new.expensify", - "version": "1.4.10-0", + "version": "1.4.10-1", "author": "Expensify, Inc.", "homepage": "https://new.expensify.com", "description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",