Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/AccountSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ function AccountSwitcher({isScreenFocused}: AccountSwitcherProps) {
const error = getLatestError(errorFields?.connect?.[email]);
const personalDetails = getPersonalDetailByEmail(email);
return createBaseMenuItem(personalDetails, error, {
badgeText: translate('delegate.role', {role}),
badgeText: translate('delegate.role', role),
onSelected: () => {
if (isOffline) {
close(showOfflineModal);
Expand Down
4 changes: 2 additions & 2 deletions src/components/AccountingConnectionConfirmationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ function AccountingConnectionConfirmationModal({integrationToConnect, onCancel,

return (
<ConfirmModal
title={translate('workspace.accounting.connectTitle', {connectionName: integrationToConnect})}
title={translate('workspace.accounting.connectTitle', integrationToConnect)}
isVisible
onConfirm={onConfirm}
onCancel={onCancel}
prompt={translate('workspace.accounting.connectPrompt', {connectionName: integrationToConnect})}
prompt={translate('workspace.accounting.connectPrompt', integrationToConnect)}
confirmText={translate('workspace.accounting.setup')}
cancelText={translate('common.cancel')}
success
Expand Down
36 changes: 28 additions & 8 deletions src/components/ArchivedReportFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,34 @@ function ArchivedReportFooter({reportID}: ArchivedReportFooterProps) {
policyName = lodashEscape(policyName);
}

const text = shouldRenderHTML
? translate(`reportArchiveReasons.${archiveReason}`, {
displayName: `<strong>${displayName}</strong>`,
oldDisplayName: `<strong>${oldDisplayName}</strong>`,
policyName: `<strong>${policyName}</strong>`,
shouldUseYou: actorPersonalDetails?.accountID === currentUserAccountID,
})
: translate(`reportArchiveReasons.${archiveReason}`);
let text: string;
if (shouldRenderHTML) {
const displayNameHtml = `<strong>${displayName}</strong>`;
const oldDisplayNameHtml = `<strong>${oldDisplayName}</strong>`;
const policyNameHtml = `<strong>${policyName}</strong>`;
const shouldUseYou = actorPersonalDetails?.accountID === currentUserAccountID;
switch (archiveReason) {
case CONST.REPORT.ARCHIVE_REASON.ACCOUNT_CLOSED:
text = translate('reportArchiveReasons.accountClosed', displayNameHtml);
break;
case CONST.REPORT.ARCHIVE_REASON.ACCOUNT_MERGED:
text = translate('reportArchiveReasons.accountMerged', displayNameHtml, oldDisplayNameHtml);
break;
case CONST.REPORT.ARCHIVE_REASON.REMOVED_FROM_POLICY:
text = translate('reportArchiveReasons.removedFromPolicy', displayNameHtml, policyNameHtml, shouldUseYou);
break;
case CONST.REPORT.ARCHIVE_REASON.POLICY_DELETED:
text = translate('reportArchiveReasons.policyDeleted', policyNameHtml);
break;
case CONST.REPORT.ARCHIVE_REASON.INVOICE_RECEIVER_POLICY_DELETED:
text = translate('reportArchiveReasons.invoiceReceiverPolicyDeleted', policyNameHtml);
break;
default:
text = translate('reportArchiveReasons.default');
}
} else {
text = translate(`reportArchiveReasons.${archiveReason}`);
}

return (
<Banner
Expand Down
18 changes: 9 additions & 9 deletions src/components/AvatarWithImagePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

type ErrorData = {
validationError?: TranslationPaths | null | '';
phraseParam: Record<string, unknown>;
phraseArgs: unknown[];
};

type OpenPickerParams = {
Expand Down Expand Up @@ -113,16 +113,16 @@
const isFocused = useIsFocused();
const [popoverPosition, setPopoverPosition] = useState({horizontal: 0, vertical: 0});
const [isMenuVisible, setIsMenuVisible] = useState(false);
const [errorData, setErrorData] = useState<ErrorData>({validationError: null, phraseParam: {}});

Check failure on line 116 in src/components/AvatarWithImagePicker.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Object literal may only specify known properties, and 'phraseParam' does not exist in type 'ErrorData | (() => ErrorData)'.
const {calculatePopoverPosition} = usePopoverPosition();
const anchorRef = useRef<View>(null);
const {translate} = useLocalize();
const {openCropper} = useAvatarCrop({maskType: editorMaskImage ? 'square' : undefined, onCropped: onImageSelected});

const setError = (error: TranslationPaths | null, phraseParam: Record<string, unknown>) => {
const setError = (error: TranslationPaths | null, phraseArgs: unknown[] = []) => {
setErrorData({
validationError: error,
phraseParam,
phraseArgs,
});
};

Expand All @@ -132,11 +132,11 @@
}

// Reset the error if the component is no longer focused.
setError(null, {});
setError(null, []);
}, [isFocused]);

useEffect(() => {
setError(null, {});
setError(null, []);
}, [source, avatarID]);

/**
Expand All @@ -146,16 +146,16 @@
validateAvatarImage(image)
.then((validationResult) => {
if (!validationResult.isValid) {
setError(validationResult.errorKey ?? null, validationResult.errorParams ?? {});
setError(validationResult.errorKey ?? null, validationResult.errorArgs ?? []);
return;
}

setError(null, {});

Check failure on line 153 in src/components/AvatarWithImagePicker.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Argument of type '{}' is not assignable to parameter of type 'unknown[]'.
setIsMenuVisible(false);
openCropper(image);
})
.catch(() => {
setError('attachmentPicker.errorWhileSelectingCorruptedAttachment', {});
setError('attachmentPicker.errorWhileSelectingCorruptedAttachment', []);
});
};

Expand Down Expand Up @@ -185,7 +185,7 @@
icon: icons.Trashcan,
text: translate('avatarWithImagePicker.removePhoto'),
onSelected: () => {
setError(null, {});
setError(null, []);
onImageRemoved();
},
});
Expand Down Expand Up @@ -292,7 +292,7 @@
<DotIndicatorMessage
style={styles.mt6}
// eslint-disable-next-line @typescript-eslint/naming-convention
messages={{0: translate(errorData.validationError, errorData.phraseParam as never)}}
messages={{0: (translate as (key: TranslationPaths, ...args: unknown[]) => string)(errorData.validationError, ...errorData.phraseArgs)}}
Comment thread
jakubstec marked this conversation as resolved.
type="error"
/>
)}
Expand Down
4 changes: 2 additions & 2 deletions src/components/HeaderWithBackButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function HeaderWithBackButton({

const middleContent = useMemo(() => {
if (progressBarPercentage) {
const progressBarLabel = stepCounter ? `${translate('common.progressBarLabel')}, ${translate('stepCounter', stepCounter)}` : undefined;
const progressBarLabel = stepCounter ? `${translate('common.progressBarLabel')}, ${translate('stepCounter', stepCounter.step, stepCounter.total, stepCounter.text)}` : undefined;
return (
<>
{/* Reserves as much space for the middleContent as possible */}
Expand Down Expand Up @@ -154,7 +154,7 @@ function HeaderWithBackButton({
return (
<Header
title={title}
subtitle={stepCounter ? translate('stepCounter', stepCounter) : subtitle}
subtitle={stepCounter ? translate('stepCounter', stepCounter.step, stepCounter.total, stepCounter.text) : subtitle}
Comment thread
jakubstec marked this conversation as resolved.
Outdated
textStyles={[titleColor ? StyleUtils.getTextColorStyle(titleColor) : {}, shouldUseHeadlineHeader && styles.textHeadlineH2]}
subTitleLink={subTitleLink}
numberOfTitleLines={1}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@
return (
<Button
success
text={translate('workspace.common.exportIntegrationSelected', {
// connectedIntegration is guaranteed non-null when EXPORT_TO_ACCOUNTING is the primary action
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
connectionName: connectedIntegration!,
})}
text={translate('workspace.common.exportIntegrationSelected', connectedIntegration!)}

Check failure on line 36 in src/components/MoneyReportHeaderPrimaryAction/ExportPrimaryAction.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Forbidden non-null assertion
onPress={() => {
if (!connectedIntegration || !moneyRequestReport) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/components/ParentNavigationSubtitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ function ParentNavigationSubtitle({
onMouseEnter={onMouseEnter}
onMouseLeave={onMouseLeave}
onPress={onPress}
accessibilityLabel={translate('threads.parentNavigationSummary', {reportName, workspaceName})}
accessibilityLabel={translate('threads.parentNavigationSummary', reportName, workspaceName)}
style={[
pressableStyles,
styles.optionAlternateText,
Expand Down
4 changes: 2 additions & 2 deletions src/components/ReportActionItem/ExportWithDropdownMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function ExportWithDropdownMenu({
const options = [
{
value: CONST.REPORT.EXPORT_OPTIONS.EXPORT_TO_INTEGRATION,
text: translate('workspace.common.exportIntegrationSelected', {connectionName}),
text: translate('workspace.common.exportIntegrationSelected', connectionName),
...optionTemplate,
},
{
Expand Down Expand Up @@ -122,7 +122,7 @@ function ExportWithDropdownMenu({
if (isExported) {
showConfirmModal({
title: translate('workspace.exportAgainModal.title'),
prompt: translate('workspace.exportAgainModal.description', {connectionName, reportName: report?.reportName ?? ''}),
prompt: translate('workspace.exportAgainModal.description', report?.reportName ?? '', connectionName),
confirmText: translate('workspace.exportAgainModal.confirmText'),
cancelText: translate('workspace.exportAgainModal.cancelText'),
}).then(({action}) => {
Expand Down
5 changes: 1 addition & 4 deletions src/hooks/useExportActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,7 @@
},
},
[CONST.REPORT.EXPORT_OPTIONS.EXPORT_TO_INTEGRATION]: {
text: translate('workspace.common.exportIntegrationSelected', {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
connectionName: connectedIntegrationFallback!,
}),
text: translate('workspace.common.exportIntegrationSelected', connectedIntegrationFallback!),

Check failure on line 158 in src/hooks/useExportActions.ts

View workflow job for this annotation

GitHub Actions / ESLint check

Forbidden non-null assertion
icon: getIntegrationIcon(connectedIntegration ?? connectedIntegrationFallback, expensifyIcons),
displayInDefaultIconColor: true,
additionalIconStyles: styles.integrationIcon,
Expand Down
5 changes: 1 addition & 4 deletions src/hooks/useExportAgainModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ function useExportAgainModal(reportID: string | undefined, policyID: string | un

showConfirmModal({
title: translate('workspace.exportAgainModal.title'),
prompt: translate('workspace.exportAgainModal.description', {
connectionName: integrationForExport,
reportName,
}),
prompt: translate('workspace.exportAgainModal.description', reportName, integrationForExport),
confirmText: translate('workspace.exportAgainModal.confirmText'),
cancelText: translate('workspace.exportAgainModal.cancelText'),
}).then((result) => {
Expand Down
6 changes: 1 addition & 5 deletions src/hooks/useLifecycleActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,7 @@ function useLifecycleActions({reportID, startApprovedAnimation, startAnimation,
const integrationNameFromExportMessage = isExported ? getIntegrationNameFromExportMessageUtils(reportActions) : null;

const connectedIntegration = getValidConnectedIntegration(policy);
const connectedIntegrationName = connectedIntegration
? translate('workspace.accounting.connectionName', {
connectionName: connectedIntegration,
})
: '';
const connectedIntegrationName = connectedIntegration ? translate('workspace.accounting.connectionName', connectedIntegration) : '';

const isAnyTransactionOnHold = hasHeldExpensesReportUtils(transactions);

Expand Down
5 changes: 1 addition & 4 deletions src/hooks/useSearchBulkActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1543,10 +1543,7 @@ function useSearchBulkActions({queryJSON}: UseSearchBulkActionsParams) {
if (areAnyReportsExported) {
showConfirmModal({
title: translate('workspace.exportAgainModal.title'),
prompt: translate('workspace.exportAgainModal.description', {
connectionName: connectedIntegration,
reportName: exportedReportNames.join('\n'),
}),
prompt: translate('workspace.exportAgainModal.description', exportedReportNames.join('\n'), connectedIntegration),
confirmText: translate('workspace.exportAgainModal.confirmText'),
cancelText: translate('workspace.exportAgainModal.cancelText'),
shouldEnablePromptScroll: true,
Expand Down
Loading
Loading