Skip to content

Commit 3e1d0fb

Browse files
committed
refactor: resolve import of IPageListItem type
1 parent cd91380 commit 3e1d0fb

File tree

6 files changed

+426
-7
lines changed

6 files changed

+426
-7
lines changed

src/components/BaseLayout/BaseLayout.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { ISliderItem } from '@/components/HomePageSlider/types';
44
import { getClient } from '@/graphql/clients/serverSideClient';
55
import { GET_PUBLISHED_PAGES_LIST } from '@/graphql/queries/pages';
66
import { GET_TOP_BANNER } from '@/graphql/queries/sliders';
7+
import { IPageListItem } from '@/graphql/types/common';
78
import {
89
GetPublishedPagesListQuery,
910
GetTopBannerQuery,
@@ -14,10 +15,6 @@ export interface BaseLayoutProps {
1415
children: ReactNode;
1516
}
1617

17-
export type IPageListItem = NonNullable<
18-
GetPublishedPagesListQuery['pages']
19-
>['edges'][number]['node'];
20-
2118
const getPagesList = async (): Promise<IPageListItem[]> => {
2219
const { data } = await getClient().query<GetPublishedPagesListQuery>({
2320
query: GET_PUBLISHED_PAGES_LIST,

src/components/Footer/Footer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { IPageListItem } from '@/app/[locale]/(container)/layout';
21
import { Box } from '@mui/material';
32
import { FC } from 'react';
43
import DesktopView from '../ResponsiveDesign/components/DesktopView';
54
import MobileView from '../ResponsiveDesign/components/MobileView';
65
import { DesktopFooter, MobileFooter } from './components';
6+
import { IPageListItem } from '@/graphql/types/common';
77

88
export interface FooterProps {
99
pages: IPageListItem[];

src/components/Footer/components/DesktopFooter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client';
22

3-
import { IPageListItem } from '@/app/[locale]/(container)/layout';
3+
import { IPageListItem } from '@/graphql/types/common';
44
import { Box, Container, Link, Typography } from '@mui/material';
55
import { useTranslations } from 'next-intl';
66
import { FC } from 'react';

src/graphql/types/common.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { GetPublishedPagesListQuery } from "./graphql";
2+
3+
export type IPageListItem = NonNullable<
4+
GetPublishedPagesListQuery['pages']
5+
>['edges'][number]['node'];

src/graphql/types/gql.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
1313
* Therefore it is highly recommended to use the babel or swc plugin for production.
1414
*/
1515
const documents = {
16+
"\n query GET_CART {\n cart {\n contents {\n nodes {\n key\n product {\n node {\n id\n databaseId\n name\n description\n type\n onSale\n slug\n averageRating\n reviewCount\n image {\n id\n sourceUrl\n srcSet\n altText\n title\n }\n galleryImages {\n nodes {\n id\n sourceUrl\n srcSet\n altText\n title\n }\n }\n }\n }\n variation {\n node {\n id\n databaseId\n name\n description\n type\n onSale\n price\n regularPrice\n salePrice\n image {\n id\n sourceUrl\n srcSet\n altText\n title\n }\n attributes {\n nodes {\n id\n name\n value\n }\n }\n }\n }\n quantity\n total\n subtotal\n subtotalTax\n }\n }\n\n subtotal\n subtotalTax\n shippingTax\n shippingTotal\n total\n totalTax\n feeTax\n feeTotal\n discountTax\n discountTotal\n }\n }\n": types.Get_CartDocument,
1617
"\n query Categories {\n productCategories(first: 1000) {\n nodes {\n id: databaseId\n name\n parentId: parentDatabaseId\n }\n }\n }\n": types.CategoriesDocument,
1718
"\n query GetMainCategories {\n productCategories(where: { parent: null, orderby: TERM_ORDER }) {\n edges {\n node {\n id: databaseId\n name\n image {\n id: databaseId\n sourceUrl\n }\n }\n }\n }\n }\n": types.GetMainCategoriesDocument,
1819
"\n query GetGeneralSettings {\n generalSettings {\n title\n description\n timezone\n language\n }\n }\n": types.GetGeneralSettingsDocument,
@@ -38,6 +39,10 @@ const documents = {
3839
*/
3940
export function graphql(source: string): unknown;
4041

42+
/**
43+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
44+
*/
45+
export function graphql(source: "\n query GET_CART {\n cart {\n contents {\n nodes {\n key\n product {\n node {\n id\n databaseId\n name\n description\n type\n onSale\n slug\n averageRating\n reviewCount\n image {\n id\n sourceUrl\n srcSet\n altText\n title\n }\n galleryImages {\n nodes {\n id\n sourceUrl\n srcSet\n altText\n title\n }\n }\n }\n }\n variation {\n node {\n id\n databaseId\n name\n description\n type\n onSale\n price\n regularPrice\n salePrice\n image {\n id\n sourceUrl\n srcSet\n altText\n title\n }\n attributes {\n nodes {\n id\n name\n value\n }\n }\n }\n }\n quantity\n total\n subtotal\n subtotalTax\n }\n }\n\n subtotal\n subtotalTax\n shippingTax\n shippingTotal\n total\n totalTax\n feeTax\n feeTotal\n discountTax\n discountTotal\n }\n }\n"): (typeof documents)["\n query GET_CART {\n cart {\n contents {\n nodes {\n key\n product {\n node {\n id\n databaseId\n name\n description\n type\n onSale\n slug\n averageRating\n reviewCount\n image {\n id\n sourceUrl\n srcSet\n altText\n title\n }\n galleryImages {\n nodes {\n id\n sourceUrl\n srcSet\n altText\n title\n }\n }\n }\n }\n variation {\n node {\n id\n databaseId\n name\n description\n type\n onSale\n price\n regularPrice\n salePrice\n image {\n id\n sourceUrl\n srcSet\n altText\n title\n }\n attributes {\n nodes {\n id\n name\n value\n }\n }\n }\n }\n quantity\n total\n subtotal\n subtotalTax\n }\n }\n\n subtotal\n subtotalTax\n shippingTax\n shippingTotal\n total\n totalTax\n feeTax\n feeTotal\n discountTax\n discountTotal\n }\n }\n"];
4146
/**
4247
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
4348
*/

0 commit comments

Comments
 (0)