diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json
index dc4f2caae..1e538370d 100644
--- a/public/locales/en/translation.json
+++ b/public/locales/en/translation.json
@@ -176,8 +176,24 @@
"(Quarter)": "(Quarter)",
"(Sent by {{firstName}} {{lastName}})": "(Sent by {{firstName}} {{lastName}})",
"(Year)": "(Year)",
+ "Change history": "Change history",
+ "Confirm addresses": "Confirm addresses",
"Dismiss": "Dismiss",
+ "MPDX started saving who made each change in Nov 2026. Changes made in MPDX before then don't have a name.": "MPDX started saving who made each change in Nov 2026. Changes made in MPDX before then don't have a name.",
+ "No address changes for \"{{search}}\"": "No address changes for \"{{search}}\"",
+ "No address changes for \"{{search}}\" in the last 12 months": "No address changes for \"{{search}}\" in the last 12 months",
+ "No address changes for \"{{search}}\" in the last 3 months": "No address changes for \"{{search}}\" in the last 3 months",
+ "No address changes for \"{{search}}\" in the last 6 months": "No address changes for \"{{search}}\" in the last 6 months",
+ "No address changes for \"{{search}}\" in the selected dates": "No address changes for \"{{search}}\" in the selected dates",
+ "Partner name or address": "Partner name or address",
+ "Pick each partner's primary address.": "Pick each partner's primary address.",
+ "Primary email (current)": "Primary email (current)",
+ "Primary phone (current)": "Primary phone (current)",
"Review your goal, see how to present it to partners, and read your next steps. We also emailed you the full worksheet as a PDF.": "Review your goal, see how to present it to partners, and read your next steps. We also emailed you the full worksheet as a PDF.",
+ "Search all dates": "Search all dates",
+ "See what changed, when, and by whom.": "See what changed, when, and by whom.",
+ "There may be older changes, or the partner may not match your other filters.": "There may be older changes, or the partner may not match your other filters.",
+ "Try a different search, or clear your filters.": "Try a different search, or clear your filters.",
"View my MPD goal": "View my MPD goal",
"Your goal changed since you last looked. Review the updated worksheet, which was also emailed to you as a PDF.": "Your goal changed since you last looked. Review the updated worksheet, which was also emailed to you as a PDF.",
"Your MPD goal is ready": "Your MPD goal is ready",
@@ -258,6 +274,8 @@
"{{count}} Selected_other": "{{count}} Selected",
"{{count}} staff_one": "{{count}} staff",
"{{count}} staff_other": "{{count}} staff",
+ "{{count}} to confirm_one": "{{count}} to confirm",
+ "{{count}} to confirm_other": "{{count}} to confirm",
"{{count}} were automatic_one": "{{count}} was automatic",
"{{count}} were automatic_other": "{{count}} were automatic",
"{{count}} years_one": "{{count}} years",
@@ -855,7 +873,6 @@
"Chalk Line is a significant way to save valuable ministry time while more effectively\n connecting with your partners. Send physical newsletters to your current list using\n Chalk Line with a simple click. Chalk Line is a one way send available anytime you’re\n ready to send a new newsletter out.": "Chalk Line is a significant way to save valuable ministry time while more effectively\n connecting with your partners. Send physical newsletters to your current list using\n Chalk Line with a simple click. Chalk Line is a one way send available anytime you’re\n ready to send a new newsletter out.",
"Chalk Line Overview": "Chalk Line Overview",
"Change Coach": "Change Coach",
- "Change History": "Change History",
"Change made by": "Change made by",
"Change the contact's status to: {{status}}": "Change the contact's status to: {{status}}",
"Change the Geographic Multiplier in the staff member's details to recalculate it. Interns, part-time field staff and volunteers have no New Staff Monthly Salary, so they have no Geographic Multiplier to change.": "Change the Geographic Multiplier in the staff member's details to recalculate it. Interns, part-time field staff and volunteers have no New Staff Monthly Salary, so they have no Geographic Multiplier to change.",
@@ -3501,7 +3518,6 @@
"To be Developed: {{amount}}": "To be Developed: {{amount}}",
"To change this amount, update the Reimbursable Expenses step": "To change this amount, update the Reimbursable Expenses step",
"to check it out and get started saving for future needs!": "to check it out and get started saving for future needs!",
- "To Confirm": "To Confirm",
"To Do This Week": "To Do This Week",
"To get started, we're going to walk with you through a few key steps to set you up for success in {{appName}}!": "To get started, we're going to walk with you through a few key steps to set you up for success in {{appName}}!",
"To import your TntConnect database, go to Import from TntConnect": "To import your TntConnect database, go to Import from TntConnect",
diff --git a/public/locales/en/translation_old.json b/public/locales/en/translation_old.json
index 2947082a1..9a8831571 100644
--- a/public/locales/en/translation_old.json
+++ b/public/locales/en/translation_old.json
@@ -101,6 +101,7 @@
"Cannot upload file: file size cannot exceed 1MB": "Cannot upload file: file size cannot exceed 1MB",
"Cell phone number is required": "Cell phone number is required",
"Change": "Change",
+ "Change History": "Change History",
"Change the Geographic Multiplier in the staff member's details to recalculate it.": "Change the Geographic Multiplier in the staff member's details to recalculate it.",
"Check": "Check",
"Clear Filters": "Clear Filters",
@@ -559,6 +560,7 @@
"This updated request will take the place of your previous request. Once submitted, you can return and make edits until {{date}}. After this date, your request will be processed as is.": "This updated request will take the place of your previous request. Once submitted, you can return and make edits until {{date}}. After this date, your request will be processed as is.",
"This will log you in on behalf of the user specified below. You will be able to see what the user sees on {{appName}}.\n Impersonation sessions have 20 minute timeout where you will automatically be logged out of the user's account after\n the specified amount of time. Once you are finished impersonating, click 'Exit Impersonation Mode' at the top of the\n page.": "This will log you in on behalf of the user specified below. You will be able to see what the user sees on {{appName}}.\n Impersonation sessions have 20 minute timeout where you will automatically be logged out of the user's account after\n the specified amount of time. Once you are finished impersonating, click 'Exit Impersonation Mode' at the top of the\n page.",
"This Year": "This Year",
+ "To Confirm": "To Confirm",
"To Do": "To Do",
"To set a one-time savings goal, click \"Add One-time Goal\" to create a new row in the goal table. In the left cell of the new row, enter the name of your goal—for example, \"Car.\" Then, in the right cell, enter the full dollar amount you need to raise, such as 15000.": "To set a one-time savings goal, click \"Add One-time Goal\" to create a new row in the goal table. In the left cell of the new row, enter the name of your goal—for example, \"Car.\" Then, in the right cell, enter the full dollar amount you need to raise, such as 15000.",
"TO_DO": "To Do",
diff --git a/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/AddressChangeEmptyState/AddressChangeSearchEmptyState.test.tsx b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/AddressChangeEmptyState/AddressChangeSearchEmptyState.test.tsx
new file mode 100644
index 000000000..58b2b2cc3
--- /dev/null
+++ b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/AddressChangeEmptyState/AddressChangeSearchEmptyState.test.tsx
@@ -0,0 +1,81 @@
+import { ThemeProvider } from '@mui/material/styles';
+import { render } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { ContactFilterChangedDuringEnum } from 'src/components/Shared/Filters/ChangedDuring/changedDuring';
+import theme from 'src/theme';
+import { AddressChangeSearchEmptyState } from './AddressChangeSearchEmptyState';
+
+const onSearchAllDates = jest.fn();
+const onClearFilters = jest.fn();
+
+const renderEmptyState = (
+ changedDuring: ContactFilterChangedDuringEnum | null,
+) =>
+ render(
+
+
+ ,
+ );
+
+describe('AddressChangeSearchEmptyState', () => {
+ it.each([
+ [ContactFilterChangedDuringEnum.Last3Months, 'in the last 3 months'],
+ [ContactFilterChangedDuringEnum.Last6Months, 'in the last 6 months'],
+ [ContactFilterChangedDuringEnum.Last12Months, 'in the last 12 months'],
+ [ContactFilterChangedDuringEnum.Custom, 'in the selected dates'],
+ ])('names the search and the %s range', (changedDuring, range) => {
+ const { getByRole, getByText } = renderEmptyState(changedDuring);
+
+ expect(
+ getByRole('heading', { name: `No address changes for "Smith" ${range}` }),
+ ).toBeInTheDocument();
+ expect(
+ getByText(
+ 'There may be older changes, or the partner may not match your other filters.',
+ ),
+ ).toBeInTheDocument();
+ });
+
+ it('is announced to screen readers', () => {
+ const { getByTestId } = renderEmptyState(
+ ContactFilterChangedDuringEnum.Last12Months,
+ );
+
+ expect(getByTestId('address-changes-null-state')).toHaveAttribute(
+ 'role',
+ 'status',
+ );
+ });
+
+ it('searches all dates or clears the filters', () => {
+ const { getByRole } = renderEmptyState(
+ ContactFilterChangedDuringEnum.Last12Months,
+ );
+
+ userEvent.click(getByRole('button', { name: 'Search all dates' }));
+ expect(onSearchAllDates).toHaveBeenCalled();
+
+ userEvent.click(getByRole('button', { name: 'Clear filters' }));
+ expect(onClearFilters).toHaveBeenCalled();
+ });
+
+ it('hides Search all dates when the range is already any time', () => {
+ const { getByRole, queryByRole, getByText } = renderEmptyState(null);
+
+ expect(
+ getByRole('heading', { name: 'No address changes for "Smith"' }),
+ ).toBeInTheDocument();
+ expect(
+ getByText('Try a different search, or clear your filters.'),
+ ).toBeInTheDocument();
+ expect(
+ queryByRole('button', { name: 'Search all dates' }),
+ ).not.toBeInTheDocument();
+ expect(getByRole('button', { name: 'Clear filters' })).toBeInTheDocument();
+ });
+});
diff --git a/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/AddressChangeEmptyState/AddressChangeSearchEmptyState.tsx b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/AddressChangeEmptyState/AddressChangeSearchEmptyState.tsx
new file mode 100644
index 000000000..f8498a207
--- /dev/null
+++ b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/AddressChangeEmptyState/AddressChangeSearchEmptyState.tsx
@@ -0,0 +1,72 @@
+import React from 'react';
+import SearchIcon from '@mui/icons-material/Search';
+import { Box, Button, Typography } from '@mui/material';
+import { TFunction, useTranslation } from 'react-i18next';
+import { ContactFilterChangedDuringEnum } from 'src/components/Shared/Filters/ChangedDuring/changedDuring';
+import { NullStateBox } from 'src/components/Shared/Filters/NullState/NullStateBox';
+
+const getTitle = (
+ search: string,
+ changedDuring: ContactFilterChangedDuringEnum | null,
+ t: TFunction,
+): string => {
+ if (!changedDuring) {
+ return t('No address changes for "{{search}}"', { search });
+ }
+ const titles: Record = {
+ [ContactFilterChangedDuringEnum.Last3Months]: t(
+ 'No address changes for "{{search}}" in the last 3 months',
+ { search },
+ ),
+ [ContactFilterChangedDuringEnum.Last6Months]: t(
+ 'No address changes for "{{search}}" in the last 6 months',
+ { search },
+ ),
+ [ContactFilterChangedDuringEnum.Last12Months]: t(
+ 'No address changes for "{{search}}" in the last 12 months',
+ { search },
+ ),
+ [ContactFilterChangedDuringEnum.Custom]: t(
+ 'No address changes for "{{search}}" in the selected dates',
+ { search },
+ ),
+ };
+ return titles[changedDuring];
+};
+
+interface AddressChangeSearchEmptyStateProps {
+ search: string;
+ changedDuring: ContactFilterChangedDuringEnum | null;
+ onSearchAllDates: () => void;
+ onClearFilters: () => void;
+}
+
+export const AddressChangeSearchEmptyState: React.FC<
+ AddressChangeSearchEmptyStateProps
+> = ({ search, changedDuring, onSearchAllDates, onClearFilters }) => {
+ const { t } = useTranslation();
+
+ return (
+
+
+
+ {getTitle(search, changedDuring, t)}
+
+
+ {changedDuring
+ ? t(
+ 'There may be older changes, or the partner may not match your other filters.',
+ )
+ : t('Try a different search, or clear your filters.')}
+
+
+ {changedDuring && (
+
+ )}
+
+
+
+ );
+};
diff --git a/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/AddressChangeHistory.graphql b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/AddressChangeHistory.graphql
index 6c353db7c..3498534d9 100644
--- a/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/AddressChangeHistory.graphql
+++ b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/AddressChangeHistory.graphql
@@ -5,6 +5,7 @@ query AddressChangeHistory(
$startDate: ISO8601Date
$endDate: ISO8601Date
$madeBy: [ID!]
+ $search: String
) {
addressChangeHistory(
accountListId: $accountListId
@@ -14,6 +15,7 @@ query AddressChangeHistory(
startDate: $startDate
endDate: $endDate
madeBy: $madeBy
+ search: $search
) {
nodes {
id
@@ -21,6 +23,8 @@ query AddressChangeHistory(
partnerName
partnerStatus
donorAccountNumbers
+ partnerPhone
+ partnerEmail
street
city
state
diff --git a/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/AddressFilters/AddressFilters.test.tsx b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/AddressFilters/AddressFilters.test.tsx
new file mode 100644
index 000000000..101b95388
--- /dev/null
+++ b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/AddressFilters/AddressFilters.test.tsx
@@ -0,0 +1,117 @@
+import { ThemeProvider } from '@mui/material/styles';
+import { LocalizationProvider } from '@mui/x-date-pickers';
+import { AdapterLuxon } from '@mui/x-date-pickers/AdapterLuxon';
+import { render, within } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
+import { ContactFilterPartnerEnum } from 'src/graphql/types.generated';
+import theme from 'src/theme';
+import {
+ currentUserId,
+ mockAddressChangeHistory,
+} from '../ChangeHistoryAddressesMock';
+import { AddressFilters } from './AddressFilters';
+
+const onSearchChange = jest.fn();
+
+const TestComponent: React.FC<{ search?: string }> = ({ search = '' }) => (
+
+
+
+
+
+
+
+);
+
+const notRecordedHelp =
+ "MPDX started saving who made each change in Nov 2026. Changes made in MPDX before then don't have a name.";
+
+describe('AddressFilters', () => {
+ it('puts the search field first', () => {
+ const { getByRole, container } = render();
+
+ const search = getByRole('searchbox', { name: 'Search' });
+ expect(search).toHaveAttribute('placeholder', 'Partner name or address');
+ expect(container.querySelector('input, [role="combobox"]')).toBe(search);
+ });
+
+ it('reports what is typed in the search field', () => {
+ const { getByRole } = render();
+
+ userEvent.type(getByRole('searchbox', { name: 'Search' }), 'S');
+
+ expect(onSearchChange).toHaveBeenLastCalledWith('S');
+ });
+
+ it('shows the current search', () => {
+ const { getByRole } = render();
+
+ expect(getByRole('searchbox', { name: 'Search' })).toHaveValue('Smith');
+ });
+
+ it('explains "Not recorded" in a tooltip on hover', async () => {
+ const { getByRole, findByRole } = render();
+
+ userEvent.click(getByRole('combobox', { name: 'Change made by' }));
+ // Found by text: while the tooltip is closed, MUI copies its text into the option's title
+ const option = within(await findByRole('listbox'))
+ .getByText('Not recorded (before Nov 2026)')
+ .closest('li');
+ expect(option).toHaveAttribute('role', 'option');
+ userEvent.hover(option!);
+
+ const tooltip = await findByRole('tooltip');
+ expect(tooltip).toHaveTextContent(notRecordedHelp);
+ expect(option).toHaveAttribute('aria-describedby', tooltip.id);
+ });
+
+ it('explains "Not recorded" in a tooltip on keyboard focus', async () => {
+ // jsdom has no :focus-visible, so MUI's Tooltip would never open on focus.
+ // Treat the focused element as focus-visible, as a browser does for keyboard focus.
+ const matches = Element.prototype.matches;
+ const matchesSpy = jest
+ .spyOn(Element.prototype, 'matches')
+ .mockImplementation(function (this: Element, selector: string) {
+ return selector === ':focus-visible'
+ ? this === document.activeElement
+ : matches.call(this, selector);
+ });
+ try {
+ const { getByRole, findByRole } = render();
+
+ userEvent.click(getByRole('combobox', { name: 'Change made by' }));
+ await findByRole('listbox');
+ userEvent.keyboard('{end}');
+
+ expect(await findByRole('tooltip')).toHaveTextContent(notRecordedHelp);
+ } finally {
+ matchesSpy.mockRestore();
+ }
+ });
+
+ it('keeps the other choices free of the tooltip', async () => {
+ const { getByRole, findByRole, queryByRole } = render();
+
+ userEvent.click(getByRole('combobox', { name: 'Change made by' }));
+ userEvent.hover(
+ within(await findByRole('listbox')).getByRole('option', {
+ name: 'Jane Smith',
+ }),
+ );
+
+ expect(queryByRole('tooltip')).not.toBeInTheDocument();
+ });
+});
diff --git a/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/AddressFilters/AddressFilters.tsx b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/AddressFilters/AddressFilters.tsx
index c25880a0b..dd5d750c2 100644
--- a/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/AddressFilters/AddressFilters.tsx
+++ b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/AddressFilters/AddressFilters.tsx
@@ -1,11 +1,14 @@
import React from 'react';
+import SearchIcon from '@mui/icons-material/Search';
import {
Box,
FormControl,
+ InputAdornment,
InputLabel,
ListSubheader,
MenuItem,
Select,
+ TextField,
} from '@mui/material';
import { useTranslation } from 'react-i18next';
import { ChangedDuringSelect } from 'src/components/Shared/Filters/ChangedDuring/ChangedDuringSelect';
@@ -21,6 +24,7 @@ import {
formatPartnerFilter,
groupMadeByOptions,
} from '../helpers';
+import { MadeByMenuItem } from './MadeByMenuItem';
const partnerOptions = [
ContactFilterPartnerEnum.GaveOneOrMore,
@@ -29,6 +33,8 @@ const partnerOptions = [
];
interface AddressFiltersProps {
+ search: string;
+ onSearchChange: (search: string) => void;
partners: ContactFilterPartnerEnum;
onPartnersChange: (partners: ContactFilterPartnerEnum) => void;
changedDuring: ContactFilterChangedDuringEnum | null;
@@ -43,6 +49,8 @@ interface AddressFiltersProps {
}
export const AddressFilters: React.FC = ({
+ search,
+ onSearchChange,
partners,
onPartnersChange,
changedDuring,
@@ -64,8 +72,27 @@ export const AddressFilters: React.FC = ({
);
return (
-
-
+
+ onSearchChange(event.target.value)}
+ sx={{ flex: '2 1 240px' }}
+ slotProps={{
+ inputLabel: { shrink: true },
+ input: {
+ startAdornment: (
+
+
+
+ ),
+ },
+ }}
+ />
+
{t('Partner')}
@@ -83,7 +110,7 @@ export const AddressFilters: React.FC = ({
))}
-
+
{t('Changed during')}
@@ -97,7 +124,7 @@ export const AddressFilters: React.FC = ({
onCustomRangeApply={onDateRangeChange}
/>
-
+
{t('Change made by')}
@@ -126,9 +153,13 @@ export const AddressFilters: React.FC = ({
)}
{mpdxOptions.map((option) => (
-
+
))}
diff --git a/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/AddressFilters/MadeByMenuItem.tsx b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/AddressFilters/MadeByMenuItem.tsx
new file mode 100644
index 000000000..769496fa1
--- /dev/null
+++ b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/AddressFilters/MadeByMenuItem.tsx
@@ -0,0 +1,34 @@
+import React, { forwardRef } from 'react';
+import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
+import { MenuItem, MenuItemProps, Tooltip } from '@mui/material';
+
+interface MadeByMenuItemProps extends MenuItemProps {
+ tooltip?: string;
+}
+
+// The Select shows the chosen item's children as its value, so the info icon stays outside children.
+export const MadeByMenuItem = forwardRef(
+ ({ tooltip, children, ...props }, ref) => {
+ if (!tooltip) {
+ return (
+
+ );
+ }
+
+ return (
+
+
+
+ );
+ },
+);
+MadeByMenuItem.displayName = 'MadeByMenuItem';
diff --git a/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/ChangeHistoryAddresses.tsx b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/ChangeHistoryAddresses.tsx
index caa5d07c2..7e2a4e9cd 100644
--- a/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/ChangeHistoryAddresses.tsx
+++ b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/ChangeHistoryAddresses.tsx
@@ -2,6 +2,8 @@ import React, { useState } from 'react';
import { Box, Typography } from '@mui/material';
import { useTranslation } from 'react-i18next';
import { AddressHistoryModal } from 'src/components/Shared/AddressHistoryModal/AddressHistoryModal';
+import { AddressChangeEmptyState } from './AddressChangeEmptyState/AddressChangeEmptyState';
+import { AddressChangeSearchEmptyState } from './AddressChangeEmptyState/AddressChangeSearchEmptyState';
import {
AddressChangeHistoryQueryVariables,
useAddressChangeHistoryQuery,
@@ -49,6 +51,7 @@ export const ChangeHistoryAddresses: React.FC = ({
startDate: filters.dateRange?.startDate?.toISODate() ?? undefined,
endDate: filters.dateRange?.endDate?.toISODate() ?? undefined,
madeBy: filters.madeBy ? [filters.madeBy] : undefined,
+ search: filters.debouncedSearch || undefined,
};
const { data, previousData, loading, error, fetchMore, refetch } =
useAddressChangeHistoryQuery({ variables });
@@ -75,10 +78,14 @@ export const ChangeHistoryAddresses: React.FC = ({
= ({
onRetry={retry}
history={history}
dateRange={filters.dateRange}
- emptyStateFilter={filters.emptyStateFilter}
+ emptyState={
+ filters.debouncedSearch ? (
+
+ ) : (
+
+ )
+ }
loadMoreFailed={loadMoreFailed}
onRetryLoadMore={fetchNextPage}
onEndReached={loadMore}
diff --git a/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/ChangeHistoryAddressesMock.ts b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/ChangeHistoryAddressesMock.ts
index c0b0e57f3..a3e3cd272 100644
--- a/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/ChangeHistoryAddressesMock.ts
+++ b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/ChangeHistoryAddressesMock.ts
@@ -29,6 +29,8 @@ export const mockAddressChanges: AddressChangeRow[] = [
partnerName: 'Dalmation, Pongo and Perdita',
partnerStatus: StatusEnum.PartnerFinancial,
donorAccountNumbers: '10001',
+ partnerPhone: '(206) 555-0100',
+ partnerEmail: 'pongo@example.com',
street: '2125 6th Ave W',
city: 'Seattle',
state: 'WA',
diff --git a/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/ChangeHistoryAddressesSearch.test.tsx b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/ChangeHistoryAddressesSearch.test.tsx
new file mode 100644
index 000000000..9ef404665
--- /dev/null
+++ b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/ChangeHistoryAddressesSearch.test.tsx
@@ -0,0 +1,218 @@
+import { ThemeProvider } from '@mui/material/styles';
+import { LocalizationProvider } from '@mui/x-date-pickers';
+import { AdapterLuxon } from '@mui/x-date-pickers/AdapterLuxon';
+import { render, waitFor, within } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { Settings } from 'luxon';
+import { VirtuosoMockContext } from 'react-virtuoso';
+import TestRouter from '__tests__/util/TestRouter';
+import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
+import matchMediaMock from '__tests__/util/matchMediaMock';
+import { ContactPanelProvider } from 'src/components/Shared/ContactPanelProvider/ContactPanelProvider';
+import { UserPreferenceContext } from 'src/components/User/Preferences/UserPreferenceProvider';
+import theme from 'src/theme';
+import { AddressChangeHistoryQuery } from './AddressChangeHistory.generated';
+import { ChangeHistoryAddresses } from './ChangeHistoryAddresses';
+import {
+ currentUserId,
+ mockAddressChangeHistory,
+} from './ChangeHistoryAddressesMock';
+
+const accountListId = 'account-list-1';
+const mutationSpy = jest.fn();
+
+type History = AddressChangeHistoryQuery['addressChangeHistory'];
+
+const emptyHistory: History = {
+ ...mockAddressChangeHistory,
+ nodes: [],
+ contactIds: [],
+ totalCount: 0,
+ automaticCount: 0,
+};
+
+const TestComponent: React.FC<{ history?: History }> = ({
+ history = mockAddressChangeHistory,
+}) => (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+);
+
+describe('ChangeHistoryAddresses search', () => {
+ const nowMillis = Settings.now;
+ beforeEach(() => {
+ matchMediaMock({ pointer: 'fine' });
+ Settings.now = () => new Date(2026, 9, 14, 15).valueOf();
+ });
+ afterEach(() => {
+ Settings.now = nowMillis;
+ });
+
+ const searchFor = (
+ { getByRole }: ReturnType,
+ search: string,
+ ) => userEvent.type(getByRole('searchbox', { name: 'Search' }), search);
+
+ it('sends the search with the other filters once typing stops', async () => {
+ const utils = render();
+ await utils.findByText('4 were automatic');
+
+ searchFor(utils, ' Smith ');
+
+ await waitFor(() =>
+ expect(mutationSpy).toHaveGraphqlOperation('AddressChangeHistory', {
+ accountListId,
+ search: 'Smith',
+ startDate: '2025-10-14',
+ endDate: '2026-10-14',
+ }),
+ );
+ expect(mutationSpy).not.toHaveGraphqlOperation('AddressChangeHistory', {
+ search: 'Smi',
+ });
+ });
+
+ it('keeps the search when loading the next page', async () => {
+ const utils = render(
+ ,
+ );
+ await utils.findByText('4 were automatic');
+ mutationSpy.mockClear();
+
+ searchFor(utils, 'Smith');
+
+ await waitFor(() =>
+ expect(mutationSpy).toHaveGraphqlOperation('AddressChangeHistory', {
+ search: 'Smith',
+ after: 'cursor-1',
+ }),
+ );
+ });
+
+ it('shows the search empty state, then widens only the date range', async () => {
+ const utils = render();
+ searchFor(utils, 'Smith');
+
+ expect(
+ await utils.findByRole('heading', {
+ name: 'No address changes for "Smith" in the last 12 months',
+ }),
+ ).toBeInTheDocument();
+
+ mutationSpy.mockClear();
+ userEvent.click(utils.getByRole('button', { name: 'Search all dates' }));
+
+ expect(
+ await utils.findByRole('heading', {
+ name: 'No address changes for "Smith"',
+ }),
+ ).toBeInTheDocument();
+ expect(
+ utils.getByRole('combobox', { name: 'Changed during' }),
+ ).toHaveTextContent('Any time');
+ expect(utils.getByRole('searchbox', { name: 'Search' })).toHaveValue(
+ 'Smith',
+ );
+ await waitFor(() =>
+ expect(mutationSpy).toHaveGraphqlOperation('AddressChangeHistory', {
+ accountListId,
+ search: 'Smith',
+ startDate: undefined,
+ endDate: undefined,
+ }),
+ );
+ });
+
+ it('clears the search and every filter', async () => {
+ const utils = render();
+ userEvent.click(utils.getByRole('combobox', { name: 'Partner' }));
+ userEvent.click(
+ within(await utils.findByRole('listbox')).getByRole('option', {
+ name: 'Lost Partners',
+ }),
+ );
+ searchFor(utils, 'Smith');
+ await utils.findByRole('button', { name: 'Clear filters' });
+ mutationSpy.mockClear();
+
+ userEvent.click(utils.getByRole('button', { name: 'Clear filters' }));
+
+ expect(utils.getByRole('searchbox', { name: 'Search' })).toHaveValue('');
+ expect(utils.getByRole('combobox', { name: 'Partner' })).toHaveTextContent(
+ 'All Partners',
+ );
+ expect(
+ utils.getByRole('combobox', { name: 'Changed during' }),
+ ).toHaveTextContent('Last 12 Months');
+ expect(
+ utils.getByRole('combobox', { name: 'Change made by' }),
+ ).toHaveTextContent('Anyone');
+ expect(
+ await utils.findByText('No address changes in the last 12 months'),
+ ).toBeInTheDocument();
+ // The cleared search must not linger in a request with the reset filters
+ expect(mutationSpy).not.toHaveGraphqlOperation('AddressChangeHistory', {
+ search: 'Smith',
+ });
+ });
+
+ it('ignores a search of only spaces', async () => {
+ const utils = render();
+ await utils.findByText('No address changes in the last 12 months');
+ mutationSpy.mockClear();
+
+ searchFor(utils, ' ');
+
+ // Past the debounce, so a search that was going to be sent has been
+ await new Promise((resolve) => setTimeout(resolve, 600));
+ expect(mutationSpy).not.toHaveGraphqlOperation('AddressChangeHistory', {
+ search: ' ',
+ });
+ expect(
+ utils.getByText('No address changes in the last 12 months'),
+ ).toBeInTheDocument();
+ });
+
+ it('does not bring back a cleared search when typing again right away', async () => {
+ const utils = render();
+ searchFor(utils, 'Smith');
+ await utils.findByRole('button', { name: 'Clear filters' });
+
+ userEvent.click(utils.getByRole('button', { name: 'Clear filters' }));
+ searchFor(utils, 'J');
+
+ // The cached "Smith" results would show at once if the old search came back
+ expect(
+ utils.queryByRole('heading', { name: /"Smith"/ }),
+ ).not.toBeInTheDocument();
+ expect(
+ await utils.findByRole('heading', { name: /"J"/ }),
+ ).toBeInTheDocument();
+ });
+});
diff --git a/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/ChangeHistoryResults/ChangeHistoryResults.tsx b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/ChangeHistoryResults/ChangeHistoryResults.tsx
index 0fe3ffde9..41f02db85 100644
--- a/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/ChangeHistoryResults/ChangeHistoryResults.tsx
+++ b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/ChangeHistoryResults/ChangeHistoryResults.tsx
@@ -3,10 +3,6 @@ import { ApolloError } from '@apollo/client';
import { Alert, Box, Button, CircularProgress } from '@mui/material';
import { useTranslation } from 'react-i18next';
import { DateRange } from 'src/components/Shared/Filters/ChangedDuring/changedDuring';
-import {
- AddressChangeEmptyState,
- AddressChangeFilter,
-} from '../AddressChangeEmptyState/AddressChangeEmptyState';
import { AddressChangeHistoryQuery } from '../AddressChangeHistory.generated';
import { AddressChangeSummary } from '../AddressChangeSummary/AddressChangeSummary';
import { AddressChangeTable } from '../AddressChangeTable/AddressChangeTable';
@@ -19,7 +15,7 @@ interface ChangeHistoryResultsProps {
onRetry: () => void;
history: AddressChangeHistoryQuery['addressChangeHistory'] | undefined;
dateRange: DateRange | null;
- emptyStateFilter: AddressChangeFilter;
+ emptyState: React.ReactElement;
loadMoreFailed: boolean;
onRetryLoadMore: () => void;
onEndReached: () => void;
@@ -33,7 +29,7 @@ export const ChangeHistoryResults: React.FC = ({
onRetry,
history,
dateRange,
- emptyStateFilter,
+ emptyState,
loadMoreFailed,
onRetryLoadMore,
onEndReached,
@@ -66,7 +62,7 @@ export const ChangeHistoryResults: React.FC = ({
return null;
}
if (!history.totalCount) {
- return ;
+ return emptyState;
}
return (
diff --git a/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/ExportCsvButton/downloadAddressChanges.test.ts b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/ExportCsvButton/downloadAddressChanges.test.ts
index 7ae317840..246c8191e 100644
--- a/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/ExportCsvButton/downloadAddressChanges.test.ts
+++ b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/ExportCsvButton/downloadAddressChanges.test.ts
@@ -29,6 +29,8 @@ describe('createAddressChangesCsv', () => {
'Address',
'Previous Address',
'Made by',
+ 'Primary phone (current)',
+ 'Primary email (current)',
]);
expect(rows[1]).toEqual([
'Sep 30, 2026',
@@ -38,6 +40,8 @@ describe('createAddressChangesCsv', () => {
'2125 6th Ave W, Seattle, WA 98119',
'98 Lake St, Seattle, WA 98109',
'Automatic update from US Donation Services',
+ '(206) 555-0100',
+ 'pongo@example.com',
]);
});
@@ -53,6 +57,18 @@ describe('createAddressChangesCsv', () => {
expect(rows[6][1]).toBe('Doe, John and Jane');
expect(rows[6][5]).toBe('');
});
+
+ it('leaves the phone and email blank when the partner has none', () => {
+ const rows = createAddressChangesCsv({
+ addressChanges: mockAddressChanges,
+ currentUserId,
+ getStatusLabel,
+ t: i18n.t,
+ locale: 'en-US',
+ });
+
+ expect(rows[6].slice(-2)).toEqual(['', '']);
+ });
});
describe('downloadAddressChanges', () => {
diff --git a/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/ExportCsvButton/downloadAddressChanges.ts b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/ExportCsvButton/downloadAddressChanges.ts
index 8ea91a124..f34617aed 100644
--- a/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/ExportCsvButton/downloadAddressChanges.ts
+++ b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/ExportCsvButton/downloadAddressChanges.ts
@@ -32,6 +32,8 @@ export const createAddressChangesCsv = ({
t('Address'),
t('Previous Address'),
t('Made by'),
+ t('Primary phone (current)'),
+ t('Primary email (current)'),
],
...addressChanges.map((addressChange) => [
dateFormat(DateTime.fromISO(addressChange.date), locale),
@@ -45,6 +47,8 @@ export const createAddressChangesCsv = ({
? formatAddress(addressChange.previousAddress)
: '',
formatChangeMadeBy(addressChange, currentUserId, t),
+ addressChange.partnerPhone ?? '',
+ addressChange.partnerEmail ?? '',
]),
];
diff --git a/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/helpers.test.ts b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/helpers.test.ts
index 3ca04cb30..1957fb318 100644
--- a/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/helpers.test.ts
+++ b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/helpers.test.ts
@@ -67,7 +67,12 @@ describe('groupMadeByOptions', () => {
mpdx: [
{ value: 'user:user-2', label: 'Jane Smith' },
{ value: 'user:user-1', label: 'You' },
- { value: 'unknown_user', label: 'Not recorded (before Nov 2026)' },
+ {
+ value: 'unknown_user',
+ label: 'Not recorded (before Nov 2026)',
+ tooltip:
+ "MPDX started saving who made each change in Nov 2026. Changes made in MPDX before then don't have a name.",
+ },
],
});
});
diff --git a/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/helpers.ts b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/helpers.ts
index b327e2c8c..5a734a991 100644
--- a/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/helpers.ts
+++ b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/helpers.ts
@@ -43,19 +43,25 @@ export const formatMadeByOption = (
return option.label;
};
-interface MadeByMenuItem {
+interface MadeByMenuOption {
value: string;
label: string;
+ tooltip?: string;
}
export const groupMadeByOptions = (
options: MadeByOption[],
currentUserId: string | undefined,
t: TFunction,
-): { automatic: MadeByMenuItem[]; mpdx: MadeByMenuItem[] } => {
- const toMenuItem = (option: MadeByOption): MadeByMenuItem => ({
+): { automatic: MadeByMenuOption[]; mpdx: MadeByMenuOption[] } => {
+ const toMenuItem = (option: MadeByOption): MadeByMenuOption => ({
value: option.id,
label: formatMadeByOption(option, currentUserId, t),
+ ...(option.type === AddressChangeMadeByEnum.UnknownUser && {
+ tooltip: t(
+ "MPDX started saving who made each change in Nov 2026. Changes made in MPDX before then don't have a name.",
+ ),
+ }),
});
const [sourceOptions, mpdxOptions] = partition(
options,
diff --git a/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/useAddressChangeFilters.ts b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/useAddressChangeFilters.ts
index 81e2e7628..162479dd3 100644
--- a/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/useAddressChangeFilters.ts
+++ b/src/components/Tool/MailingAddresses/ChangeHistoryAddresses/useAddressChangeFilters.ts
@@ -5,6 +5,7 @@ import {
getChangedDuringRange,
} from 'src/components/Shared/Filters/ChangedDuring/changedDuring';
import { ContactFilterPartnerEnum } from 'src/graphql/types.generated';
+import { useDebouncedCallback } from 'src/hooks/useDebounce';
import { AddressChangeFilter } from './AddressChangeEmptyState/AddressChangeEmptyState';
const getEmptyStateFilter = (
@@ -22,19 +23,33 @@ const getEmptyStateFilter = (
: 'other';
};
+const searchDebounceMs = 500;
+const defaultPartners = ContactFilterPartnerEnum.GaveOneOrMore;
+const defaultChangedDuring = ContactFilterChangedDuringEnum.Last12Months;
+
export const useAddressChangeFilters = () => {
- const [partners, setPartners] = useState(
- ContactFilterPartnerEnum.GaveOneOrMore,
+ const [search, setSearchText] = useState('');
+ const [debouncedSearch, setDebouncedSearch] = useState('');
+ const applySearch = useDebouncedCallback(
+ (value: string) => setDebouncedSearch(value.trim()),
+ searchDebounceMs,
);
+ const setSearch = (value: string) => {
+ setSearchText(value);
+ applySearch(value);
+ // Clearing applies at once, so a cleared search never goes out with reset filters
+ if (!value.trim()) {
+ setDebouncedSearch('');
+ }
+ };
+ const [partners, setPartners] = useState(defaultPartners);
const [changedDuring, setChangedDuring] =
- useState(
- ContactFilterChangedDuringEnum.Last12Months,
- );
+ useState(defaultChangedDuring);
const [customRange, setCustomRange] = useState(null);
const [madeBy, setMadeBy] = useState(null);
const dateRange = getChangedDuringRange(changedDuring, customRange);
const emptyStateFilter = getEmptyStateFilter(
- partners !== ContactFilterPartnerEnum.GaveOneOrMore || !!madeBy,
+ partners !== defaultPartners || !!madeBy,
changedDuring,
);
@@ -43,7 +58,22 @@ export const useAddressChangeFilters = () => {
setChangedDuring(ContactFilterChangedDuringEnum.Custom);
};
+ const searchAllDates = () => setChangedDuring(null);
+
+ const clearFilters = () => {
+ setSearch('');
+ setPartners(defaultPartners);
+ setChangedDuring(defaultChangedDuring);
+ setCustomRange(null);
+ setMadeBy(null);
+ };
+
return {
+ search,
+ setSearch,
+ debouncedSearch,
+ searchAllDates,
+ clearFilters,
partners,
setPartners,
changedDuring,
diff --git a/src/components/Tool/MailingAddresses/MailingAddresses.test.tsx b/src/components/Tool/MailingAddresses/MailingAddresses.test.tsx
index 30ab9fa60..78c8ae515 100644
--- a/src/components/Tool/MailingAddresses/MailingAddresses.test.tsx
+++ b/src/components/Tool/MailingAddresses/MailingAddresses.test.tsx
@@ -61,7 +61,7 @@ describe('MailingAddresses', () => {
[18, '18'],
[150, '99+'],
])(
- 'shows %s contacts to confirm as %s on the To Confirm tab',
+ 'shows %s contacts to confirm as %s on the Confirm addresses tab',
async (toConfirmCount, badgeText) => {
const { findByTestId } = render(
,
@@ -71,6 +71,14 @@ describe('MailingAddresses', () => {
},
);
+ it('tells screen readers what the count means', async () => {
+ const { findByRole } = render();
+
+ expect(
+ await findByRole('tab', { name: /Confirm addresses 18 to confirm/ }),
+ ).toBeInTheDocument();
+ });
+
it('hides the badge when there are no contacts to confirm', async () => {
const { findByTestId, queryByTestId } = render();
@@ -78,22 +86,33 @@ describe('MailingAddresses', () => {
expect(queryByTestId('toConfirmCount')).not.toBeInTheDocument();
});
- it('opens on To Confirm by default', async () => {
+ it('describes each tab', () => {
+ const { getByRole } = render();
+
+ expect(getByRole('tab', { name: /Confirm addresses/ })).toHaveTextContent(
+ "Pick each partner's primary address.",
+ );
+ expect(getByRole('tab', { name: /Change history/ })).toHaveTextContent(
+ 'See what changed, when, and by whom.',
+ );
+ });
+
+ it('opens on Confirm addresses by default', async () => {
const { findByTestId, getByRole } = render();
- expect(getByRole('tab', { name: 'To Confirm' })).toHaveAttribute(
+ expect(getByRole('tab', { name: /Confirm addresses/ })).toHaveAttribute(
'aria-selected',
'true',
);
expect(await findByTestId('Home')).toBeInTheDocument();
});
- it('opens on Change History from the URL', async () => {
+ it('opens on Change history from the URL', async () => {
const { findByText, getByRole, queryByTestId } = render(
,
);
- expect(getByRole('tab', { name: 'Change History' })).toHaveAttribute(
+ expect(getByRole('tab', { name: /Change history/ })).toHaveAttribute(
'aria-selected',
'true',
);
@@ -104,7 +123,7 @@ describe('MailingAddresses', () => {
it('puts the selected tab in the URL', () => {
const { getByRole } = render();
- userEvent.click(getByRole('tab', { name: 'Change History' }));
+ userEvent.click(getByRole('tab', { name: /Change history/ }));
expect(push).toHaveBeenCalledWith(
{ pathname, query: { accountListId, mailingTab: 'history' } },
@@ -113,7 +132,7 @@ describe('MailingAddresses', () => {
);
});
- it('stays on Change History when a partner is opened', async () => {
+ it('stays on Change history when a partner is opened', async () => {
const { findByRole } = render();
expect(
diff --git a/src/components/Tool/MailingAddresses/MailingAddresses.tsx b/src/components/Tool/MailingAddresses/MailingAddresses.tsx
index 1fd24ee8c..b6ae62280 100644
--- a/src/components/Tool/MailingAddresses/MailingAddresses.tsx
+++ b/src/components/Tool/MailingAddresses/MailingAddresses.tsx
@@ -1,27 +1,51 @@
import { useRouter } from 'next/router';
import React from 'react';
+import CheckCircleIcon from '@mui/icons-material/CheckCircle';
+import HistoryIcon from '@mui/icons-material/History';
import TabContext from '@mui/lab/TabContext';
import TabList from '@mui/lab/TabList';
import TabPanel from '@mui/lab/TabPanel';
-import { Box, Tab } from '@mui/material';
-import { styled } from '@mui/material/styles';
+import { Tab } from '@mui/material';
+import { SxProps, Theme } from '@mui/material/styles';
import { useTranslation } from 'react-i18next';
import { useGetToolNotificationsQuery } from 'src/components/Layouts/Primary/TopBar/Items/NavMenu/GetToolNotifcations.generated';
import { getQueryParam } from 'src/lib/queryParam';
import { ChangeHistoryAddresses } from './ChangeHistoryAddresses/ChangeHistoryAddresses';
import { ConfirmAddresses } from './ConfirmAddresses/ConfirmAddresses';
import { MailingAddressesTabKey } from './MailingAddressesTabKey';
+import { MailingAddressesTabLabel } from './MailingAddressesTabLabel';
-const CountBadge = styled(Box)(({ theme }) => ({
- backgroundColor: theme.palette.progressBarYellow.main,
- color: theme.palette.mpdxGrayDark.main,
- borderRadius: '10px',
- marginLeft: theme.spacing(1),
- padding: '3px 7px',
- fontSize: '12px',
- fontWeight: 700,
- lineHeight: 1,
-}));
+const tabBorder = { border: 1, borderColor: 'divider' };
+
+const tabSx: SxProps = (theme) => ({
+ textTransform: 'none',
+ maxWidth: 'none',
+ minHeight: 0,
+ alignItems: 'stretch',
+ textAlign: 'left',
+ padding: theme.spacing(2, 2.5),
+ color: 'text.primary',
+ backgroundColor: 'mpdxGrayLight.main',
+ ...tabBorder,
+ borderBottom: 0,
+ borderRadius: '6px 6px 0 0',
+ opacity: 1,
+ '&:hover': {
+ backgroundColor: 'common.white',
+ borderColor: 'mpdxBlue.main',
+ },
+ '&.Mui-selected': {
+ color: 'text.primary',
+ backgroundColor: 'common.white',
+ borderColor: 'divider',
+ borderTop: `4px solid ${theme.palette.mpdxBlue.main}`,
+ paddingTop: 1.75,
+ // Covers the panel's top border so the tab and panel read as one card
+ marginBottom: '-1px',
+ paddingBottom: '17px',
+ zIndex: 1,
+ },
+});
interface Props {
accountListId: string;
@@ -59,32 +83,48 @@ export const MailingAddresses: React.FC = ({ accountListId }) => {
- {t('To Confirm')}
- {toConfirmCount > 0 && (
-
- {toConfirmCount < 100 ? toConfirmCount : '99+'}
-
- )}
-
+ }
+ iconBackground="mpdxYellow.main"
+ title={t('Confirm addresses')}
+ description={t("Pick each partner's primary address.")}
+ count={toConfirmCount}
+ selected={selectedTab === MailingAddressesTabKey.Confirm}
+ />
}
value={MailingAddressesTabKey.Confirm}
- sx={{ fontWeight: 'bold' }}
+ sx={tabSx}
/>
}
+ iconBackground="mpdxBlue.light"
+ title={t('Change history')}
+ description={t('See what changed, when, and by whom.')}
+ selected={selectedTab === MailingAddressesTabKey.History}
+ />
+ }
value={MailingAddressesTabKey.History}
- sx={{ fontWeight: 'bold' }}
+ sx={tabSx}
/>
-
+
-
+
diff --git a/src/components/Tool/MailingAddresses/MailingAddressesTabLabel.tsx b/src/components/Tool/MailingAddresses/MailingAddressesTabLabel.tsx
new file mode 100644
index 000000000..b07a09f83
--- /dev/null
+++ b/src/components/Tool/MailingAddresses/MailingAddressesTabLabel.tsx
@@ -0,0 +1,90 @@
+import React from 'react';
+import ChevronRightIcon from '@mui/icons-material/ChevronRight';
+import { Box, Typography } from '@mui/material';
+import { SxProps, Theme, styled } from '@mui/material/styles';
+import { visuallyHidden } from '@mui/utils';
+import { useTranslation } from 'react-i18next';
+
+const CountBadge = styled(Box)(({ theme }) => ({
+ backgroundColor: theme.palette.progressBarYellow.main,
+ color: theme.palette.mpdxGrayDark.main,
+ borderRadius: '10px',
+ padding: '3px 7px',
+ fontSize: '12px',
+ fontWeight: 700,
+ lineHeight: 1,
+}));
+
+// Phones get plain tabs: just the title and badge
+const hideOnPhone = { xs: 'none', sm: 'flex' };
+
+interface MailingAddressesTabLabelProps {
+ icon: React.ReactNode;
+ iconBackground: string;
+ title: string;
+ description: string;
+ count?: number;
+ selected: boolean;
+}
+
+export const MailingAddressesTabLabel: React.FC<
+ MailingAddressesTabLabelProps
+> = ({ icon, iconBackground, title, description, count, selected }) => {
+ const { t } = useTranslation();
+
+ return (
+
+
+ {icon}
+
+
+
+
+ {title}
+
+ {!!count && (
+ <>
+
+ {count < 100 ? count : '99+'}
+
+ }>
+ {t('{{count}} to confirm', { count })}
+
+ >
+ )}
+
+
+ {description}
+
+
+ {!selected && (
+
+ )}
+
+ );
+};