diff --git a/package.json b/package.json index 79689c6..2c72400 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "enduser.salona", "private": true, - "version": "0.8.0", + "version": "0.8.5", "type": "module", "scripts": { "dev": "vite", diff --git a/src/App.css b/src/App.css index 2ce05bf..3601461 100644 --- a/src/App.css +++ b/src/App.css @@ -3,9 +3,65 @@ @tailwind utilities; @font-face { - font-family: IRANYekan; - src: url('./assets/fonts/IRANYekan.woff') format('woff'); - font-weight: normal; + font-family: Vazirmatn; + src: url('./assets/fonts/Vazirmatn-FD/Vazirmatn-FD-Thin.woff2') format('woff2'); + font-weight: 100; + font-style: normal; + font-display: swap; +} +@font-face { + font-family: Vazirmatn; + src: url('./assets/fonts/Vazirmatn-FD/Vazirmatn-FD-ExtraLight.woff2') format('woff2'); + font-weight: 200; + font-style: normal; + font-display: swap; +} +@font-face { + font-family: Vazirmatn; + src: url('./assets/fonts/Vazirmatn-FD/Vazirmatn-FD-Light.woff2') format('woff2'); + font-weight: 300; + font-style: normal; + font-display: swap; +} +@font-face { + font-family: Vazirmatn; + src: url('./assets/fonts/Vazirmatn-FD/Vazirmatn-FD-Regular.woff2') format('woff2'); + font-weight: 400; + font-style: normal; + font-display: swap; +} +@font-face { + font-family: Vazirmatn; + src: url('./assets/fonts/Vazirmatn-FD/Vazirmatn-FD-Medium.woff2') format('woff2'); + font-weight: 500; + font-style: normal; + font-display: swap; +} +@font-face { + font-family: Vazirmatn; + src: url('./assets/fonts/Vazirmatn-FD/Vazirmatn-FD-SemiBold.woff2') format('woff2'); + font-weight: 600; + font-style: normal; + font-display: swap; +} +@font-face { + font-family: Vazirmatn; + src: url('./assets/fonts/Vazirmatn-FD/Vazirmatn-FD-Bold.woff2') format('woff2'); + font-weight: 700; + font-style: normal; + font-display: swap; +} +@font-face { + font-family: Vazirmatn; + src: url('./assets/fonts/Vazirmatn-FD/Vazirmatn-FD-ExtraBold.woff2') format('woff2'); + font-weight: 800; + font-style: normal; + font-display: swap; +} +@font-face { + font-family: Vazirmatn; + src: url('./assets/fonts/Vazirmatn-FD/Vazirmatn-FD-Black.woff2') format('woff2'); + font-weight: 900; font-style: normal; font-display: swap; } @@ -58,7 +114,7 @@ text-size-adjust: 100%; } body { - @apply !font-iranYekan relative tracking-normal bg-background text-foreground overflow-x-hidden select-none; + @apply !font-vazirmatn relative tracking-normal bg-background text-foreground overflow-x-hidden select-none; -moz-font-feature-settings: 'ss02' !important; -webkit-font-feature-settings: 'ss02' !important; font-feature-settings: 'ss02' !important; @@ -78,7 +134,7 @@ } } div[role='dialog'] { - @apply font-iranYekan; + @apply font-vazirmatn; } .swal2-modal { @apply p-5; @@ -155,3 +211,17 @@ input[inputMode='tel'] { .swiper-pagination-bullet-active { @apply bg-white w-6 rounded-md; } +@keyframes fadeInRight { + 0% { + opacity: 0; + transform: translateX(50px); + } + + 100% { + opacity: 1; + transform: translateX(0); + } +} +.animate-fadeInRight { + animation: fadeInRight 1s ease 0s 1 normal forwards; +} \ No newline at end of file diff --git a/src/assets/fonts/IRANYekan.woff b/src/assets/fonts/IRANYekan.woff deleted file mode 100644 index bcc27e0..0000000 Binary files a/src/assets/fonts/IRANYekan.woff and /dev/null differ diff --git a/src/assets/fonts/Vazirmatn-FD/Vazirmatn-FD-Black.woff2 b/src/assets/fonts/Vazirmatn-FD/Vazirmatn-FD-Black.woff2 new file mode 100644 index 0000000..251a923 Binary files /dev/null and b/src/assets/fonts/Vazirmatn-FD/Vazirmatn-FD-Black.woff2 differ diff --git a/src/assets/fonts/Vazirmatn-FD/Vazirmatn-FD-Bold.woff2 b/src/assets/fonts/Vazirmatn-FD/Vazirmatn-FD-Bold.woff2 new file mode 100644 index 0000000..f97f0db Binary files /dev/null and b/src/assets/fonts/Vazirmatn-FD/Vazirmatn-FD-Bold.woff2 differ diff --git a/src/assets/fonts/Vazirmatn-FD/Vazirmatn-FD-ExtraBold.woff2 b/src/assets/fonts/Vazirmatn-FD/Vazirmatn-FD-ExtraBold.woff2 new file mode 100644 index 0000000..e2b2d31 Binary files /dev/null and b/src/assets/fonts/Vazirmatn-FD/Vazirmatn-FD-ExtraBold.woff2 differ diff --git a/src/assets/fonts/Vazirmatn-FD/Vazirmatn-FD-ExtraLight.woff2 b/src/assets/fonts/Vazirmatn-FD/Vazirmatn-FD-ExtraLight.woff2 new file mode 100644 index 0000000..d019c92 Binary files /dev/null and b/src/assets/fonts/Vazirmatn-FD/Vazirmatn-FD-ExtraLight.woff2 differ diff --git a/src/assets/fonts/Vazirmatn-FD/Vazirmatn-FD-Light.woff2 b/src/assets/fonts/Vazirmatn-FD/Vazirmatn-FD-Light.woff2 new file mode 100644 index 0000000..41d75fb Binary files /dev/null and b/src/assets/fonts/Vazirmatn-FD/Vazirmatn-FD-Light.woff2 differ diff --git a/src/assets/fonts/Vazirmatn-FD/Vazirmatn-FD-Medium.woff2 b/src/assets/fonts/Vazirmatn-FD/Vazirmatn-FD-Medium.woff2 new file mode 100644 index 0000000..2721237 Binary files /dev/null and b/src/assets/fonts/Vazirmatn-FD/Vazirmatn-FD-Medium.woff2 differ diff --git a/src/assets/fonts/Vazirmatn-FD/Vazirmatn-FD-Regular.woff2 b/src/assets/fonts/Vazirmatn-FD/Vazirmatn-FD-Regular.woff2 new file mode 100644 index 0000000..ac7cff8 Binary files /dev/null and b/src/assets/fonts/Vazirmatn-FD/Vazirmatn-FD-Regular.woff2 differ diff --git a/src/assets/fonts/Vazirmatn-FD/Vazirmatn-FD-SemiBold.woff2 b/src/assets/fonts/Vazirmatn-FD/Vazirmatn-FD-SemiBold.woff2 new file mode 100644 index 0000000..359e57e Binary files /dev/null and b/src/assets/fonts/Vazirmatn-FD/Vazirmatn-FD-SemiBold.woff2 differ diff --git a/src/assets/fonts/Vazirmatn-FD/Vazirmatn-FD-Thin.woff2 b/src/assets/fonts/Vazirmatn-FD/Vazirmatn-FD-Thin.woff2 new file mode 100644 index 0000000..d9cfb37 Binary files /dev/null and b/src/assets/fonts/Vazirmatn-FD/Vazirmatn-FD-Thin.woff2 differ diff --git a/src/assets/images/shop.svg b/src/assets/images/shop.svg new file mode 100644 index 0000000..3985370 --- /dev/null +++ b/src/assets/images/shop.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/components/DrawerMenu/SidebarItems.tsx b/src/components/DrawerMenu/SidebarItems.tsx index b8a21f6..e47d35d 100644 --- a/src/components/DrawerMenu/SidebarItems.tsx +++ b/src/components/DrawerMenu/SidebarItems.tsx @@ -6,6 +6,7 @@ import { Link } from 'react-router-dom'; type LinkMenuItemProps = { title: string; + subtitle?: string; icon?: React.ForwardRefExoticComponent< Omit & React.RefAttributes >; @@ -86,6 +87,7 @@ MenuButton.displayName = 'MenuButton'; const LinkMenuItem: React.FC = ({ title, + subtitle, url, icon: Icon, isDisabled, @@ -119,7 +121,15 @@ const LinkMenuItem: React.FC = ({ > {Icon && } - {title} + + {title} + {subtitle && ( + + + {subtitle} + + )} + @@ -128,7 +138,10 @@ const LinkMenuItem: React.FC = ({ {Icon && } - {title} + + {title} + {subtitle} + ); diff --git a/src/components/DrawerMenu/index.tsx b/src/components/DrawerMenu/index.tsx index 66021eb..aad0907 100644 --- a/src/components/DrawerMenu/index.tsx +++ b/src/components/DrawerMenu/index.tsx @@ -1,3 +1,4 @@ +import { Dispatch, SetStateAction } from 'react'; import { Button } from '@/components/ui/button'; import { Drawer, DrawerContent, DrawerHeader } from '@/components/ui/drawer'; import { useGetUserInfo } from '@/services/User'; @@ -12,7 +13,6 @@ import { version } from '@package.json'; import { Avatar } from '@/components/ui/avatar'; import { useMenu } from '@/hooks/useMenu'; import { Alert } from '@/components/ui/alert-dialog'; -import { Dispatch, SetStateAction, useMemo } from 'react'; import SocialMediaLink from '@/components/SocialMediaLink'; import { Link, useNavigate } from 'react-router-dom'; import { useMultiAccounts } from '@/hooks/useMultipleAccounts'; @@ -36,15 +36,6 @@ const DrawerMenu = ({ const { multipleAccountsData, switchAccount, logOutAccount } = useMultiAccounts(); const { data: userInfo, isLoading: userInfoLoading } = useGetUserInfo(); - const profileCompletionPercentage = useMemo(() => { - const total = 6; - let isFilled = 2; - if (userInfo?.current_user.date_of_birth) isFilled += 1; - if (userInfo?.current_user.gender) isFilled += 1; - if (userInfo?.current_user.province) isFilled += 1; - if (userInfo?.current_user.city) isFilled += 1; - return Math.ceil((isFilled / total) * 100); - }, [userInfo]); const logOutHandler = () => { Alert.fire({ text: 'آیا از خروج از حساب کاربری خود اطمینان دارید؟', @@ -166,25 +157,6 @@ const DrawerMenu = ({ - {profileCompletionPercentage < 100 ? ( - - لطفا حساب کاربری خود را تکمیل نمایید - - - - - {profileCompletionPercentage}% - - - ) : ( - <>> - )} diff --git a/src/hooks/useMenu.tsx b/src/hooks/useMenu.tsx index 28df130..587458f 100644 --- a/src/hooks/useMenu.tsx +++ b/src/hooks/useMenu.tsx @@ -4,20 +4,35 @@ import { ExternalLinkMenuItemProps, LinkMenuItemProps, } from '@/components/DrawerMenu/SidebarItems'; -import { - Building2Icon, - ContactIcon, - LayoutDashboardIcon, -} from 'lucide-react'; +import { Building2Icon, ContactIcon, LayoutDashboardIcon } from 'lucide-react'; import ROUTES_OBJECT from '@/routes/RoutesObject'; +import { useGetUserInfo } from '@/services/User'; export const useMenu = (): Record< string, (LinkMenuItemProps | ExternalLinkMenuItemProps | ClickableMenuItemProps)[] > => { + const { data: userInfo } = useGetUserInfo(); + const showProfileCompletion = useMemo(() => { + if ( + !userInfo?.current_user.date_of_birth || + !userInfo?.current_user.gender || + !userInfo?.current_user.province || + !userInfo?.current_user.city + ) + return true; + return false; + }, [userInfo]); const menuItems = useMemo( () => ({ first: [ - { title: 'پروفایل', url: ROUTES_OBJECT.profile, icon: ContactIcon }, + { + title: 'پروفایل', + subtitle: showProfileCompletion + ? 'لطفا اطلاعات خود را تکمیل نمایید' + : undefined, + url: ROUTES_OBJECT.profile, + icon: ContactIcon, + }, { title: 'صفحه اصلی', url: ROUTES_OBJECT.explore, @@ -32,7 +47,7 @@ export const useMenu = (): Record< }, ], }), - [], + [showProfileCompletion], ); return menuItems; }; diff --git a/src/pages/explore/index.tsx b/src/pages/explore/index.tsx index 909e5ad..694862d 100644 --- a/src/pages/explore/index.tsx +++ b/src/pages/explore/index.tsx @@ -6,6 +6,8 @@ import { Grid, Pagination, Navigation } from 'swiper/modules'; import { useIsMobile } from '@/hooks/useIsMobile'; import ExploreCard from './+components/ExploreCard'; import ROUTES_OBJECT from '@/routes/RoutesObject'; +import TopSlider from './+components/TopSlider'; +import { useGetAllSurveyForms } from '@/services/SurveyForm'; import deliveryListVector from '@/assets/images/delivery-list.svg'; import mobileVector from '@/assets/images/mobile.svg'; import formVector from '@/assets/images/form.svg'; @@ -14,9 +16,7 @@ import discountVector from '@/assets/images/discount.svg'; import puzzleVector from '@/assets/images/puzzle.svg'; import walletVector from '@/assets/images/wallet.svg'; import customerSupportVector from '@/assets/images/customer-support.svg'; -import globalLocationVector from '@/assets/images/global-location.svg'; -import TopSlider from './+components/TopSlider'; -import { useGetAllSurveyForms } from '@/services/SurveyForm'; +import shopVector from '@/assets/images/shop.svg'; const sliderProps: SwiperOptions = { slidesPerView: 1, @@ -33,13 +33,6 @@ const Explore = () => { const itemsPerSlide = isMobile ? 9 : 12; const exploreCardsData = useMemo( () => [ - { - label: 'نوبت های من', - icon: , - link: ROUTES_OBJECT.appointments, - tooltip: 'ویژه', - isBold: true, - }, { label: 'کارت های وفاداری', icon: , @@ -65,8 +58,15 @@ const Explore = () => { isLock: true, }, { - label: 'نقشه', - icon: , + label: 'نوبت های من', + icon: , + link: ROUTES_OBJECT.appointments, + tooltip: 'ویژه', + isBold: true, + }, + { + label: 'فروشگاه', + icon: , link: '', isLock: true, }, @@ -101,16 +101,15 @@ const Explore = () => { const groupedCards = chunkArray(exploreCardsData, itemsPerSlide); return ( - - - + + {groupedCards.map((slideGroup, index) => ( - + {slideGroup.map((card, cardIndex) => ( ))} diff --git a/src/pages/loyalty-cards/+components/Echo.tsx b/src/pages/loyalty-cards/+components/Echo.tsx index 13bdc99..0810052 100644 --- a/src/pages/loyalty-cards/+components/Echo.tsx +++ b/src/pages/loyalty-cards/+components/Echo.tsx @@ -26,7 +26,7 @@ const Echo = (data: ILoyaltyCard) => { ) : ( - + {data.predicted_number_of_visits - data.number_of_visits}{' '} حضور دیگر مانده تا diff --git a/src/pages/loyalty-cards/+components/Enchant.tsx b/src/pages/loyalty-cards/+components/Enchant.tsx index 8ebb6c1..53db4e3 100644 --- a/src/pages/loyalty-cards/+components/Enchant.tsx +++ b/src/pages/loyalty-cards/+components/Enchant.tsx @@ -22,7 +22,7 @@ const Enchant = (data: ILoyaltyCard) => { ) : ( - + {data.predicted_number_of_visits - data.number_of_visits}{' '} حضور دیگر مانده تا diff --git a/src/pages/loyalty-cards/+components/LoyaltyCardListItem.tsx b/src/pages/loyalty-cards/+components/LoyaltyCardListItem.tsx index 11abedb..eac2143 100644 --- a/src/pages/loyalty-cards/+components/LoyaltyCardListItem.tsx +++ b/src/pages/loyalty-cards/+components/LoyaltyCardListItem.tsx @@ -20,7 +20,7 @@ const LoyaltyCardListItem = ({ data }: Props) => { return ( کارت وفاداری diff --git a/src/pages/loyalty-cards/+components/Radiance.tsx b/src/pages/loyalty-cards/+components/Radiance.tsx index 82315a6..e619230 100644 --- a/src/pages/loyalty-cards/+components/Radiance.tsx +++ b/src/pages/loyalty-cards/+components/Radiance.tsx @@ -22,7 +22,7 @@ const Radiance = (data: ILoyaltyCard) => { ) : ( - + {data.predicted_number_of_visits - data.number_of_visits}{' '} حضور دیگر مانده تا diff --git a/src/pages/loyalty-cards/+components/Whisper.tsx b/src/pages/loyalty-cards/+components/Whisper.tsx index b44a8cc..5f98a84 100644 --- a/src/pages/loyalty-cards/+components/Whisper.tsx +++ b/src/pages/loyalty-cards/+components/Whisper.tsx @@ -24,7 +24,7 @@ const Whisper = (data: ILoyaltyCard) => { ) : ( - + {data.predicted_number_of_visits - data.number_of_visits}{' '} حضور دیگر مانده تا diff --git a/src/pages/survey-form/response.tsx b/src/pages/survey-form/response.tsx index 3d5c6b7..03f15ff 100644 --- a/src/pages/survey-form/response.tsx +++ b/src/pages/survey-form/response.tsx @@ -1,5 +1,5 @@ import { useEffect, useState } from 'react'; -import { Link, useParams } from 'react-router-dom'; +import { Link, useNavigate, useParams } from 'react-router-dom'; import { ErrorComponentFallback } from '@/components/ErrorComponentFallback'; import { Skeleton } from '@/components/ui/skeleton'; import { @@ -25,6 +25,7 @@ import toast from 'react-hot-toast'; import { Alert } from '@/components/ui/alert-dialog'; import { useMultiAccounts } from '@/hooks/useMultipleAccounts'; import ROUTES_OBJECT from '@/routes/RoutesObject'; +import BackBtn from '@/components/BackBtn'; const initialAnswers: ISurveyAnswers = { question_1: null, @@ -41,6 +42,7 @@ const initialAnswers: ISurveyAnswers = { }; const ResponseToSurveyForm = () => { const { id = '' } = useParams(); + const navigate = useNavigate(); const { currectAccount } = useMultiAccounts(); const [questionPointer, setQuestionPointer] = useState(0); const [fakeAnimation, setFakeAnimation] = useState(false); @@ -132,6 +134,11 @@ const ResponseToSurveyForm = () => { return ( + {currectAccount?.id && ( + + navigate(ROUTES_OBJECT.loyaltyCards)} /> + + )} {isError ? ( @@ -219,7 +226,7 @@ const ResponseToSurveyForm = () => { - + {questionPointer < 10 ? ( <> diff --git a/tailwind.config.js b/tailwind.config.js index 62ebeaf..a7ac404 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -12,10 +12,10 @@ export default { 'h-xl': { 'raw': '(min-height: 1280px) and (max-width: 768px)' }, }, fontFamily: { - iranYekan: ['IRANYekan', 'tahoma', 'sans-serif'], - boblious: ['Boblious', 'IRANYekan', 'tahoma', 'sans-serif'], - hayat: ['Hayat', 'IRANYekan', 'tahoma', 'sans-serif'], - digiMadasi: ['DigiMadasi', 'IRANYekan', 'tahoma', 'sans-serif'], + vazirmatn: ['Vazirmatn', 'tahoma', 'sans-serif'], + boblious: ['Boblious', 'Vazirmatn', 'tahoma', 'sans-serif'], + hayat: ['Hayat', 'Vazirmatn', 'tahoma', 'sans-serif'], + digiMadasi: ['DigiMadasi', 'Vazirmatn', 'tahoma', 'sans-serif'], }, borderRadius: { lg: 'var(--radius)',
{title}
{subtitle}
لطفا حساب کاربری خود را تکمیل نمایید