Pārlūkot izejas kodu

删除无用代码

fogwind 5 dienas atpakaļ
vecāks
revīzija
9992dc9a89

+ 0 - 10
src/app/(public)/[page]/opengraph-image.tsx

@@ -1,10 +0,0 @@
-import OpenGraphImage from "@components/common/OpenGraphImage";
-import { getPage } from "@utils/bagisto";
-
-export default async function Image({ params }: { params: { page: string } }) {
-  const page = await getPage({ urlKey: params.page }) as { translation?: { metaTitle?: string; pageTitle?: string } }[];
-  const pageData = page && page.length > 0 ? page[0].translation : undefined;
-  const title = pageData?.metaTitle || pageData?.pageTitle;
-
-  return await OpenGraphImage({ title });
-}

+ 1 - 2
src/components/cart/CartModal.tsx

@@ -6,7 +6,6 @@ import { ShoppingCartIcon } from "@heroicons/react/24/outline";
 import { DEFAULT_OPTION } from "@/utils/constants";
 import OpenCart from "./OpenCart";
 import { Price } from "../theme/ui/Price";
-import CloseCart from "../common/icons/cart/CloseCart";
 import { DeleteItemButton } from "../common/icons/cart/DeleteItemButton";
 import { EditItemQuantityButton } from "../common/icons/cart/EditItemQuantityButton";
 import { useAppSelector } from "@/store/hooks";
@@ -133,7 +132,7 @@ export default function CartModal({
                         className="cursor-pointer"
                         onClick={finalOnClose}
                       >
-                        <CloseCart />
+                        <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth="1.5" stroke="currentColor" aria-hidden="true" data-slot="icon" className="h-6 transition-all ease-in-out hover:scale-110"><path strokeLinecap="round" strokeLinejoin="round" d="M6 18 18 6M6 6l12 12"></path></svg>
                       </button>
                     
                   </div>

+ 0 - 67
src/components/common/ConfirmModal.tsx

@@ -1,67 +0,0 @@
-"use client";
-
-
-import { AnimatePresence , motion } from "framer-motion";
-
-export interface ConfirmModalProps { 
-    isShow: boolean;
-    title: string; 
-    content: string;
-    okHandler?: () => void; 
-    cancelHandler?: () => void;
-    noOk?: boolean; 
-    noCancel?: boolean; 
-}
-
-export function ConfirmModal({
-    isShow,
-    title,
-    content,
-    okHandler,
-    cancelHandler,
-    noOk,
-    noCancel,
-}: ConfirmModalProps) {
-
-    const close = (result: boolean) => {
-        if(result) {
-            okHandler && okHandler();
-        } else { 
-            cancelHandler && cancelHandler();
-        }
-    };
-
-  return (
-    <AnimatePresence >
-        {isShow && 
-            <motion.div
-                layout
-                initial={{ opacity: 0, }}
-                animate={{ opacity: 1 }}
-                exit={{ opacity: 0 }}
-                className="fixed z-1000 flex justify-center items-center bg-black/50 inset-0"
-                onClick={(e) => e.stopPropagation()}
-            >
-                {/* <div className="fixed z-1000 flex justify-center items-center bg-black/40 inset-0"> */}
-                    <div className="w-4/5 p-4 bg-white rounded-lg">
-                        <h3 className="text-center text-ly-18 font-bold mb-6">{title}</h3>
-                        <p className="text-ly-14 font-medium">{content}</p>
-                        <div className="w-full flex justify-end gap-3 mt-6">
-                            {!noOk && 
-                                <button className="w-20 h-8 flex justify-center items-center rounded-xs bg-ly-green text-ly-12 font-medium text-white" 
-                                    onClick={() => close(true)}
-                                >OK</button>
-                            }
-                            {!noCancel && 
-                                <button className="w-20 h-8 flex justify-center items-center rounded-xs bg-ly-gray text-ly-12 font-medium" 
-                                    onClick={() => close(false)}
-                                >Cancel</button>}
-                        </div>
-                    </div>
-                {/* </div> */}
-            </motion.div>
-        }
-    </AnimatePresence>
-  );
-}
-

+ 0 - 45
src/components/common/OpenGraphImage.tsx

@@ -1,45 +0,0 @@
-import { readFile } from "fs/promises";
-import { join } from "path";
-import { ImageResponse } from "next/og";
-import LogoIcon from "./icons/logo";
-
-
-export type Props = {
-  title?: string;
-};
-
-export default async function OpenGraphImage(
-  props?: Props,
-): Promise<ImageResponse> {
-  const { title } = {
-    ...{
-      title: process.env.SITE_NAME,
-    },
-    ...props,
-  };
-  const file = await readFile(join(process.cwd(), "./fonts/Inter-Bold.ttf"));
-  const font = Uint8Array.from(file).buffer;
-
-  return new ImageResponse(
-    (
-      <div tw="flex h-full w-full flex-col items-center justify-center bg-black">
-        <div tw="flex h-[160px] w-[160px] flex-none items-center justify-center rounded-3xl border border-neutral-700">
-          <LogoIcon fill="white" height="58" width="64" />
-        </div>
-        <p tw="mt-12 text-6xl font-bold text-white">{title}</p>
-      </div>
-    ),
-    {
-      width: 1200,
-      height: 630,
-      fonts: [
-        {
-          name: "Inter",
-          data: font,
-          style: "normal",
-          weight: 700,
-        },
-      ],
-    },
-  );
-}

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 20
src/components/common/icons/CategoryIcon.tsx


+ 0 - 20
src/components/common/icons/CheckSign.tsx

@@ -1,20 +0,0 @@
-import clsx from "clsx";
-
-export default function CheckSign(props: React.ComponentProps<"svg">) {
-  return (
-    <svg
-      className={clsx("h-4 w-4", props.className)}
-      fill="none"
-      stroke="#008000"
-      strokeWidth={1.5}
-      viewBox="0 0 24 24"
-      xmlns="http://www.w3.org/2000/svg"
-    >
-      <path
-        d="M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"
-        strokeLinecap="round"
-        strokeLinejoin="round"
-      />
-    </svg>
-  );
-}

+ 0 - 23
src/components/common/icons/EditIcon.tsx

@@ -1,23 +0,0 @@
-import clsx from "clsx";
-import { FC } from "react";
-
-export const EditIcon: FC<{
-  className: string;
-}> = ({ className }) => {
-  return (
-    <svg
-      className={clsx("size-6", className)}
-      fill="none"
-      stroke="currentColor"
-      strokeWidth={1.5}
-      viewBox="0 0 24 24"
-      xmlns="http://www.w3.org/2000/svg"
-    >
-      <path
-        d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10"
-        strokeLinecap="round"
-        strokeLinejoin="round"
-      />
-    </svg>
-  );
-};

+ 0 - 18
src/components/common/icons/HeartIcon.tsx

@@ -1,18 +0,0 @@
-export const HeartIcon = () => {
-  return (
-    <svg
-      className="size-6"
-      fill="none"
-      stroke="currentColor"
-      strokeWidth={1.5}
-      viewBox="0 0 24 24"
-      xmlns="http://www.w3.org/2000/svg"
-    >
-      <path
-        d="M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12Z"
-        strokeLinecap="round"
-        strokeLinejoin="round"
-      />
-    </svg>
-  );
-};

+ 0 - 33
src/components/common/icons/HomeIcon.tsx

@@ -1,33 +0,0 @@
-import clsx from "clsx";
-
-export const HomeIcon = ({ className }: { className?: string }) => {
-  return (
-    <svg
-      className={clsx(
-        "fill-transparent stroke-current dark:fill-transparent",
-        className
-      )}
-      width="22"
-      height="21"
-      viewBox="0 0 22 21"
-      fill="none"
-      xmlns="http://www.w3.org/2000/svg"
-    >
-      <path
-        d="M10.75 15.25H10.759"
-        strokeWidth="2"
-        strokeLinecap="round"
-        strokeLinejoin="round"
-      />
-      <path
-        d="M18.75 6.75V11.75C18.75 15.5212 18.75 17.4069 17.5784 18.5784C16.4069 19.75 14.5212 19.75 10.75 19.75C6.97876 19.75 5.09315 19.75 3.92157 18.5784C2.75 17.4069 2.75 15.5212 2.75 11.75V6.75"
-        strokeWidth="1.5"
-      />
-      <path
-        d="M20.75 8.75L16.4069 4.58548C13.7402 2.02849 12.4069 0.75 10.75 0.75C9.09315 0.75 7.75981 2.02849 5.09315 4.58548L0.75 8.75"
-        strokeWidth="1.5"
-        strokeLinecap="round"
-      />
-    </svg>
-  );
-};

+ 0 - 25
src/components/common/icons/MapIcon.tsx

@@ -1,25 +0,0 @@
-import clsx from "clsx";
-
-export const MapIcon = ({ className = "" }) => {
-  return (
-    <svg
-      className={clsx("size-6", className)}
-      fill="none"
-      stroke="currentColor"
-      strokeWidth={1.5}
-      viewBox="0 0 24 24"
-      xmlns="http://www.w3.org/2000/svg"
-    >
-      <path
-        d="M15 10.5a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"
-        strokeLinecap="round"
-        strokeLinejoin="round"
-      />
-      <path
-        d="M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25S4.5 17.642 4.5 10.5a7.5 7.5 0 1 1 15 0Z"
-        strokeLinecap="round"
-        strokeLinejoin="round"
-      />
-    </svg>
-  );
-};

+ 0 - 19
src/components/common/icons/RightArrowIcon.tsx

@@ -1,19 +0,0 @@
-import clsx from "clsx";
-export default function RightArrowIcon(props: React.ComponentProps<"svg">) {
-  return (
-    <svg
-      className={clsx("h-4 w-4", props.className)}
-      fill="none"
-      stroke="currentColor"
-      strokeWidth="1.5"
-      viewBox="0 0 24 24"
-      xmlns="http://www.w3.org/2000/svg"
-    >
-      <path
-        d="M15.75 19.5 8.25 12l7.5-7.5"
-        strokeLinecap="round"
-        strokeLinejoin="round"
-      />
-    </svg>
-  );
-}

+ 0 - 21
src/components/common/icons/SeparatorIcon.tsx

@@ -1,21 +0,0 @@
-import clsx from "clsx";
-const SeparatorIcon = (props: React.ComponentProps<"svg">) => {
-  return (
-    <svg
-      className={clsx("h-3 w-3", props.className)}
-      fill="none"
-      stroke="currentColor"
-      strokeWidth="1.5"
-      viewBox="0 0 24 24"
-      xmlns="http://www.w3.org/2000/svg"
-    >
-      <path
-        d="m8.25 4.5 7.5 7.5-7.5 7.5"
-        strokeLinecap="round"
-        strokeLinejoin="round"
-      />
-    </svg>
-  );
-};
-
-export default SeparatorIcon;

+ 1 - 23
src/components/common/icons/ShoppingCartIcon.tsx

@@ -1,4 +1,4 @@
-import { ComponentProps, ReactNode } from "react";
+import { type ComponentProps, type ReactNode } from "react";
 import clsx from "clsx";
 
 interface ShoppingCartIconProps extends ComponentProps<"svg"> {
@@ -32,25 +32,3 @@ export default function ShoppingCartIcon({
     </svg>
   );
 }
-
-export function BasketCartIcon(props: React.ComponentProps<"svg">) {
-  return (
-    <svg
-      className={clsx(
-        "fill-ptimary h-48 w-48 dark:fill-transparent",
-        props.className,
-      )}
-      fill="none"
-      stroke="currentColor"
-      strokeWidth="1.5"
-      viewBox="0 0 24 24"
-      xmlns="http://www.w3.org/2000/svg"
-    >
-      <path
-        d="M2.25 3h1.386c.51 0 .955.343 1.087.835l.383 1.437M7.5 14.25a3 3 0 0 0-3 3h15.75m-12.75-3h11.218c1.121-2.3 2.1-4.684 2.924-7.138a60.114 60.114 0 0 0-16.536-1.84M7.5 14.25 5.106 5.272M6 20.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0Zm12.75 0a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0Z"
-        strokeLinecap="round"
-        strokeLinejoin="round"
-      />
-    </svg>
-  );
-}

+ 0 - 22
src/components/common/icons/WalletLogo.tsx

@@ -1,22 +0,0 @@
-import clsx from "clsx";
-
-export default function WalletLogo(props: React.ComponentProps<"svg">) {
-  return (
-    <svg
-      data-slot="icon"
-      fill="none"
-      strokeWidth="1.5"
-      stroke="currentColor"
-      viewBox="0 0 24 24"
-      xmlns="http://www.w3.org/2000/svg"
-      aria-hidden="true"
-      className={clsx("h-12 w-12 ", props.className)}
-    >
-      <path
-        strokeLinecap="round"
-        strokeLinejoin="round"
-        d="M21 12a2.25 2.25 0 0 0-2.25-2.25H15a3 3 0 1 1-6 0H5.25A2.25 2.25 0 0 0 3 12m18 0v6a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 18v-6m18 0V9M3 12V9m18 0a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 9m18 0V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v3"
-      ></path>
-    </svg>
-  );
-}

+ 0 - 15
src/components/common/icons/cart/CloseCart.tsx

@@ -1,15 +0,0 @@
-import { XMarkIcon } from "@heroicons/react/24/outline";
-import clsx from "clsx";
-
-export default function CloseCart({ className }: { className?: string }) {
-  return (
-    <div
-      className={clsx(
-        "relative flex h-11 w-11 items-center justify-center rounded-md text-black transition-colors duration-300 hover:bg-neutral-200 dark:text-white dark:hover:bg-neutral-700",
-        className,
-      )}
-    >
-      <XMarkIcon className="h-6 transition-all ease-in-out hover:scale-110" />
-    </div>
-  );
-}

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 41
src/components/common/icons/logo.tsx


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 112
src/components/common/icons/product-icons.tsx


+ 0 - 30
src/components/common/skeleton/ForgetSkeleton.tsx

@@ -1,30 +0,0 @@
-import clsx from "clsx";
-
-export default function ForgetSkeleton() {
-  return (
-    <div className="my-8 flex w-full items-center justify-between gap-4 lg:my-16 xl:my-32 animate-pulse">
-      <div className="flex w-full flex-col gap-y-6 lg:max-w-[583px]">
-        <div className="h-10 w-56 rounded-lg bg-gray-200" />
-
-        <div className="h-4 w-80 rounded-lg bg-gray-200" />
-        <div className="h-4 w-64 rounded-lg bg-gray-200" />
-
-        <div className="mt-6 h-14 w-full rounded-lg bg-gray-200" />
-
-        <div className="h-12 w-40 rounded-lg bg-gray-300" />
-
-        <div className="h-4 w-32 rounded-lg bg-gray-200" />
-      </div>
-
-      <div className="relative hidden aspect-[1] max-h-[692px] w-full max-w-[790px] sm:block md:aspect-[1.14] overflow-hidden rounded-xl">
-        <div
-          className={clsx(
-            "absolute inset-0 rounded-xl",
-            "bg-gradient-to-r from-gray-200 via-gray-300 to-gray-200",
-            "animate-[shimmer_1.6s_infinite]"
-          )}
-        />
-      </div>
-    </div>
-  );
-}

+ 0 - 24
src/components/common/skeleton/ThemeSkeleton.tsx

@@ -1,24 +0,0 @@
-
-export const ThemeSkeleton = () => {
-  const skeletonArray = Array.from({ length: 8 });
-
-  return (
-    <section>
-      <div className="mx-auto mb-10 w-full px-0 text-center md:max-w-4.5xl md:px-36">
-        <div className="mx-auto mb-4 h-10 w-1/2 animate-pulse rounded bg-gray-300 dark:bg-neutral-700" />
-        <div className="mx-auto h-5 w-full max-w-xl animate-pulse rounded bg-gray-200 dark:bg-neutral-800" />
-      </div>
-
-      <div className="w-full pb-6 pt-1">
-        <ul className="m-0 grid grid-cols-1 justify-center gap-6 p-0 sm:grid-cols-2 md:gap-12 lg:grid-cols-4">
-          {skeletonArray.map((_, index) => (
-            <li
-              key={index}
-              className="aspect-[4/5] animate-pulse rounded-lg bg-gray-200 dark:bg-neutral-800"
-            />
-          ))}
-        </ul>
-      </div>
-    </section>
-  );
-};

+ 0 - 13
src/components/layout/navbar/type.ts

@@ -1,13 +0,0 @@
-export interface NavbarResponse {
-  categories: {
-    edges: {
-      node: {
-        translation: {
-          id: string;
-          name: string;
-          slug: string;
-        };
-      };
-    }[];
-  };
-}

+ 0 - 42
src/components/theme/ui/element/Checkbox.tsx

@@ -1,42 +0,0 @@
-import clsx from "clsx";
-import { forwardRef } from "react";
-
-const CheckBox = forwardRef<HTMLInputElement, any>(
-  ({ id, label, name, className, defaultValue, ...rest }, ref) => {
-    return (
-      <div className={clsx("inline-flex items-center", className)}>
-        <label className="relative flex cursor-pointer items-center gap-x-2">
-          <input
-            ref={ref}
-            className="peer h-5 w-5 cursor-pointer appearance-none rounded border border-slate-300 shadow transition-all checked:border-blue-600 checked:bg-blue-600 hover:shadow-md"
-            defaultChecked={defaultValue}
-            id={id}
-            name={name}
-            type="checkbox"
-            {...rest}
-          />
-          <span className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 transform text-white opacity-0 peer-checked:opacity-100">
-            <svg
-              className="h-3.5 w-3.5"
-              fill="currentColor"
-              stroke="currentColor"
-              strokeWidth="1"
-              viewBox="0 0 20 20"
-              xmlns="http://www.w3.org/2000/svg"
-            >
-              <path
-                clipRule="evenodd"
-                d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
-                fillRule="evenodd"
-              />
-            </svg>
-          </span>
-        </label>
-        <span className="ml-3 text-neutral-400 dark:text-white">{label}</span>
-      </div>
-    );
-  },
-);
-
-CheckBox.displayName = "CheckBox";
-export default CheckBox;

+ 0 - 37
src/providers/GlobalContextProvider.tsx

@@ -1,37 +0,0 @@
-"use client";
-
-
-import {
-  Dispatch,
-  SetStateAction,
-  createContext,
-  useContext,
-  useState,
-} from "react";
-
-
-interface ContextProps {
-  countryCode: string;
-  setCountryCode: Dispatch<SetStateAction<string>>;
-}
-
-const GlobalContext = createContext<ContextProps>({
-  countryCode: "",
-  setCountryCode: (): string => "",
-});
-
-export const GlobalContextProvider = ({
-  children,
-}: {
-  children: React.ReactNode;
-}) => {
-  const [countryCode, setCountryCode] = useState("");
-
-  return (
-    <GlobalContext.Provider value={{ countryCode, setCountryCode }}>
-      {children}
-    </GlobalContext.Provider>
-  );
-};
-
-export const useGlobalContext = () => useContext(GlobalContext);

+ 0 - 1
src/providers/index.ts

@@ -1,5 +1,4 @@
 export { ApolloWrapper } from "./ApolloWrapper";
-export { GlobalContextProvider } from "./GlobalContextProvider";
 export { GlobalProviders } from "./GlobalProviders";
 export { ReduxProvider } from "./ReduxProvider";
 export { ThemeProvider } from "./ThemeProvider";

+ 0 - 28
src/utils/type-guards.ts

@@ -1,8 +1,3 @@
-export interface BagistoErrorLike {
-  status: number;
-  message: Error;
-  cause?: Error;
-}
 
 export const isObject = (
   object: unknown,
@@ -20,26 +15,3 @@ export const isArray = (arr: any) => {
   return arr && Array.isArray(arr) && arr.length > 0;
 };
 
-export const isBagistoError = (error: unknown): error is BagistoErrorLike => {
-  if (!isObject(error)) return false;
-
-  // ApolloError with GraphQL response (Bagisto style error)
-  if ("graphQLErrors" in error && Array.isArray((error).graphQLErrors)) {
-    return true;
-  }
-
-  // Standard JS error (still might be Bagisto wrapped)
-  if (error instanceof Error) return true;
-
-  return findError(error);
-};
-
-function findError<T extends object>(error: T): boolean {
-  if (Object.prototype.toString.call(error) === "[object Error]") {
-    return true;
-  }
-
-  const prototype = Object.getPrototypeOf(error) as T | null;
-
-  return prototype === null ? false : findError(prototype);
-}