From 8a5cd09172afdb419cee4f5238c96b96167a283d Mon Sep 17 00:00:00 2001 From: hamid zarghami Date: Mon, 1 Jun 2026 15:09:56 +0330 Subject: [PATCH] fix text --- src/pages/home/Home.tsx | 238 ++++++++++++++------------- src/shared/components/BuyCatalog.tsx | 116 ++++++------- 2 files changed, 182 insertions(+), 172 deletions(-) diff --git a/src/pages/home/Home.tsx b/src/pages/home/Home.tsx index 07a56ed..5bae5fc 100644 --- a/src/pages/home/Home.tsx +++ b/src/pages/home/Home.tsx @@ -1,128 +1,132 @@ -import Divider from '@/components/Divider' -import { usePageTitle } from '@/hooks/usePageTitle' -import { ArrowLeft, DocumentText } from 'iconsax-react' -import { useState, type FC } from 'react' -import PdfIcon from '@/assets/images/PDF.svg' -import Button from '@/components/Button' -import Input from '@/components/Input' -import { toast } from '@/components/Toast' -import { useCreateCatalog } from './hooks/useHomeData' -import { useNavigate } from 'react-router-dom' -import { Paths } from '@/config/Paths' -import DirectLogin from '../auth/components/DirectLogin' -import { clx, extractErrorMessage } from '@/helpers/utils' +import PdfIcon from "@/assets/images/PDF.svg"; +import Button from "@/components/Button"; +import Divider from "@/components/Divider"; +import Input from "@/components/Input"; +import { toast } from "@/components/Toast"; +import { Paths } from "@/config/Paths"; +import { clx, extractErrorMessage } from "@/helpers/utils"; +import { usePageTitle } from "@/hooks/usePageTitle"; +import { ArrowLeft, DocumentText } from "iconsax-react"; +import { useState, type FC } from "react"; +import { useNavigate } from "react-router-dom"; +import DirectLogin from "../auth/components/DirectLogin"; +import { useCreateCatalog } from "./hooks/useHomeData"; const CATALOG_SIZES = [ - { id: 'a4', label: 'A4' }, - { id: 'a3', label: 'A3' }, - { id: 'a5', label: 'A5' }, -] as const + { id: "a4", label: "A4" }, + { id: "a3", label: "A3" }, + { id: "a5", label: "A5" }, +] as const; const Home: FC = () => { - usePageTitle('ساخت کاتالوگ') + usePageTitle("ساخت کاتالوگ"); - const navigate = useNavigate() - const [active, setActive] = useState('a4') - const [name, setName] = useState('') - const [slug, setSlug] = useState('') - const { mutate: createCatalog, isPending } = useCreateCatalog() + const navigate = useNavigate(); + const [active, setActive] = useState("a4"); + const [name, setName] = useState(""); + const [slug, setSlug] = useState(""); + const { mutate: createCatalog, isPending } = useCreateCatalog(); - const handleSubmit = () => { - if (!name) { - toast('نام کاتالوگ را وارد کنید', 'error') - } else if (!slug) { - toast('اسلاگ کاتالوگ را وارد کنید', 'error') - } else { - createCatalog({ name, slug, size: active, content: '' }, { - onSuccess: (data) => { - toast('کاتالوگ با موفقیت ساخته شد', 'success') - navigate(Paths.editor + `/${data?.data?.id}`) - }, - onError: (error) => { - toast(extractErrorMessage(error), 'error') - } - }) - } + const handleSubmit = () => { + if (!name) { + toast("نام کاتالوگ را وارد کنید", "error"); + } else if (!slug) { + toast("اسلاگ کاتالوگ را وارد کنید", "error"); + } else { + createCatalog( + { name, slug, size: active, content: "" }, + { + onSuccess: (data) => { + toast("کاتالوگ با موفقیت ساخته شد", "success"); + navigate(Paths.editor + `/${data?.data?.id}`); + }, + onError: (error) => { + toast(extractErrorMessage(error), "error"); + }, + }, + ); } + }; - return ( -
-
-

- ساخت کاتالوگ ب ویرایشگر داناک -

- -
+ return ( +
+
+

+ ساخت کاتالوگ به کمک ویرایشگر داناک +

+ +
-
-
- سایز و نام مورد نظر را انتخاب کنبد و یک کاتالوگ زیبا با ویرایشگر داناک بسازید -
- -
-
- {CATALOG_SIZES.map(({ id, label }) => ( - - ))} -
- -
- setName(e.target.value)} - /> - setSlug(e.target.value)} - /> -
- -
- -
-
- - - -
-
- upload -
- آپلود PDF -
- -
- رایگان -
-
-
-
+
+
+ سایز و نام مورد نظر را انتخاب کنبد و یک کاتالوگ زیبا با ویرایشگر داناک + بسازید
- ) -} -export default Home \ No newline at end of file +
+
+ {CATALOG_SIZES.map(({ id, label }) => ( + + ))} +
+ +
+ setName(e.target.value)} + /> + setSlug(e.target.value)} + /> +
+ +
+ +
+
+ + + +
+
+ upload +
آپلود PDF
+ +
+ رایگان +
+
+
+
+
+ ); +}; + +export default Home; diff --git a/src/shared/components/BuyCatalog.tsx b/src/shared/components/BuyCatalog.tsx index d8401e1..bbb0b2f 100644 --- a/src/shared/components/BuyCatalog.tsx +++ b/src/shared/components/BuyCatalog.tsx @@ -1,63 +1,69 @@ -import { useState, type FC } from 'react' -import Button from '@/components/Button' -import DefaulModal from '@/components/DefaulModal' -import Input from '@/components/Input' -import { toast } from '@/components/Toast' -import { usePurchaseInitate } from '@/pages/catalogue/hooks/useCatalogueData' -import { extractErrorMessage } from '@/helpers/utils' +import Button from "@/components/Button"; +import DefaulModal from "@/components/DefaulModal"; +import Input from "@/components/Input"; +import { toast } from "@/components/Toast"; +import { extractErrorMessage } from "@/helpers/utils"; +import { usePurchaseInitate } from "@/pages/catalogue/hooks/useCatalogueData"; +import { useState, type FC } from "react"; const BuyCatalog: FC = () => { + const [showModal, setShowModal] = useState(false); + const [count, setCount] = useState(0); + const { mutate, isPending } = usePurchaseInitate(); - const [showModal, setShowModal] = useState(false) - const [count, setCount] = useState(0) - const { mutate, isPending } = usePurchaseInitate() - - const handlePurchaseInitate = () => { - if (count > 0) { - mutate({ count: count }, { - onSuccess: (data) => { - console.log(data); - // TODO منتقل بشه به صفحه صورت حساب - }, - onError: (error) => { - toast(extractErrorMessage(error), 'error') - } - }) - } else { - toast('تعداد را انتخاب کنید') - } + const handlePurchaseInitate = () => { + if (count > 0) { + mutate( + { count: count }, + { + onSuccess: (data) => { + console.log(data); + // TODO منتقل بشه به صفحه صورت حساب + }, + onError: (error) => { + toast(extractErrorMessage(error), "error"); + }, + }, + ); + } else { + toast("تعداد را انتخاب کنید"); } + }; - return ( -
-
- -
+ return ( +
+
+ +
- setShowModal(false)} - isHeader - title_header='خرید کاتالوگ' - > -
- setCount(+e.target.value)} - /> -
-
- -
-
+ setShowModal(false)} + isHeader + title_header="خرید کاتالوگ" + > +
+ setCount(+e.target.value)} + />
- ) -} +
+ +
+
+
+ ); +}; -export default BuyCatalog \ No newline at end of file +export default BuyCatalog;