From 9e00dac05a0a2be6f720dae16217a7d203d08363 Mon Sep 17 00:00:00 2001 From: wjames111 Date: Fri, 19 Jul 2024 16:25:51 -0400 Subject: [PATCH] Adds pledge currency options to select dropdown. --- .../Tool/FixCommitmentInfo/Contact.tsx | 40 ++++++++++++++----- src/lib/getCurrencyOptions.tsx | 5 ++- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/components/Tool/FixCommitmentInfo/Contact.tsx b/src/components/Tool/FixCommitmentInfo/Contact.tsx index 728268424..bc1d49d53 100644 --- a/src/components/Tool/FixCommitmentInfo/Contact.tsx +++ b/src/components/Tool/FixCommitmentInfo/Contact.tsx @@ -6,18 +6,24 @@ import { Avatar, Box, Button, + FormHelperText, Grid, IconButton, + InputLabel, Link, + MenuItem, NativeSelect, + Select, TextField, Typography, } from '@mui/material'; import { useTranslation } from 'react-i18next'; import { makeStyles } from 'tss-react/mui'; import { SetContactFocus } from 'pages/accountLists/[accountListId]/tools/useToolsHelper'; +import { useLoadConstantsQuery } from 'src/components/Constants/LoadConstants.generated'; import { FilterOption } from 'src/graphql/types.generated'; import { useAccountListId } from 'src/hooks/useAccountListId'; +import { getPledgeCurrencyOptions } from 'src/lib/getCurrencyOptions'; import theme from '../../../theme'; import { StyledInput } from '../StyledInput'; import { frequencies } from './InputOptions/Frequencies'; @@ -127,6 +133,7 @@ const Contact: React.FC = ({ amount: amount, frequencyValue: frequencyValue, }); + const { data: constants } = useLoadConstantsQuery(); const { classes } = useStyles(); const { t } = useTranslation(); const accountListId = useAccountListId(); @@ -193,16 +200,31 @@ const Contact: React.FC = ({ - + - handleChange(event, 'amountCurrency')} - /> + {t('Currency')} + + diff --git a/src/lib/getCurrencyOptions.tsx b/src/lib/getCurrencyOptions.tsx index 576ba87f1..099b84187 100644 --- a/src/lib/getCurrencyOptions.tsx +++ b/src/lib/getCurrencyOptions.tsx @@ -3,6 +3,7 @@ import { Currency } from 'src/graphql/types.generated'; export const getPledgeCurrencyOptions = ( pledgeCurrencies: Currency[] | undefined | null, + format = 'long', ) => { return pledgeCurrencies?.map( ({ code, codeSymbolString, name }) => @@ -10,7 +11,9 @@ export const getPledgeCurrencyOptions = ( code && codeSymbolString && ( - {name + ' - ' + codeSymbolString} + {format === 'long' + ? name + ' - ' + codeSymbolString + : codeSymbolString} ), );