Skip to content

Commit

Permalink
Update contants names
Browse files Browse the repository at this point in the history
  • Loading branch information
caleballdrin committed Jun 28, 2024
1 parent b3e0d9a commit 8375d61
Show file tree
Hide file tree
Showing 14 changed files with 22 additions and 22 deletions.
10 changes: 5 additions & 5 deletions src/components/Constants/LoadConstants.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ query LoadConstants {
nativeName
shortName
}
likelyToGiveOptions {
likelyToGive {
id
value
}
Expand All @@ -24,12 +24,12 @@ query LoadConstants {
# id
# value
# }
pledgeCurrencies {
pledgeCurrency {
codeSymbolString
name
code
}
pledgeFrequencies {
pledgeFrequency {
id
key
value
Expand All @@ -46,11 +46,11 @@ query LoadConstants {
id
value
}
sendNewsletterOptions {
newsletter {
id
value
}
statuses {
status {
id
value
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Constants/UseApiConstants.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('LoadConstants', () => {

expect(result.current?.activities).toBeTruthy();
expect(result.current?.languages).toBeTruthy();
expect(result.current?.likelyToGiveOptions).toBeTruthy();
expect(result.current?.likelyToGive).toBeTruthy();
expect(result.current?.locations).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ describe('EditPartnershipInfoModal', () => {
mocks={{
LoadConstants: {
constant: {
pledgeCurrencies: [
pledgeCurrency: [
{
code: 'CAD',
codeSymbolString: 'CAD ($)',
Expand Down Expand Up @@ -470,7 +470,7 @@ describe('EditPartnershipInfoModal', () => {
mocks={{
LoadConstants: {
constant: {
pledgeCurrencies: [
pledgeCurrency: [
{
id: 'CAD',
value: 'CAD ($)',
Expand Down Expand Up @@ -696,7 +696,7 @@ describe('EditPartnershipInfoModal', () => {
mocks={{
LoadConstants: {
constant: {
pledgeCurrencies: [
pledgeCurrency: [
{
id: 'CAD',
value: 'CAD ($)',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export const EditPartnershipInfoModal: React.FC<

const [updateContactPartnership, { loading: updating }] =
useUpdateContactPartnershipMutation();
const pledgeCurrencies = constants?.pledgeCurrencies;
const pledgeCurrencies = constants?.pledgeCurrency;

const onSubmit = async (attributes: Attributes) => {
const removedReferrals = contact.contactReferralsToMe.nodes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('PartnershipInfo', () => {
result: {
data: {
constant: {
statuses: [
status: [
{
id: StatusEnum.PartnerFinancial,
value: 'Principal - Financial',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ export const PartnershipInfo: React.FC<PartnershipInfoProp> = ({ contact }) => {
const { data } = useLoadConstantsQuery();
const constants = data?.constant;
const [status, setStatus] = React.useState(
constants?.statuses?.find(({ id }) => id === contact?.status),
constants?.status?.find(({ id }) => id === contact?.status),
);

React.useEffect(() => {
setStatus(constants?.statuses?.find(({ id }) => id === contact?.status));
setStatus(constants?.status?.find(({ id }) => id === contact?.status));
}, [data?.constant]);

const [editPartnershipModalOpen, setEditPartnershipModalOpen] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const ContactFlowColumn: React.FC<Props> = ({
const { data: constants } = useLoadConstantsQuery({});
const statusesStructured =
statuses.map((status) =>
constants?.constant.statuses?.find((constant) => constant.id === status),
constants?.constant.status?.find((constant) => constant.id === status),
) || [];

const cardContentRef = useRef<HTMLDivElement>();
Expand Down Expand Up @@ -157,7 +157,7 @@ export const ContactFlowColumn: React.FC<Props> = ({
id={contact.id}
name={contact.name}
status={
constants?.constant.statuses?.find(
constants?.constant.status?.find(
(constant) => constant.id === contact.status,
) || nullStatus
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ export const MassActionsEditFieldsModal: React.FC<
</MenuItem>
{!loadingConstants &&
getPledgeCurrencyOptions(
constants?.constant?.pledgeCurrencies,
constants?.constant?.pledgeCurrency,
)}
</Select>
</FormControl>
Expand Down
2 changes: 1 addition & 1 deletion src/components/EditDonationModal/EditDonationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const EditDonationModal: React.FC<EditDonationModalProps> = ({
const accountListId = useAccountListId() ?? '';
const constants = useApiConstants();

const pledgeCurrencies = constants?.pledgeCurrencies;
const pledgeCurrencies = constants?.pledgeCurrency;

const {
data: appeals,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export const AddDonation = ({
],
});

const pledgeCurrencies = constants?.pledgeCurrencies;
const pledgeCurrencies = constants?.pledgeCurrency;

const designationAccounts =
designationAccountsData?.designationAccounts?.flatMap(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export const FourteenMonthReport: React.FC<Props> = ({
contact.status ?? '',
contact.pledgeAmount ?? '',
contact.pledgeCurrency ?? '',
apiConstants?.pledgeFrequencies?.find(
apiConstants?.pledgeFrequency?.find(
({ key }) => key === contact.pledgeFrequency,
)?.value ?? '',
pledgedMonthlyEquivalent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export const FourteenMonthReportTable: React.FC<
Math.round(contact.pledgeAmount),
locale,
)} ${contact.pledgeCurrency} ${
apiConstants?.pledgeFrequencies?.find(
apiConstants?.pledgeFrequency?.find(
({ key }) => key === contact.pledgeFrequency,
)?.value ?? ''
}`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const Components: React.FC<ComponentsProps> = ({ currency, expandedPanel }) => (
mocks={{
LoadConstants: {
constant: {
pledgeCurrencies: [
pledgeCurrency: [
{
code: 'CAD',
codeSymbolString: 'CAD ($)',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const CurrencyAccordion: React.FC<CurrencyAccordionProps> = ({
const { enqueueSnackbar } = useSnackbar();
const [updateAccountPreferences] = useUpdateAccountPreferencesMutation();
const constants = useApiConstants();
const currencies = constants?.pledgeCurrencies ?? [];
const currencies = constants?.pledgeCurrency ?? [];
const label = t('Default Currency');

const onSubmit = async (
Expand Down

0 comments on commit 8375d61

Please sign in to comment.