|
|
@@ -1,18 +1,18 @@
|
|
|
import { Metadata } from "next";
|
|
|
import { notFound } from "next/navigation";
|
|
|
-import { isArray } from "@/utils/type-guards";
|
|
|
-import FilterList from "@components/theme/filters/FilterList";
|
|
|
-import Pagination from "@components/catalog/Pagination";
|
|
|
+// import { isArray } from "@/utils/type-guards";
|
|
|
+// import FilterList from "@components/theme/filters/FilterList";
|
|
|
+// import Pagination from "@components/catalog/Pagination";
|
|
|
import ProductListing from "./_components/ProductListing";
|
|
|
import { ProductsResponse } from "@components/catalog/type";
|
|
|
import {
|
|
|
GET_FILTER_PRODUCTS,
|
|
|
- GET_TREE_CATEGORIES,
|
|
|
+ // GET_TREE_CATEGORIES,
|
|
|
GET_CATEHORY_BY_ID,
|
|
|
} from "@/graphql";
|
|
|
import {
|
|
|
- cachedGraphQLRequest,
|
|
|
- cachedCategoryRequest,
|
|
|
+ // cachedGraphQLRequest,
|
|
|
+ // cachedCategoryRequest,
|
|
|
getFilterAttributes,
|
|
|
} from "@/utils/hooks/useCache";
|
|
|
import { SortByFields } from "@utils/constants";
|
|
|
@@ -21,16 +21,16 @@ import CategoryDesc from "./_components/CategoryDesc";
|
|
|
import FaqList, { FaqItem } from "./_components/FaqList";
|
|
|
import { Suspense } from "react";
|
|
|
import FilterListSkeleton from "@components/common/skeleton/FilterSkeleton";
|
|
|
-import { TreeCategoriesResponse } from "@/types/theme/category-tree";
|
|
|
+// import { TreeCategoriesResponse } from "@/types/theme/category-tree";
|
|
|
// import { MobileSearchBar } from "@components/layout/navbar/MobileSearch";
|
|
|
import {
|
|
|
- extractNumericId,
|
|
|
- findCategoryBySlug,
|
|
|
+ // extractNumericId,
|
|
|
+ // findCategoryBySlug,
|
|
|
buildProductFilters,
|
|
|
} from "@utils/helper";
|
|
|
import { serverGraphqlFetch } from "@/utils/bagisto/index";
|
|
|
import {
|
|
|
- CategoryNode,
|
|
|
+ // CategoryNode,
|
|
|
CategorySingleResponse,
|
|
|
} from "@/types/theme/category-tree";
|
|
|
|
|
|
@@ -40,7 +40,7 @@ export async function generateMetadata({
|
|
|
}: {
|
|
|
params: Promise<{ slug: string; id: string }>;
|
|
|
}): Promise<Metadata> {
|
|
|
- const { slug: categorySlug, id: categoryId } = await params;
|
|
|
+ const { slug: _categorySlug, id: categoryId } = await params;
|
|
|
const { data: categoryData } = await serverGraphqlFetch<
|
|
|
CategorySingleResponse,
|
|
|
{ id: number }
|
|
|
@@ -78,7 +78,7 @@ export default async function CategoryPage({
|
|
|
searchParams?: Promise<{ [key: string]: string | string[] | undefined }>;
|
|
|
}) {
|
|
|
// const { collection: categorySlug } = await params;
|
|
|
- const { slug: categorySlug, id: categoryId } = await params;
|
|
|
+ const { slug: _categorySlug, id: categoryId } = await params;
|
|
|
const resolvedParams = await searchParams;
|
|
|
function getSearchParam(
|
|
|
value: string | string[] | undefined,
|
|
|
@@ -127,13 +127,13 @@ export default async function CategoryPage({
|
|
|
// };
|
|
|
const searchValue = getSearchParam(resolvedParams?.q) ?? "";
|
|
|
|
|
|
- const page = getSearchParam(resolvedParams?.page);
|
|
|
+ // const page = getSearchParam(resolvedParams?.page);
|
|
|
|
|
|
const cursor = getSearchParam(resolvedParams?.cursor);
|
|
|
|
|
|
const before = getSearchParam(resolvedParams?.before);
|
|
|
const itemsPerPage = 12;
|
|
|
- const currentPage = page ? parseInt(page) - 1 : 0;
|
|
|
+ // const currentPage = page ? parseInt(page) - 1 : 0;
|
|
|
const sortValue = getSearchParam(resolvedParams?.sort) ?? "name-asc";
|
|
|
const selectedSort =
|
|
|
SortByFields.find((s) => s.key === sortValue) || SortByFields[0];
|