// @ts-strict-ignore import { Collections } from "@dashboard/collections/types"; import { collectionAddUrl, CollectionListUrlSortField, collectionUrl, } from "@dashboard/collections/urls"; import { ListFilters } from "@dashboard/components/AppLayout/ListFilters"; import { TopNav } from "@dashboard/components/AppLayout/TopNav"; import { getByName } from "@dashboard/components/Filter/utils"; import { FilterPresetsSelect } from "@dashboard/components/FilterPresetsSelect"; import { ListPageLayout } from "@dashboard/components/Layouts"; import useNavigator from "@dashboard/hooks/useNavigator"; import { sectionNames } from "@dashboard/intl"; import { FilterPageProps, PageListProps, SortPage } from "@dashboard/types"; import { Card } from "@material-ui/core"; import { Box, Button, ChevronRightIcon } from "@saleor/macaw-ui/next"; import React, { useState } from "react"; import { FormattedMessage, useIntl } from "react-intl"; import { CollectionListDatagrid } from "../CollectionListDatagrid"; import { CollectionListDeleteButton } from "../CollectionListDeleteButton"; import { CollectionFilterKeys, CollectionListFilterOpts, createFilterStructure, } from "./filters"; export interface CollectionListPageProps extends PageListProps, Omit< FilterPageProps, "onTabDelete" >, SortPage { onTabUpdate: (tabName: string) => void; selectedChannelId: string; collections: Collections; loading: boolean; selectedCollectionIds: string[]; hasPresetsChanged: () => boolean; onSelectCollectionIds: (rows: number[], clearSelection: () => void) => void; onCollectionsDelete: () => void; onTabDelete: (id: number) => void; } const CollectionListPage: React.FC = ({ currentTab, disabled, initialSearch, onAll, onSearchChange, onTabChange, onTabDelete, onTabSave, onTabUpdate, selectedChannelId, tabs, filterOpts, onFilterChange, onFilterAttributeFocus, hasPresetsChanged, currencySymbol, selectedCollectionIds, onCollectionsDelete, ...listProps }) => { const intl = useIntl(); const navigate = useNavigator(); const filterStructure = createFilterStructure(intl, filterOpts); const [isFilterPresetOpen, setFilterPresetOpen] = useState(false); const filterDependency = filterStructure.find(getByName("channel")); return ( {selectedCollectionIds.length > 0 && ( )} } /> { navigate(collectionUrl(id)); }} hasRowHover={!isFilterPresetOpen} rowAnchor={collectionUrl} {...listProps} /> ); }; CollectionListPage.displayName = "CollectionListPage"; export default CollectionListPage;