Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MPDX-7955 - Add list filter functionality #989

Closed
wants to merge 48 commits into from
Closed
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
e69245c
1. Set up Appeal Detail pages - Creating Appeal Detail page
dr-bizz Jul 30, 2024
ded9cb0
1. Set up Appeal Context
dr-bizz Jul 30, 2024
e470b6e
1. Create Appeal Detail pages
dr-bizz Jul 30, 2024
6e4677e
2. Clean up old files - Deleted old files and moved initial Page file…
dr-bizz Jul 30, 2024
5441d11
3. Appeal Details Frame - Building main frame.
dr-bizz Jul 30, 2024
cc6964f
3. MainPanel - Appeal header info and infinite scroll
dr-bizz Jul 30, 2024
bfae35c
3. List filters
dr-bizz Jul 30, 2024
019e0b9
3. List Contact row
dr-bizz Jul 30, 2024
539f625
3. Contact Right Panel. Context changes were needed on a few contact …
dr-bizz Jul 30, 2024
3f69a0f
4. Flows View - Building Flows page
dr-bizz Jul 30, 2024
42f8478
4. Building Flows contact row and drag and drop functionality.
dr-bizz Jul 30, 2024
bf1813f
5. Fixing GraphQL error as two queries were called the same
dr-bizz Jul 30, 2024
bfca9cb
5. Fixing scrolling issue, as scroll was flashing too much
dr-bizz Jul 30, 2024
812849f
Removing Starred filter from ListHeader
dr-bizz Jul 31, 2024
520cab4
When filtering by search it no longer refreshes the whole page and fl…
dr-bizz Jul 31, 2024
f9da5c0
Adding the mass actions back to the List Header.
dr-bizz Jul 31, 2024
f5c594b
Allowing the StarContact to have it's size passed as a parameter.
dr-bizz Jul 31, 2024
38fadaf
Adding checkbox to FlowsRow. Had to move Star button and alter some s…
dr-bizz Jul 31, 2024
7345b3f
Testing contactRow is selected
dr-bizz Jul 31, 2024
32aa630
Adding Appeal Info Modal to allow users to edit the appeal settings.
dr-bizz Jul 31, 2024
0df0933
Fixing error with If statement and using `PageEnum`.
dr-bizz Jul 31, 2024
5281f72
Merge branch 'MPDX-7955-add-functionality' into MPDX-7955-add-header-…
dr-bizz Jul 31, 2024
4604a00
Clear filters and make filter panel contact numbers update if searchT…
dr-bizz Jul 31, 2024
25fd814
Adding onMouseEnter to FilterPanelButtons.
dr-bizz Jul 31, 2024
9415c44
Adding Export functionality
dr-bizz Jul 31, 2024
e0d987d
Fixing issue with contact List since appealId is not part of the memo…
dr-bizz Aug 1, 2024
9a217e7
You can now exclude contacts from the contactsAutoComplete, improving…
dr-bizz Aug 1, 2024
c72ff36
Creating add contacts to appeal modal and adding it to the filter panel.
dr-bizz Aug 1, 2024
d4d5633
Delete Appeal modal and functionality
dr-bizz Aug 1, 2024
1e1115d
fixing error with save button change
dr-bizz Aug 5, 2024
f420cd7
fixup! 3. List Contact row
dr-bizz Aug 6, 2024
77d2c28
Delete Contact from Pledge
dr-bizz Aug 6, 2024
32ca50d
Renaming test
dr-bizz Aug 13, 2024
af7ceb6
Add Appeal
dr-bizz Aug 13, 2024
3967651
Edit Appeal - altered the add appeal modal to be edit & add appeal.
dr-bizz Aug 13, 2024
6581c0e
Delete contact from appeal and small improvements to list row action …
dr-bizz Aug 14, 2024
448b48f
Add Excluded contact to appeal
dr-bizz Aug 15, 2024
b3f0723
fixup! Add Appeal
dr-bizz Aug 15, 2024
b9dd12b
Moving files around to make the folder structure make more sense.
dr-bizz Aug 15, 2024
ec4d592
Delete Pledge modal
dr-bizz Aug 15, 2024
2f81a28
Added the ability to add an appeal via a modal for the announcements
dr-bizz Aug 15, 2024
7619c7c
Moving AddAppealForm to it's own folder
dr-bizz Aug 19, 2024
c471e11
Fixing successful message to be the same as the old MPDX
dr-bizz Aug 19, 2024
f29b428
Adding include and exclude logic to Add Appeal forms and in the modal…
dr-bizz Aug 19, 2024
746ce6a
fixup! Fixing successful message to be the same as the old MPDX
dr-bizz Aug 19, 2024
767c81e
Appeal Tour functionality and tests.
dr-bizz Aug 21, 2024
c9dcb7a
Bulk add excluded contacts to appeal
dr-bizz Aug 21, 2024
8931296
Adding List pledge and donations.
dr-bizz Aug 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions pages/accountLists/[accountListId]/contacts/Contacts.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ query Contacts(
first: $first
) {
nodes {
id
avatar
...ContactRow
...contactFragment
}
totalCount
pageInfo {
Expand All @@ -26,6 +24,12 @@ query Contacts(
}
}

fragment contactFragment on Contact {
id
avatar
...ContactRow
}

query ContactFilters($accountListId: ID!) {
accountList(id: $accountListId) {
id
Expand Down
81 changes: 0 additions & 81 deletions pages/accountLists/[accountListId]/tools/appeals.page.tsx

This file was deleted.

104 changes: 104 additions & 0 deletions pages/accountLists/[accountListId]/tools/appeals/AppealsWrapper.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
import { useRouter } from 'next/router';
import React, { useEffect, useMemo, useState } from 'react';
import { AppealsProvider } from 'src/components/Tool/Appeal/AppealsContext/AppealsContext';
import { ContactFilterSetInput } from 'src/graphql/types.generated';
import { suggestArticles } from 'src/lib/helpScout';
import { sanitizeFilters } from 'src/lib/sanitizeFilters';

interface Props {
children?: React.ReactNode;
}

export enum PageEnum {
InitialPage = 'InitialPage',
DetailsPage = 'DetailsPage',
ContactsPage = 'ContactsPage',
}

export const AppealsWrapper: React.FC<Props> = ({ children }) => {
const router = useRouter();
const { query, replace, pathname, isReady } = router;

const urlFilters =
query?.filters && JSON.parse(decodeURI(query.filters as string));

const [activeFilters, setActiveFilters] = useState<ContactFilterSetInput>(
urlFilters ?? {},
);
const [starredFilter, setStarredFilter] = useState<ContactFilterSetInput>({});
const [filterPanelOpen, setFilterPanelOpen] = useState<boolean>(false);
const [page, setPage] = useState<PageEnum>();
const [appealId, setAppealId] = useState<string | undefined>(undefined);
const [contactId, setContactId] = useState<string | string[] | undefined>(
undefined,
);
const sanitizedFilters = useMemo(
() => sanitizeFilters(activeFilters),
[activeFilters],
);

const { appealId: appealIdParams, searchTerm } = query;

useEffect(() => {
// TODO: Fix these suggested Articles
suggestArticles(
appealIdParams
? 'HS_CONTACTS_CONTACT_SUGGESTIONS'
: 'HS_CONTACTS_SUGGESTIONS',
);
if (appealIdParams === undefined) {
setPage(PageEnum.InitialPage);
return;
}
const length = appealIdParams.length;
setAppealId(appealIdParams[0]);
if (length === 1) {
setPage(PageEnum.DetailsPage);
} else if (
length === 2 &&
(appealIdParams[1].toLowerCase() === 'flows' ||
appealIdParams[1].toLowerCase() === 'list')
) {
setPage(PageEnum.DetailsPage);
setContactId(appealIdParams);
} else if (length > 2) {
setPage(PageEnum.ContactsPage);
setContactId(appealIdParams);
}
}, [appealIdParams]);

useEffect(() => {
if (!isReady) {
return;
}

const { filters: _, ...oldQuery } = query;
replace({
pathname,
query: {
...oldQuery,
...(Object.keys(sanitizedFilters).length
? { filters: encodeURI(JSON.stringify(sanitizedFilters)) }
: undefined),
},
});
}, [sanitizedFilters, isReady]);

return (
<AppealsProvider
urlFilters={urlFilters}
activeFilters={activeFilters}
setActiveFilters={setActiveFilters}
starredFilter={starredFilter}
setStarredFilter={setStarredFilter}
filterPanelOpen={filterPanelOpen}
setFilterPanelOpen={setFilterPanelOpen}
appealId={appealId}
contactId={contactId}
searchTerm={searchTerm}
page={page}
>
{children}
</AppealsProvider>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import React, { ReactElement, useContext } from 'react';
import { useTranslation } from 'react-i18next';
import { loadSession } from 'pages/api/utils/pagePropsHelpers';
import {
AppealsContext,
AppealsType,
} from 'src/components/Tool/Appeal/AppealsContext/AppealsContext';
import { DynamicAppealsDetailsPage } from 'src/components/Tool/Appeal/DynamicAppealsDetailsPage';
import { DynamicAppealsInitialPage } from 'src/components/Tool/Appeal/InitialPage/DynamicAppealsInitialPage';
import { ToolsWrapper } from '../ToolsWrapper';
import { AppealsWrapper, PageEnum } from './AppealsWrapper';

const Appeals = (): ReactElement => {
const { t } = useTranslation();
const { page } = useContext(AppealsContext) as AppealsType;
const pageUrl = 'appeals';

return (
<ToolsWrapper
pageTitle={t('Appeals')}
pageUrl={pageUrl}
selectedMenuId="appeals"
>
<>
{page === PageEnum.InitialPage && <DynamicAppealsInitialPage />}

{(page === PageEnum.DetailsPage || page === PageEnum.ContactsPage) && (
<DynamicAppealsDetailsPage />
)}
</>
</ToolsWrapper>
);
};

const AppealsPage: React.FC = () => (
<AppealsWrapper>
<Appeals />
</AppealsWrapper>
);

export default AppealsPage;

export const getServerSideProps = loadSession;

This file was deleted.

Loading
Loading