Skip to content

Commit

Permalink
Merge pull request #39149 from parasharrajat/parasharrajat/quickactio…
Browse files Browse the repository at this point in the history
…ncrash

[CP Staging] Fix crash for unknown action type when getting quick action title
  • Loading branch information
thienlnam authored Mar 29, 2024
2 parents 9d30647 + e43acd0 commit 905e689
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,9 @@ export default {
sendMoney: 'Send Money',
assignTask: 'Assign Task',
shortcut: 'Shortcut',
trackManual: 'Track Manual',
trackScan: 'Track Scan',
trackDistance: 'Track Distance',
},
iou: {
amount: 'Amount',
Expand Down
3 changes: 3 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,9 @@ export default {
sendMoney: 'Enviar Dinero',
assignTask: 'Assignar Tarea',
shortcut: 'Acceso Directo',
trackManual: 'Seguimiento de Gastos',
trackScan: 'Seguimiento de Recibo',
trackDistance: 'Seguimiento de Distancia',
},
iou: {
amount: 'Importe',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ const getQuickActionTitle = (action) => {
return 'quickAction.sendMoney';
case CONST.QUICK_ACTIONS.ASSIGN_TASK:
return 'quickAction.assignTask';
case CONST.QUICK_ACTIONS.TRACK_MANUAL:
return 'quickAction.trackManual';
case CONST.QUICK_ACTIONS.TRACK_SCAN:
return 'quickAction.trackScan';
case CONST.QUICK_ACTIONS.TRACK_DISTANCE:
return 'quickAction.trackDistance';
default:
return '';
}
Expand Down Expand Up @@ -155,6 +161,11 @@ function FloatingActionButtonAndPopover(props) {
return [];
}, [props.personalDetails, props.session.accountID, quickActionReport]);

const quickActionTitle = useMemo(() => {
const titleKey = getQuickActionTitle(props.quickAction && props.quickAction.action);
return titleKey ? translate(titleKey) : '';
}, [props.quickAction, translate]);

const navigateToQuickAction = () => {
switch (props.quickAction.action) {
case CONST.QUICK_ACTIONS.REQUEST_MANUAL:
Expand Down Expand Up @@ -340,7 +351,7 @@ function FloatingActionButtonAndPopover(props) {
? [
{
icon: getQuickActionIcon(props.quickAction.action),
text: translate(getQuickActionTitle(props.quickAction.action)),
text: quickActionTitle,
label: translate('quickAction.shortcut'),
isLabelHoverable: false,
floatRightAvatars: quickActionAvatars,
Expand Down

0 comments on commit 905e689

Please sign in to comment.