All files / src/shared/GiveFilter GiveFilterModal.tsx

100% Statements 5/5
100% Branches 1/1
100% Functions 1/1
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37                                9x       493x 493x           493x             9x    
import useNiceModal from "@common/Modal/ModalFactory/hooks/useNiceModal";
import GiveSidePanel from "@shared/SidePanel/GiveSidePanel";
import NiceModal from "@ebay/nice-modal-react";
import { FILTER_PANEL_WIDTH, FilterPagesEnum } from "./constants";
import useGeneralFilters from "./hooks/useGeneralFilters";
import GiveFilterModalContent from "./components/GiveFilterModalContent";
 
type Props = {
  filterPage: FilterPagesEnum;
  /**
   * Scopes an entity-specific filter page: the EVENT_TICKETS panel's Ticket Name
   * chips are the event's own tiers. Passed by `useFilterButton` at show() time —
   * the modal renders outside the route tree, so it cannot read the id itself.
   */
  productId?: string;
};
export const GiveFilterModalBase = ({
  filterPage = FilterPagesEnum.MANAGE_MONEY,
  productId,
}: Props) => {
  const { open } = useNiceModal();
  const { resetModal } = useGeneralFilters({
    filterPage,
    open,
    productId,
  });
 
  return (
    <GiveSidePanel width={FILTER_PANEL_WIDTH} open={open} onClose={resetModal}>
      <GiveFilterModalContent filterPage={filterPage} productId={productId} />
    </GiveSidePanel>
  );
};
 
const GiveFilterModal = NiceModal.create(GiveFilterModalBase);
export default GiveFilterModal;