Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NoQA] Clean up - Rename next step to be singular #33249

Merged
merged 4 commits into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/components/HTMLEngineProvider/BaseHTMLEngineProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ function BaseHTMLEngineProvider(props) {
}),
'mention-user': defaultHTMLElementModels.span.extend({tagName: 'mention-user'}),
'mention-here': defaultHTMLElementModels.span.extend({tagName: 'mention-here'}),
'next-steps': defaultHTMLElementModels.span.extend({
tagName: 'next-steps',
'next-step': defaultHTMLElementModels.span.extend({
tagName: 'next-step',
mixedUAStyles: {...styles.textLabelSupporting},
}),
'next-steps-email': defaultHTMLElementModels.span.extend({tagName: 'next-steps-email'}),
'next-step-email': defaultHTMLElementModels.span.extend({tagName: 'next-step-email'}),
}),
[styles.colorMuted, styles.formError, styles.mb0, styles.textLabelSupporting],
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ import React from 'react';
import Text from '@components/Text';
import useThemeStyles from '@hooks/useThemeStyles';

type NextStepsEmailRendererProps = {
type NextStepEmailRendererProps = {
tnode: {
data: string;
};
};

function NextStepsEmailRenderer({tnode}: NextStepsEmailRendererProps) {
function NextStepEmailRenderer({tnode}: NextStepEmailRendererProps) {
const styles = useThemeStyles();

return <Text style={[styles.breakWord, styles.textLabelSupporting, styles.textStrong]}>{tnode.data}</Text>;
}

NextStepsEmailRenderer.displayName = 'NextStepsEmailRenderer';
NextStepEmailRenderer.displayName = 'NextStepEmailRenderer';

export default NextStepsEmailRenderer;
export default NextStepEmailRenderer;
4 changes: 2 additions & 2 deletions src/components/HTMLEngineProvider/HTMLRenderers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import EditedRenderer from './EditedRenderer';
import ImageRenderer from './ImageRenderer';
import MentionHereRenderer from './MentionHereRenderer';
import MentionUserRenderer from './MentionUserRenderer';
import NextStepsEmailRenderer from './NextStepsEmailRenderer';
import NextStepEmailRenderer from './NextStepEmailRenderer';
import PreRenderer from './PreRenderer';

/**
Expand All @@ -21,5 +21,5 @@ export default {
pre: PreRenderer,
'mention-user': MentionUserRenderer,
'mention-here': MentionHereRenderer,
'next-steps-email': NextStepsEmailRenderer,
'next-step-email': NextStepEmailRenderer,
};
10 changes: 5 additions & 5 deletions src/components/MoneyReportHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ function MoneyReportHeader({session, personalDetails, policy, chatReport, nextSt
const shouldShowSettlementButton = shouldShowPayButton || shouldShowApproveButton;
const shouldShowSubmitButton = isDraft && reimbursableTotal !== 0;
const isFromPaidPolicy = policyType === CONST.POLICY.TYPE.TEAM || policyType === CONST.POLICY.TYPE.CORPORATE;
const shouldShowNextSteps = isFromPaidPolicy && nextStep && !_.isEmpty(nextStep.message);
const shouldShowAnyButton = shouldShowSettlementButton || shouldShowApproveButton || shouldShowSubmitButton || shouldShowNextSteps;
const shouldShowNextStep = isFromPaidPolicy && nextStep && !_.isEmpty(nextStep.message);
const shouldShowAnyButton = shouldShowSettlementButton || shouldShowApproveButton || shouldShowSubmitButton || shouldShowNextStep;
const bankAccountRoute = ReportUtils.getBankAccountRoute(chatReport);
const formattedAmount = CurrencyUtils.convertToDisplayString(reimbursableTotal, moneyRequestReport.currency);
const isMoreContentShown = shouldShowNextSteps || (shouldShowAnyButton && isSmallScreenWidth);
const isMoreContentShown = shouldShowNextStep || (shouldShowAnyButton && isSmallScreenWidth);

const threeDotsMenuItems = [HeaderUtils.getPinMenuItem(moneyRequestReport)];
if (!ReportUtils.isArchivedRoom(chatReport)) {
Expand Down Expand Up @@ -138,7 +138,7 @@ function MoneyReportHeader({session, personalDetails, policy, chatReport, nextSt
shouldShowBackButton={isSmallScreenWidth}
onBackButtonPress={() => Navigation.goBack(ROUTES.HOME, false, true)}
// Shows border if no buttons or next steps are showing below the header
shouldShowBorderBottom={!(shouldShowAnyButton && isSmallScreenWidth) && !(shouldShowNextSteps && !isSmallScreenWidth)}
shouldShowBorderBottom={!(shouldShowAnyButton && isSmallScreenWidth) && !(shouldShowNextStep && !isSmallScreenWidth)}
shouldShowThreeDotsButton
threeDotsMenuItems={threeDotsMenuItems}
threeDotsAnchorPosition={styles.threeDotsPopoverOffsetNoCloseButton(windowWidth)}
Expand Down Expand Up @@ -200,7 +200,7 @@ function MoneyReportHeader({session, personalDetails, policy, chatReport, nextSt
/>
</View>
)}
{shouldShowNextSteps && (
{shouldShowNextStep && (
<View style={[styles.ph5, styles.pb3]}>
<MoneyReportHeaderStatusBar nextStep={nextStep} />
</View>
Expand Down
2 changes: 1 addition & 1 deletion src/components/MoneyReportHeaderStatusBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function MoneyReportHeaderStatusBar({nextStep}) {
return (
<View style={[styles.dFlex, styles.flexRow, styles.alignItemsCenter, styles.overflowHidden, styles.w100]}>
<View style={styles.moneyRequestHeaderStatusBarBadge}>
<Text style={[styles.textLabel, styles.textMicroBold]}>{translate(nextStep.title === CONST.NEXT_STEP.FINISHED ? 'iou.finished' : 'iou.nextSteps')}</Text>
<Text style={[styles.textLabel, styles.textMicroBold]}>{translate(nextStep.title === CONST.NEXT_STEP.FINISHED ? 'iou.finished' : 'iou.nextStep')}</Text>
</View>
<View style={[styles.dFlex, styles.flexRow, styles.flexShrink1]}>
<RenderHTML html={messageContent} />
Expand Down
4 changes: 2 additions & 2 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ export default {
settledElsewhere: 'Paid elsewhere',
settleExpensify: ({formattedAmount}: SettleExpensifyCardParams) => (formattedAmount ? `Pay ${formattedAmount} with Expensify` : `Pay with Expensify`),
payElsewhere: 'Pay elsewhere',
nextSteps: 'Next Steps',
nextStep: 'Next Steps',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be renamed if it's corresponding to the text it means?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, good question. Let me ask @mountiny about it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good now, the design has the plural name in it but in sake of consistency elsewhere I think its better ot keep the name singular here

finished: 'Finished',
requestAmount: ({amount}: RequestAmountParams) => `request ${amount}`,
requestedAmount: ({formattedAmount, comment}: RequestedAmountMessageParams) => `requested ${formattedAmount}${comment ? ` for ${comment}` : ''}`,
Expand Down Expand Up @@ -1429,7 +1429,7 @@ export default {
description: 'A day or two after you add your account to Expensify we send three (3) transactions to your account. They have a merchant line like "Expensify, Inc. Validation".',
descriptionCTA: 'Please enter each transaction amount in the fields below. Example: 1.51.',
reviewingInfo: "Thanks! We're reviewing your information, and will be in touch shortly. Please check your chat with Concierge ",
forNextSteps: ' for next steps to finish setting up your bank account.',
forNextStep: ' for next steps to finish setting up your bank account.',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question

letsChatCTA: "Yes, let's chat",
letsChatText: 'Thanks for doing that. We need your help verifying a few pieces of information, but we can work this out quickly over chat. Ready?',
letsChatTitle: "Let's chat!",
Expand Down
4 changes: 2 additions & 2 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ export default {
settledElsewhere: 'Pagado de otra forma',
settleExpensify: ({formattedAmount}: SettleExpensifyCardParams) => (formattedAmount ? `Pagar ${formattedAmount} con Expensify` : `Pagar con Expensify`),
payElsewhere: 'Pagar de otra forma',
nextSteps: 'Pasos Siguientes',
nextStep: 'Pasos Siguientes',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question

finished: 'Finalizado',
requestAmount: ({amount}: RequestAmountParams) => `solicitar ${amount}`,
requestedAmount: ({formattedAmount, comment}: RequestedAmountMessageParams) => `solicité ${formattedAmount}${comment ? ` para ${comment}` : ''}`,
Expand Down Expand Up @@ -1452,7 +1452,7 @@ export default {
'Uno o dos días después de añadir tu cuenta a Expensify, te enviaremos tres (3) transacciones a tu cuenta. Tienen un nombre de comerciante similar a "Expensify, Inc. Validation".',
descriptionCTA: 'Introduce el importe de cada transacción en los campos siguientes. Ejemplo: 1.51.',
reviewingInfo: '¡Gracias! Estamos revisando tu información y nos comunicaremos contigo en breve. Consulta el chat con Concierge ',
forNextSteps: ' para conocer los próximos pasos para terminar de configurar tu cuenta bancaria.',
forNextStep: ' para conocer los próximos pasos para terminar de configurar tu cuenta bancaria.',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question

letsChatCTA: 'Sí, vamos a chatear',
letsChatText: 'Gracias. Necesitamos tu ayuda para verificar la información, pero podemos hacerlo rápidamente a través del chat. ¿Estás listo?',
letsChatTitle: '¡Vamos a chatear!',
Expand Down
4 changes: 2 additions & 2 deletions src/libs/NextStepUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function parseMessage(messages: Message[] | undefined) {
let content = Str.safeEscape(part.text);

if (isEmail) {
tagType = 'next-steps-email';
tagType = 'next-step-email';
content = EmailUtils.prefixMailSeparatorsWithBreakOpportunities(content);
}

Expand All @@ -28,7 +28,7 @@ function parseMessage(messages: Message[] | undefined) {
.replace(/%Expenses/g, 'These expenses')
.replace(/%tobe/g, 'are');

return `<next-steps>${formattedHtml}</next-steps>`;
return `<next-step>${formattedHtml}</next-step>`;
}

// eslint-disable-next-line import/prefer-default-export
Expand Down
24 changes: 12 additions & 12 deletions src/libs/actions/IOU.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ Onyx.connect({
},
});

let allNextSteps = {};
Onyx.connect({
key: ONYXKEYS.COLLECTION.NEXT_STEP,
waitForCollectionCallback: true,
callback: (val) => {
allNextSteps = val || {};
},
});

let userAccountID = '';
let currentUserEmail = '';
Onyx.connect({
Expand All @@ -119,15 +128,6 @@ Onyx.connect({
},
});

let nextSteps = {};
Onyx.connect({
key: ONYXKEYS.COLLECTION.NEXT_STEP,
waitForCollectionCallback: true,
callback: (val) => {
nextSteps = val || {};
},
});

/**
* Initialize money request info
* @param {String} reportID to attach the transaction to
Expand Down Expand Up @@ -2758,7 +2758,7 @@ function getPayMoneyRequestParams(chatReport, iouReport, recipient, paymentMetho
optimisticReportPreviewAction = ReportUtils.updateReportPreview(iouReport, reportPreviewAction, true);
}

const currentNextStep = lodashGet(nextSteps, `${ONYXKEYS.COLLECTION.NEXT_STEP}${iouReport.reportID}`, null);
const currentNextStep = lodashGet(allNextSteps, `${ONYXKEYS.COLLECTION.NEXT_STEP}${iouReport.reportID}`, null);

const optimisticData = [
{
Expand Down Expand Up @@ -2909,7 +2909,7 @@ function sendMoneyWithWallet(report, amount, currency, comment, managerID, recip
}

function approveMoneyRequest(expenseReport) {
const currentNextStep = lodashGet(nextSteps, `${ONYXKEYS.COLLECTION.NEXT_STEP}${expenseReport.reportID}`, null);
const currentNextStep = lodashGet(allNextSteps, `${ONYXKEYS.COLLECTION.NEXT_STEP}${expenseReport.reportID}`, null);

const optimisticApprovedReportAction = ReportUtils.buildOptimisticApprovedReportAction(expenseReport.total, expenseReport.currency, expenseReport.reportID);

Expand Down Expand Up @@ -2980,7 +2980,7 @@ function approveMoneyRequest(expenseReport) {
* @param {Object} expenseReport
*/
function submitReport(expenseReport) {
const currentNextStep = lodashGet(nextSteps, `${ONYXKEYS.COLLECTION.NEXT_STEP}${expenseReport.reportID}`, null);
const currentNextStep = lodashGet(allNextSteps, `${ONYXKEYS.COLLECTION.NEXT_STEP}${expenseReport.reportID}`, null);

const optimisticSubmittedReportAction = ReportUtils.buildOptimisticSubmittedReportAction(expenseReport.total, expenseReport.currency, expenseReport.reportID);
const parentReport = ReportUtils.getReport(expenseReport.parentReportID);
Expand Down
Loading