diff --git a/src/app/[name]/(Main)/[id]/page.tsx b/src/app/[name]/(Main)/[id]/page.tsx index 65a4b39..7fa9906 100644 --- a/src/app/[name]/(Main)/[id]/page.tsx +++ b/src/app/[name]/(Main)/[id]/page.tsx @@ -6,8 +6,8 @@ import PlusIcon from "@/components/icons/PlusIcon"; import { toast, toastLoginRequired } from "@/components/Toast"; import { getToken } from "@/lib/api/func"; import { ef } from "@/lib/helpers/utfNumbers"; -import clsx from "clsx"; import { glassSurface, glassSurfaceCard, glassSurfaceFlat } from "@/lib/styles/glassSurface"; +import clsx from "clsx"; import { motion } from "framer-motion"; import { ArrowLeft, Clock, Cup, Heart, TruckTick } from "iconsax-react"; import { useParams, useRouter } from "next/navigation"; @@ -106,18 +106,14 @@ function FoodPage({}: Props) { : Array.isArray(foodData.images) && foodData.images.length > 0 ? typeof foodData.images[0] === "string" ? foodData.images[0] - : typeof foodData.images[0] === "object" && - foodData.images[0] !== null && - "url" in foodData.images[0] + : typeof foodData.images[0] === "object" && foodData.images[0] !== null && "url" in foodData.images[0] ? (foodData.images[0] as { url: string }).url : "/assets/images/no-image.png" : "/assets/images/no-image.png"; const categoryName = foodData.category?.title; const prepareTime = foodData.prepareTime || 0; const price = foodData.price || 0; - const content = Array.isArray(foodData.content) - ? foodData.content.join("، ") - : foodData.content || foodData.desc || ""; + const content = Array.isArray(foodData.content) ? foodData.content.join("، ") : foodData.content || foodData.desc || ""; const handleBackToMenu = () => { const urlParams = new URLSearchParams(window.location.search); @@ -136,7 +132,9 @@ function FoodPage({}: Props) { !isAvailable && "opacity-50", )} > -
+
{/* eslint-disable-next-line @next/next/no-img-element */}
-
- {categoryName || "-"} -
-
-
+
{foodName}
-
@@ -182,10 +166,7 @@ function FoodPage({}: Props) {
- - زمان پخت و آماده سازی:{" "} - {prepareTime > 0 ? `${ef(String(prepareTime))} دقیقه` : "-"} - + زمان پخت و آماده سازی: {prepareTime > 0 ? `${ef(String(prepareTime))} دقیقه` : "-"}
@@ -195,18 +176,9 @@ function FoodPage({}: Props) {
۰
امتیاز برای هر بار خرید - ) : about?.data?.score?.purchaseScore && - about?.data?.score?.purchaseAmount ? ( + ) : about?.data?.score?.purchaseScore && about?.data?.score?.purchaseAmount ? ( <> -
- {ef( - Math.round( - foodData?.price * - (Number(about.data.score.purchaseScore) / - Number(about.data.score.purchaseAmount)), - ).toLocaleString("en-US"), - )} -
+
{ef(Math.round(foodData?.price * (Number(about.data.score.purchaseScore) / Number(about.data.score.purchaseAmount))).toLocaleString("en-US"))}
امتیاز برای هر بار خرید ) : ( @@ -216,9 +188,7 @@ function FoodPage({}: Props) {
- - {foodData.pickupServe ? "ارسال با پیک" : "-"} - + {foodData.pickupServe ? "ارسال با پیک" : "-"}
@@ -235,38 +205,23 @@ function FoodPage({}: Props) { className="bg-background pattern-secondary-bg active:drop-shadow-xs max-w-[115px] rounded-md w-full h-8 inline-flex p-1 justify-between items-center gap-2 relative overflow-hidden" > {quantity <= 0 ? ( - ) : ( <> - + {quantity} - diff --git a/src/app/[name]/(Profile)/profile/settings/page.tsx b/src/app/[name]/(Profile)/profile/settings/page.tsx index 9b1f7bb..9a61c9d 100644 --- a/src/app/[name]/(Profile)/profile/settings/page.tsx +++ b/src/app/[name]/(Profile)/profile/settings/page.tsx @@ -1,260 +1,198 @@ -'use client'; +"use client"; -import Button from '@/components/button/PrimaryButton'; -import PasswordField from '@/components/input/PasswordField'; -import TabContainer from '@/components/tab/TabContainer' -import { TabHeader } from '@/components/tab/TabHeader' -import { Switch } from '@/components/ui/switch'; -import Accordion from '@/components/utils/Accordion'; -import Seperator from '@/components/utils/Seperator'; -import { SmartIcon } from '@/components/utils/SmartIcon'; -import { getI18nObject } from '@/lib/i18n'; -import { SettingsData } from '@/types/i18n/settings'; -import { Key, KeySquare, Notification1, ArrowLeft, TickCircle } from 'iconsax-react' -import { useRouter } from 'next/navigation'; -import React, { Fragment, useState } from 'react' -import { useTranslation } from 'react-i18next'; -import { glassSurfaceCard } from '@/lib/styles/glassSurface'; +import Button from "@/components/button/PrimaryButton"; +import PasswordField from "@/components/input/PasswordField"; +import { Switch } from "@/components/ui/switch"; +import Accordion from "@/components/utils/Accordion"; +import Seperator from "@/components/utils/Seperator"; +import { SmartIcon } from "@/components/utils/SmartIcon"; +import { getI18nObject } from "@/lib/i18n"; +import { glassSurfaceCard } from "@/lib/styles/glassSurface"; +import { SettingsData } from "@/types/i18n/settings"; +import { ArrowLeft, Key, TickCircle } from "iconsax-react"; +import { useRouter } from "next/navigation"; +import React, { Fragment, useState } from "react"; +import { useTranslation } from "react-i18next"; function UserSettingsIndex() { - const router = useRouter(); - const { t } = useTranslation('settings'); - const data: SettingsData = getI18nObject(t, "data"); - const [statisticalParticipation, setStatisticalParticipation] = useState(true); + const router = useRouter(); + const { t } = useTranslation("settings"); + const data: SettingsData = getI18nObject(t, "data"); + const [statisticalParticipation, setStatisticalParticipation] = useState(true); - const onSwitched = (e: React.MouseEvent) => { - const target = e.target as HTMLElement; - console.log('Save changed setting?', target.id); - } + const onSwitched = (e: React.MouseEvent) => { + const target = e.target as HTMLElement; + console.log("Save changed setting?", target.id); + }; - const handleStatisticalToggle = (checked: boolean) => { - setStatisticalParticipation(checked); - console.log('Statistical participation:', checked); - } - - - - const notifsTab = () => { - - return ( -
-
- -
-

{data.TabNotifications.Heading}

-
- -
- {data.TabNotifications.Accordions.map((accordion, i) => { - return ( - - -
- {accordion.Items.map((item, j) => { - return ( - - ) - })} -
-
- -
- ) - })} -
- -
- -
- ) - } - - const passwordTab = () => { - - return ( -
-
- -
-

{data.TabPassword.Heading}

-
- -
e.preventDefault()} - className='grid gap-6 p-2' - > - {data.TabPassword.Inputs.map((input, i) => { - return ( - - ) - }) - - } - - {data.TabPassword.Rules.map((rule, i) => { - return ( -
-
{rule.Heading}
- {rule.Items.map((item, i) => { - return ( -
  • {item}
  • - ) - })} -
    - ) - })} - - - -
    -
    - ) - } - - const authenticatorTab = () => { - - return ( -
    -
    - -
    -

    {data.TabAuthenticator.Heading}

    -

    {data.TabAuthenticator.Description}

    -
    - - - -
    -
    - -
    -

    - {data.TabAuthenticator.Tip} -

    - -
    - -
    - - {data.TabAuthenticator.Guides.map((guide, i) => { - return ( -
    -
    {guide.Heading}
    -

    {guide.Description}

    - {guide.Items.map((item, i) => { - return ( -
    -
    - {item.Mark} -
    - - {item.Label} - -
    - ) - })} - - {guide.Notes.map((note, i) => { - return ( -
    - {note} -
    - ) - })} -
    - ) - })} -
    - -
    -
    - ) - } + const handleStatisticalToggle = (checked: boolean) => { + setStatisticalParticipation(checked); + console.log("Statistical participation:", checked); + }; + const notifsTab = () => { return ( -
    -
    - -

    {data.Heading}

    - { router.back() }} - /> +
    +
    +
    +

    {data.TabNotifications.Heading}

    +
    + +
    + {data.TabNotifications.Accordions.map((accordion, i) => { + return ( + + +
    + {accordion.Items.map((item, j) => { + return ( + + ); + })} +
    +
    + +
    + ); + })} +
    +
    +
    + ); + }; + + const passwordTab = () => { + return ( +
    +
    +
    +

    {data.TabPassword.Heading}

    +
    + +
    e.preventDefault()} className="grid gap-6 p-2"> + {data.TabPassword.Inputs.map((input, i) => { + return ; + })} + + {data.TabPassword.Rules.map((rule, i) => { + return ( +
    +
    {rule.Heading}
    + {rule.Items.map((item, i) => { + return
  • {item}
  • ; + })} +
    + ); + })} + + + +
    +
    + ); + }; + + const authenticatorTab = () => { + return ( +
    +
    +
    +

    {data.TabAuthenticator.Heading}

    +

    {data.TabAuthenticator.Description}

    +
    + + + +
    +
    + +
    +

    {data.TabAuthenticator.Tip}

    + +
    +
    -
    -
    -

    {data.StatisticalParticipation.Heading}

    - -
    -

    - {data.StatisticalParticipation.Description} -

    -
    + {data.TabAuthenticator.Guides.map((guide, i) => { + return ( +
    +
    {guide.Heading}
    +

    {guide.Description}

    + {guide.Items.map((item, i) => { + return ( +
    +
    {item.Mark}
    + {item.Label} +
    + ); + })} + {guide.Notes.map((note, i) => { + return ( +
    + {note} +
    + ); + })} +
    + ); + })} +
    - ) +
    + ); + }; + + return ( +
    +
    + +

    {data.Heading}

    + { + router.back(); + }} + /> +
    + +
    +
    +

    {data.StatisticalParticipation.Heading}

    + +
    +

    {data.StatisticalParticipation.Description}

    +
    +
    + ); } -export default UserSettingsIndex \ No newline at end of file +export default UserSettingsIndex; diff --git a/src/app/[name]/(Profile)/profile/wallet/page.tsx b/src/app/[name]/(Profile)/profile/wallet/page.tsx index f19cf29..a8c25bf 100644 --- a/src/app/[name]/(Profile)/profile/wallet/page.tsx +++ b/src/app/[name]/(Profile)/profile/wallet/page.tsx @@ -1,112 +1,85 @@ "use client"; -import Button from '@/components/button/PrimaryButton'; -import InputField from '@/components/input/InputField'; -import { ef, ue } from '@/lib/helpers/utfNumbers'; -import { ArrowLeft, ArrowRight, WalletMinus } from 'iconsax-react'; -import { useRouter } from 'next/navigation'; -import React, { useState } from 'react' -import { glassSurfaceCard } from '@/lib/styles/glassSurface'; +import Button from "@/components/button/PrimaryButton"; +import InputField from "@/components/input/InputField"; +import { ef, ue } from "@/lib/helpers/utfNumbers"; +import { glassSurfaceCard } from "@/lib/styles/glassSurface"; +import { ArrowLeft, ArrowRight, WalletMinus } from "iconsax-react"; +import { useRouter } from "next/navigation"; +import React, { useState } from "react"; -type Props = object +type Props = object; -function UserWalletIndex({ }: Props) { - const router = useRouter(); - const [chargeValue, setChargeValue] = useState('0'); - const chargeAction = (e: React.FormEvent) => { - e.preventDefault(); - const data = new FormData(e.currentTarget) - const value = Number(ue(String(data.get('chargeValue') ?? 0))) + 0; - console.log("Charge for: ", value); - } +function UserWalletIndex({}: Props) { + const router = useRouter(); + const [chargeValue, setChargeValue] = useState("0"); + const chargeAction = (e: React.FormEvent) => { + e.preventDefault(); + const data = new FormData(e.currentTarget); + const value = Number(ue(String(data.get("chargeValue") ?? 0))) + 0; + console.log("Charge for: ", value); + }; - return ( -
    -
    - -

    پروفایل کاربری

    - { router.back() }} - /> + return ( +
    +
    + +

    پروفایل کاربری

    + { + router.back(); + }} + /> +
    + +
    +
    +
    +
    +
    + + موجودی کیف پول +
    +
    {ef("250.000 تومان")}
    +
    - - -
    -
    -
    -
    - - موجودی کیف پول -
    -
    - {ef('250.000 تومان')} -
    -
    -
    - -
    -
    - برای شارژ کیف پول خود میتوانید بر روی یکی از مبالغ زیر کلیک کنید و یا مبلغ دلخواه خود را وارد کنید -
    - - - - setChargeValue(e.target.value)} - /> -
    -
    - -
    - -
    - +
    +
    برای شارژ کیف پول خود میتوانید بر روی یکی از مبالغ زیر کلیک کنید و یا مبلغ دلخواه خود را وارد کنید
    + + + + setChargeValue(e.target.value)} + /> +
    - ) + +
    + +
    + +
    + ); } -export default UserWalletIndex \ No newline at end of file +export default UserWalletIndex; diff --git a/src/components/listview/MenuItemRenderer.tsx b/src/components/listview/MenuItemRenderer.tsx index e45a383..48911a3 100644 --- a/src/components/listview/MenuItemRenderer.tsx +++ b/src/components/listview/MenuItemRenderer.tsx @@ -1,7 +1,7 @@ -'use client'; +"use client"; -import React from 'react'; -import { glassSurface } from '@/lib/styles/glassSurface'; +import { glassSurface } from "@/lib/styles/glassSurface"; +import React from "react"; type Props = { children: React.ReactNode; @@ -9,13 +9,7 @@ type Props = { function MenuItemRendererComponent({ children, ...rest }: Props) { return ( -
    - +
    {children}
    ); diff --git a/src/components/overlays/SplashScreen.tsx b/src/components/overlays/SplashScreen.tsx index 96c1fdb..e0efc41 100644 --- a/src/components/overlays/SplashScreen.tsx +++ b/src/components/overlays/SplashScreen.tsx @@ -1,8 +1,8 @@ -'use client'; +"use client"; -import { useEffect, useRef, useState } from 'react'; -import { motion } from 'framer-motion'; -import Image from 'next/image'; +import { motion } from "framer-motion"; +import Image from "next/image"; +import { useEffect, useRef, useState } from "react"; const MAX_DISPLAY_MS = 1200; const EXIT_MS = 350; @@ -14,27 +14,21 @@ interface SplashScreenProps { onDismiss: () => void; } -export default function SplashScreen({ - logo, - restaurantName, - onDismiss, -}: SplashScreenProps) { +export default function SplashScreen({ logo, restaurantName, onDismiss }: SplashScreenProps) { const [opacity, setOpacity] = useState(1); - const [logoState, setLogoState] = useState<'idle' | 'loading' | 'ready' | 'error'>( - logo ? 'loading' : 'idle', - ); + const [logoState, setLogoState] = useState<"idle" | "loading" | "ready" | "error">(logo ? "loading" : "idle"); const onDismissRef = useRef(onDismiss); onDismissRef.current = onDismiss; useEffect(() => { - setLogoState(logo ? 'loading' : 'idle'); + setLogoState(logo ? "loading" : "idle"); }, [logo]); useEffect(() => { - if (!logo || logoState !== 'loading') return; + if (!logo || logoState !== "loading") return; const logoTimeout = setTimeout(() => { - setLogoState('error'); + setLogoState("error"); }, LOGO_TIMEOUT_MS); return () => clearTimeout(logoTimeout); @@ -55,13 +49,12 @@ export default function SplashScreen({ }; }, []); - return (
    - {logo && logoState !== 'error' && ( + {logo && logoState !== "error" && (
    {restaurantName setLogoState('ready')} - onError={() => setLogoState('error')} + onLoad={() => setLogoState("ready")} + onError={() => setLogoState("error")} style={{ - opacity: logoState === 'ready' ? 1 : 0, - transition: 'opacity 0.3s', + opacity: logoState === "ready" ? 1 : 0, + transition: "opacity 0.3s", }} /> -
    )} @@ -127,7 +119,7 @@ export default function SplashScreen({ duration: 1.5, delay, repeat: Infinity, - ease: 'easeInOut', + ease: "easeInOut", }} className="w-3 h-3 rounded-full bg-primary shadow-lg shadow-primary/50" />