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 - List Header functionality #985

Merged
merged 13 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
import React from 'react';
import { IconButton } from '@mui/material';
import { IconButton, IconButtonProps } from '@mui/material';
import { StarredItemIcon } from '../../common/StarredItemIcon/StarredItemIcon';
import { useSetContactStarredMutation } from './SetContactStarred.generated';

interface Props {
accountListId: string;
contactId: string;
isStarred: boolean;
size?: IconButtonProps['size'];
}

export const StarContactIconButton: React.FC<Props> = ({
accountListId,
contactId,
isStarred,
size = 'medium',
}) => {
const [setContactStarred] = useSetContactStarredMutation();

return (
<IconButton
size={size}
component="div"
onClick={(event) => {
event.stopPropagation();
Expand Down
43 changes: 22 additions & 21 deletions src/components/Shared/Header/ListHeader.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { TasksMassActionsDropdown } from '../MassActions/TasksMassActionsDropdow
import {
ListHeader,
ListHeaderCheckBoxState,
PageEnum,
TableViewModeEnum,
} from './ListHeader';

Expand Down Expand Up @@ -96,7 +97,7 @@ describe('ListHeader', () => {
<MocksProviders>
<ListHeader
selectedIds={selectedIds}
page="contact"
page={PageEnum.Contact}
activeFilters={false}
starredFilter={{}}
headerCheckboxState={ListHeaderCheckBoxState.Unchecked}
Expand All @@ -118,7 +119,7 @@ describe('ListHeader', () => {
<MocksProviders>
<ListHeader
selectedIds={selectedIds}
page="contact"
page={PageEnum.Contact}
activeFilters={false}
starredFilter={{}}
contactsView={TableViewModeEnum.List}
Expand All @@ -142,7 +143,7 @@ describe('ListHeader', () => {
<MocksProviders>
<ListHeader
selectedIds={selectedIds}
page="contact"
page={PageEnum.Contact}
activeFilters={false}
starredFilter={{}}
contactsView={TableViewModeEnum.List}
Expand Down Expand Up @@ -188,7 +189,7 @@ describe('ListHeader', () => {
<MocksProviders>
<ListHeader
selectedIds={selectedIds}
page="contact"
page={PageEnum.Contact}
activeFilters={false}
starredFilter={{}}
headerCheckboxState={ListHeaderCheckBoxState.Unchecked}
Expand Down Expand Up @@ -220,7 +221,7 @@ describe('ListHeader', () => {
<MocksProviders>
<ListHeader
selectedIds={selectedIds}
page="task"
page={PageEnum.Task}
activeFilters={false}
headerCheckboxState={ListHeaderCheckBoxState.Unchecked}
starredFilter={{}}
Expand All @@ -240,7 +241,7 @@ describe('ListHeader', () => {
<MocksProviders>
<ListHeader
selectedIds={selectedIds}
page="contact"
page={PageEnum.Contact}
activeFilters={false}
headerCheckboxState={ListHeaderCheckBoxState.Unchecked}
totalItems={50}
Expand All @@ -267,7 +268,7 @@ describe('ListHeader', () => {
<MocksProviders>
<ListHeader
selectedIds={selectedIds}
page="contact"
page={PageEnum.Contact}
activeFilters={false}
headerCheckboxState={ListHeaderCheckBoxState.Unchecked}
totalItems={0}
Expand All @@ -287,7 +288,7 @@ describe('ListHeader', () => {
<MocksProviders>
<ListHeader
selectedIds={selectedIds}
page="contact"
page={PageEnum.Contact}
activeFilters={false}
headerCheckboxState={ListHeaderCheckBoxState.Unchecked}
totalItems={50}
Expand All @@ -311,7 +312,7 @@ describe('ListHeader', () => {
<MocksProviders>
<ListHeader
selectedIds={selectedIds}
page="contact"
page={PageEnum.Contact}
activeFilters={false}
headerCheckboxState={ListHeaderCheckBoxState.Unchecked}
starredFilter={{}}
Expand All @@ -336,7 +337,7 @@ describe('ListHeader', () => {
<MocksProviders>
<ListHeader
selectedIds={selectedIds}
page="contact"
page={PageEnum.Contact}
activeFilters={false}
headerCheckboxState={ListHeaderCheckBoxState.Unchecked}
starredFilter={{}}
Expand All @@ -363,7 +364,7 @@ describe('ListHeader', () => {
<MocksProviders>
<ListHeader
selectedIds={selectedIds}
page="contact"
page={PageEnum.Contact}
activeFilters={true}
headerCheckboxState={ListHeaderCheckBoxState.Unchecked}
starredFilter={{}}
Expand All @@ -390,7 +391,7 @@ describe('ListHeader', () => {
<MocksProviders>
<ListHeader
selectedIds={selectedIds}
page="contact"
page={PageEnum.Contact}
activeFilters={true}
headerCheckboxState={ListHeaderCheckBoxState.Unchecked}
starredFilter={{}}
Expand All @@ -417,7 +418,7 @@ describe('ListHeader', () => {
<MocksProviders>
<ListHeader
selectedIds={selectedIds}
page="contact"
page={PageEnum.Contact}
activeFilters={false}
headerCheckboxState={ListHeaderCheckBoxState.Unchecked}
starredFilter={{}}
Expand Down Expand Up @@ -445,7 +446,7 @@ describe('ListHeader', () => {
<MocksProviders>
<ListHeader
selectedIds={selectedIds}
page="contact"
page={PageEnum.Contact}
activeFilters={true}
headerCheckboxState={ListHeaderCheckBoxState.Unchecked}
starredFilter={{}}
Expand All @@ -471,7 +472,7 @@ describe('ListHeader', () => {
<MocksProviders>
<ListHeader
selectedIds={selectedIds}
page="contact"
page={PageEnum.Contact}
activeFilters={true}
headerCheckboxState={ListHeaderCheckBoxState.Unchecked}
starredFilter={{}}
Expand All @@ -493,7 +494,7 @@ describe('ListHeader', () => {
<MocksProviders>
<ListHeader
selectedIds={selectedIds}
page="contact"
page={PageEnum.Contact}
activeFilters={true}
headerCheckboxState={ListHeaderCheckBoxState.Unchecked}
starredFilter={{ starred: true }}
Expand All @@ -515,7 +516,7 @@ describe('ListHeader', () => {
<MocksProviders>
<ListHeader
selectedIds={selectedIds}
page="contact"
page={PageEnum.Contact}
activeFilters={true}
headerCheckboxState={ListHeaderCheckBoxState.Unchecked}
starredFilter={{ starred: true }}
Expand All @@ -536,7 +537,7 @@ describe('ListHeader', () => {
<MocksProviders>
<ListHeader
selectedIds={selectedIds}
page="contact"
page={PageEnum.Contact}
activeFilters={true}
contactsView={TableViewModeEnum.Flows}
headerCheckboxState={ListHeaderCheckBoxState.Unchecked}
Expand All @@ -556,7 +557,7 @@ describe('ListHeader', () => {
<MocksProviders>
<ListHeader
selectedIds={selectedIds}
page="task"
page={PageEnum.Task}
activeFilters={true}
headerCheckboxState={ListHeaderCheckBoxState.Checked}
starredFilter={{ starred: true }}
Expand All @@ -583,7 +584,7 @@ describe('ListHeader', () => {
<MocksProviders>
<ListHeader
selectedIds={[]}
page="report"
page={PageEnum.Report}
activeFilters={false}
headerCheckboxState={ListHeaderCheckBoxState.Unchecked}
filterPanelOpen={false}
Expand All @@ -605,7 +606,7 @@ describe('ListHeader', () => {
<MocksProviders>
<ListHeader
selectedIds={selectedIds}
page="report"
page={PageEnum.Report}
activeFilters={false}
headerCheckboxState={ListHeaderCheckBoxState.Unchecked}
filterPanelOpen={false}
Expand Down
4 changes: 1 addition & 3 deletions src/components/Shared/Header/ListHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export const ListHeader: React.FC<ListHeaderProps> = ({
</Hidden>
</HeaderWrapInner>
<HeaderWrapInner style={{ marginLeft: 8 }}>
{page === PageEnum.Contact && (
{(page === PageEnum.Contact || page === PageEnum.Appeal) && (
<ContactsMassActionsDropdown
filterPanelOpen={filterPanelOpen}
contactDetailsOpen={contactDetailsOpen}
Expand Down Expand Up @@ -211,8 +211,6 @@ export const ListHeader: React.FC<ListHeaderProps> = ({
/>
)}

{page === PageEnum.Appeal && <Box>{buttonGroup}</Box>}

{starredFilter && toggleStarredFilter && (
// This hidden doesn't remove from document
<Hidden smDown>
Expand Down
Loading
Loading