From c2648a2ae562fcbd3204e8cc25decbaf124ef602 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 | 65 ++++++++++++++++++- 1 file changed, 62 insertions(+), 3 deletions(-) diff --git a/src/components/Tool/Appeal/List/ContactsList/ContactsList.tsx b/src/components/Tool/Appeal/List/ContactsList/ContactsList.tsx index e0a2c17a60..6cb6446e32 100644 --- a/src/components/Tool/Appeal/List/ContactsList/ContactsList.tsx +++ b/src/components/Tool/Appeal/List/ContactsList/ContactsList.tsx @@ -1,20 +1,40 @@ -import React from 'react'; +import React, { 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; @@ -24,11 +44,33 @@ export const ContactsList: React.FC = ({ appealInfo, appealInfoLoading, }) => { - const { contactsQueryResult, isFiltered, searchTerm, setActiveFilters } = - React.useContext(AppealsContext) as AppealsType; + const { t } = useTranslation(); + const { classes } = useStyles(); + + const { + contactsQueryResult, + isFiltered, + searchTerm, + setActiveFilters, + activeFilters, + contactDetailsOpen, + } = React.useContext(AppealsContext) as AppealsType; const { data, loading, fetchMore } = contactsQueryResult; + 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} + + + + + +