From 0d73adeadbce453e272ac786ebfdfd2f13ec4127 Mon Sep 17 00:00:00 2001 From: Daniel Bisgrove Date: Mon, 19 Aug 2024 16:01:40 -0400 Subject: [PATCH] Added Column names --- .../Appeal/List/ContactsList/ContactsList.tsx | 58 ++++++++++++++++++- 1 file changed, 55 insertions(+), 3 deletions(-) diff --git a/src/components/Tool/Appeal/List/ContactsList/ContactsList.tsx b/src/components/Tool/Appeal/List/ContactsList/ContactsList.tsx index 2eceda977..e63e4c8ce 100644 --- a/src/components/Tool/Appeal/List/ContactsList/ContactsList.tsx +++ b/src/components/Tool/Appeal/List/ContactsList/ContactsList.tsx @@ -1,21 +1,40 @@ -import React, { useEffect } from 'react'; +import React, { useEffect, useMemo } from 'react'; +import { Grid, Typography } from '@mui/material'; import { Box } from '@mui/system'; import { useTranslation } from 'react-i18next'; +import { makeStyles } from 'tss-react/mui'; import { InfiniteList } from 'src/components/InfiniteList/InfiniteList'; import { navBarHeight } from 'src/components/Layouts/Primary/Primary'; import NullState from 'src/components/Shared/Filters/NullState/NullState'; import { headerHeight } from 'src/components/Shared/Header/ListHeader'; +import theme from 'src/theme'; import { AppealHeaderInfo, appealHeaderInfoHeight, } from '../../AppealDetails/AppealHeaderInfo'; import { AppealQuery } from '../../AppealDetails/AppealsMainPanel/appealInfo.generated'; import { + AppealStatusEnum, AppealsContext, AppealsType, } from '../../AppealsContext/AppealsContext'; import { ContactRow } from '../ContactRow/ContactRow'; +const useStyles = makeStyles()(() => ({ + headerContainer: { + borderBottom: `1px solid ${theme.palette.cruGrayLight.main}`, + }, + contactHeader: { + padding: theme.spacing(1, 2), + }, + givingHeader: { + padding: '8px 16px 8px 30px', + [theme.breakpoints.down('md')]: { + padding: '8px 16px 8px 8px', + }, + }, +})); + interface ContactsListProps { appealInfo?: AppealQuery; appealInfoLoading: boolean; @@ -25,15 +44,18 @@ export const ContactsList: React.FC = ({ appealInfo, appealInfoLoading, }) => { + const { t } = useTranslation(); + const { classes } = useStyles(); + const [nullStateTitle, setNullStateTitle] = React.useState(''); + const { contactsQueryResult, isFiltered, searchTerm, setActiveFilters, activeFilters, + contactDetailsOpen, } = React.useContext(AppealsContext) as AppealsType; - const { t } = useTranslation(); - const [nullStateTitle, setNullStateTitle] = React.useState(''); const { data, loading, fetchMore } = contactsQueryResult; @@ -71,6 +93,19 @@ export const ContactsList: React.FC = ({ } }, [activeFilters]); + const columnName = useMemo(() => { + let name = t('Regular Giving'); + if ( + activeFilters.appealStatus === AppealStatusEnum.NotReceived || + activeFilters.appealStatus === AppealStatusEnum.ReceivedNotProcessed + ) { + name = t('Amount Committed'); + } else if (activeFilters.appealStatus === AppealStatusEnum.Processed) { + name = t('Donation(s)'); + } + return name; + }, [activeFilters]); + return ( <> = ({ loading={appealInfoLoading} /> + + + + {t('Contact')} + + + + + + + {columnName} + + + + + +