From ca4e057fdf5a8f0bb055bbcc6adcc01f4b9be610 Mon Sep 17 00:00:00 2001 From: Umar Adilov <99314948+adilovcode@users.noreply.github.com> Date: Sat, 3 May 2025 00:15:31 +0500 Subject: [PATCH 1/3] Fixed minor issues --- public/placeholder.svg | 1 + src/features/map/ui/yandex-map.tsx | 7 +- src/pages-templates/charity/index.tsx | 39 +- .../clients/certificates/index.tsx | 2 + src/pages-templates/clients/index.tsx | 8 +- src/pages-templates/clients/loyalty/index.tsx | 373 ++++++++++-------- src/shared/components/promotion-slider.tsx | 6 +- src/widgets/clients/ui/benefits-section.tsx | 11 +- src/widgets/hero-section.tsx | 8 +- 9 files changed, 258 insertions(+), 197 deletions(-) create mode 100644 public/placeholder.svg diff --git a/public/placeholder.svg b/public/placeholder.svg new file mode 100644 index 0000000..30aee44 --- /dev/null +++ b/public/placeholder.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/features/map/ui/yandex-map.tsx b/src/features/map/ui/yandex-map.tsx index 93b667a..f542182 100644 --- a/src/features/map/ui/yandex-map.tsx +++ b/src/features/map/ui/yandex-map.tsx @@ -1,7 +1,7 @@ 'use client'; import { Map, Placemark, YMaps } from '@pbe/react-yandex-maps'; -import React from 'react'; +import { isEmpty } from 'lodash'; import { Point } from '../model'; @@ -9,7 +9,7 @@ type YandexMapProps = { points: Point[]; }; -const mapCenter = [55.751574, 37.573856]; +const mapCenter = [38.53575, 68.77905]; export const YandexMap = ({ points }: YandexMapProps) => { return ( @@ -17,12 +17,11 @@ export const YandexMap = ({ points }: YandexMapProps) => { query={{ apikey: process.env.NEXT_PUBLIC_YANDEX_MAP_API_KEY, lang: 'ru_RU', - // load: 'geoObject.addon.balloon', }} >
-
+
@@ -56,7 +60,7 @@ export function CharityPage() {

{t('charity.hero.title')}

-

+

{t('charity.hero.subtitle')}

@@ -87,21 +91,30 @@ export function CharityPage() {
{[0, 1, 2].map((index) => ( -
+

{t(`charity.mission.principles.${index}.title`)}

- {t(`charity.mission.principles.${index}.description`)} + {t( + `charity.mission.principles.${index}.description`, + )}

))}
-
+
{t('charity.mission.imageAlt')} ( - +
- {event.title} + + {event.title} +

{event.description}

@@ -267,7 +286,9 @@ export function CharityPage() { ].map((item, index) => ( -
{item.icon}
+
+ {item.icon} +
{item.title} diff --git a/src/pages-templates/clients/certificates/index.tsx b/src/pages-templates/clients/certificates/index.tsx index 1f6b6ff..5c93793 100644 --- a/src/pages-templates/clients/certificates/index.tsx +++ b/src/pages-templates/clients/certificates/index.tsx @@ -64,6 +64,8 @@ export function CertificatesPage() { }, ]; + certificates.length = 0; + return (
diff --git a/src/pages-templates/clients/index.tsx b/src/pages-templates/clients/index.tsx index 42eb934..0d2ba69 100644 --- a/src/pages-templates/clients/index.tsx +++ b/src/pages-templates/clients/index.tsx @@ -3,11 +3,11 @@ import Image from 'next/image'; import { useTextController } from '@/shared/language/hooks/use-text-controller'; +import Container from '@/shared/shadcn-ui/conteiner'; import { BenefitsSection } from '@/widgets/clients/ui/benefits-section'; import { ServicesOverviewSection } from '@/widgets/clients/ui/services-overview-section'; import { CtaSection } from '@/widgets/cta-section'; -import Container from '@/shared/shadcn-ui/conteiner'; export const metadata = { title: 'Клиентам | GasNetwork - Сеть заправок в Таджикистане', @@ -34,7 +34,11 @@ export function ClientsPage() { />
-
+

{t('clients.title')} diff --git a/src/pages-templates/clients/loyalty/index.tsx b/src/pages-templates/clients/loyalty/index.tsx index ec6d37d..fab0c56 100644 --- a/src/pages-templates/clients/loyalty/index.tsx +++ b/src/pages-templates/clients/loyalty/index.tsx @@ -5,11 +5,11 @@ import Image from 'next/image'; import { useTextController } from '@/shared/language/hooks/use-text-controller'; import { Card, CardContent } from '@/shared/shadcn-ui/card'; - -import { CtaSection } from '@/widgets/cta-section'; import Container from '@/shared/shadcn-ui/conteiner'; -import ProgrammImg from '../../../../public/clients/loyatly/03a771e7-5d76-4111-a516-801aa925659f.jpg' +import { CtaSection } from '@/widgets/cta-section'; + +import ProgrammImg from '../../../../public/clients/loyatly/03a771e7-5d76-4111-a516-801aa925659f.jpg'; export const metadata = { title: 'Программа лояльности | GasNetwork - Сеть заправок в Таджикистане', @@ -35,8 +35,12 @@ export function LoyaltyPage() { priority />
- -
+ +

{t('clients.loyalty.title')} @@ -46,7 +50,7 @@ export function LoyaltyPage() {

-
+
@@ -80,7 +84,9 @@ export function LoyaltyPage() { {t('clients.loyalty.programm.conditions-1')}

- {t('clients.loyalty.programm.conditions.description-1')} + {t( + 'clients.loyalty.programm.conditions.description-1', + )}

@@ -93,7 +99,9 @@ export function LoyaltyPage() { {t('clients.loyalty.programm.conditions-2')}

- {t('clients.loyalty.programm.conditions.description-2')} + {t( + 'clients.loyalty.programm.conditions.description-2', + )}

@@ -106,18 +114,23 @@ export function LoyaltyPage() { {t('clients.loyalty.programm.conditions-3')}

- {t('clients.loyalty.programm.conditions.description-3')} + {t( + 'clients.loyalty.programm.conditions.description-3', + )}

-
+
Программа лояльности
@@ -126,7 +139,7 @@ export function LoyaltyPage() { {/* How It Works */} -
+

@@ -137,53 +150,53 @@ export function LoyaltyPage() {

-
-
-
- 1 +
+
+
+ 1 +
+

+ {t('clients.loyalty.works.stage-1')} +

+

+ {t('clients.loyalty.works.stage.description-1')} +

-

- {t('clients.loyalty.works.stage-1')} -

-

- {t('clients.loyalty.works.stage.description-1')} -

-
-
-
- 2 +
+
+ 2 +
+

+ {t('clients.loyalty.works.stage-2')} +

+

+ {t('clients.loyalty.works.stage.description-2')} +

-

- {t('clients.loyalty.works.stage-2')} -

-

- {t('clients.loyalty.works.stage.description-2')} -

-
-
-
- 3 +
+
+ 3 +
+

+ {t('clients.loyalty.works.stage-3')} +

+

+ {t('clients.loyalty.works.stage.description-3')} +

-

- {t('clients.loyalty.works.stage-3')} -

-

- {t('clients.loyalty.works.stage.description-3')} -

-
-
-
- 4 +
+
+ 4 +
+

+ {t('clients.loyalty.works.stage-4')} +

+

+ {t('clients.loyalty.works.stage.description-4')} +

-

- {t('clients.loyalty.works.stage-4')} -

-

- {t('clients.loyalty.works.stage.description-4')} -

-
{/* Loyalty Levels */} @@ -198,132 +211,144 @@ export function LoyaltyPage() {

-
- - -

- {t('clients.loyalty.works.levels.card-1.title')} -

-
- - {t('clients.loyalty.works.levels.card-1.percent')} +
+ + +

+ {t('clients.loyalty.works.levels.card-1.title')} +

+
+ + {t('clients.loyalty.works.levels.card-1.percent')} + +

+ {t('clients.loyalty.works.levels.card.mark')} +

+
+
    +
  • + + + {t('clients.loyalty.works.levels.card-1.bonus-1')} -

    - {t('clients.loyalty.works.levels.card.mark')} -

    -
-
    -
  • - - - {t('clients.loyalty.works.levels.card-1.bonus-1')} - -
  • -
  • - - - {t('clients.loyalty.works.levels.card-1.bonus-2')} - -
  • -
  • - - - {t('clients.loyalty.works.levels.card-1.bonus-3')} - -
  • -
- - + +
  • + + + {t('clients.loyalty.works.levels.card-1.bonus-2')} + +
  • +
  • + + + {t('clients.loyalty.works.levels.card-1.bonus-3')} + +
  • + + + - - -

    - {t('clients.loyalty.works.levels.card-2.title')} -

    -
    - - {t('clients.loyalty.works.levels.card-2.percent')} + + +

    + {t('clients.loyalty.works.levels.card-2.title')} +

    +
    + + {t('clients.loyalty.works.levels.card-2.percent')} + +

    + {t('clients.loyalty.works.levels.card.mark')} +

    +
    +
      +
    • + + + {t('clients.loyalty.works.levels.card-2.bonus-1')} -

      - {t('clients.loyalty.works.levels.card.mark')} -

      -
    -
      -
    • - - - {t('clients.loyalty.works.levels.card-2.bonus-1')} - -
    • -
    • - - - {t('clients.loyalty.works.levels.card-2.bonus-2')} - -
    • -
    • - - - {t('clients.loyalty.works.levels.card-2.bonus-3')} - -
    • -
    • - - - {t('clients.loyalty.works.levels.card-2.bonus-4')} - -
    • -
    -
    -
    + +
  • + + + {t('clients.loyalty.works.levels.card-2.bonus-2')} + +
  • +
  • + + + {t('clients.loyalty.works.levels.card-2.bonus-3')} + +
  • +
  • + + + {t('clients.loyalty.works.levels.card-2.bonus-4')} + +
  • + + + - - -

    - {t('clients.loyalty.works.levels.card-3.title')} -

    -
    - - {t('clients.loyalty.works.levels.card-3.percent')} + + +

    + {t('clients.loyalty.works.levels.card-3.title')} +

    +
    + + {t('clients.loyalty.works.levels.card-3.percent')} + +

    + {t('clients.loyalty.works.levels.card.mark')} +

    +
    +
      +
    • + + + {t('clients.loyalty.works.levels.card-3.bonus-1')} -

      - {t('clients.loyalty.works.levels.card.mark')} -

      -
    -
      -
    • - - - {t('clients.loyalty.works.levels.card-3.bonus-1')} - -
    • -
    • - - - {t('clients.loyalty.works.levels.card-3.bonus-2')} - -
    • -
    • - - - {t('clients.loyalty.works.levels.card-3.bonus-3')} - -
    • -
    • - - - {t('clients.loyalty.works.levels.card-3.bonus-4')} - -
    • -
    • - - - {t('clients.loyalty.works.levels.card-3.bonus-5')} - -
    • -
    -
    -
    + +
  • + + + {t('clients.loyalty.works.levels.card-3.bonus-2')} + +
  • +
  • + + + {t('clients.loyalty.works.levels.card-3.bonus-3')} + +
  • +
  • + + + {t('clients.loyalty.works.levels.card-3.bonus-4')} + +
  • +
  • + + + {t('clients.loyalty.works.levels.card-3.bonus-5')} + +
  • + + +
    diff --git a/src/shared/components/promotion-slider.tsx b/src/shared/components/promotion-slider.tsx index e2806c8..f5008ca 100644 --- a/src/shared/components/promotion-slider.tsx +++ b/src/shared/components/promotion-slider.tsx @@ -10,7 +10,9 @@ import { Discounts } from '@/app/api-utlities/@types/index'; import { useTextController } from '@/shared/language/hooks/use-text-controller'; import { Button } from '@/shared/shadcn-ui/button'; import { Card, CardContent } from '@/shared/shadcn-ui/card'; -import PromoImg from '../../../public/main/#promotions/995b9daa-959f-4bd5-9135-ef7c47148f2c.jpg' + +import PromoImg from '../../../public/main/#promotions/995b9daa-959f-4bd5-9135-ef7c47148f2c.jpg'; + const promotions = [ { id: 1, @@ -105,7 +107,7 @@ export default function PromotionSlider({ discounts }: PromotionSliderProps) { src={PromoImg} alt={promo.name} fill - className='object-contain p-2 rounded-lg' + className='rounded-lg object-contain p-2' />
    diff --git a/src/widgets/clients/ui/benefits-section.tsx b/src/widgets/clients/ui/benefits-section.tsx index 3ce4fbd..2fa88b0 100644 --- a/src/widgets/clients/ui/benefits-section.tsx +++ b/src/widgets/clients/ui/benefits-section.tsx @@ -38,7 +38,11 @@ export const BenefitsSection = () => {
    -
    +
    @@ -65,7 +69,10 @@ export const BenefitsSection = () => { })}
    -
    +
    Преимущества для клиентов {
    -

    +

    {t('home.hero.title')}

    {t('home.hero.description')}

    -
    - +
    + - + From cf37fe67e63dfb7c41489bee0720760cf04f0bc0 Mon Sep 17 00:00:00 2001 From: Umar Adilov <99314948+adilovcode@users.noreply.github.com> Date: Sat, 3 May 2025 00:34:14 +0500 Subject: [PATCH 2/3] added cursor pointer for tabs --- src/pages-templates/login/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages-templates/login/index.tsx b/src/pages-templates/login/index.tsx index 40c4bb1..8b30644 100644 --- a/src/pages-templates/login/index.tsx +++ b/src/pages-templates/login/index.tsx @@ -66,7 +66,7 @@ function LoginPageTabs() { {t(tab.label)} From 7e3c2cf24aad8783d714e5ef6cec706e776ca12f Mon Sep 17 00:00:00 2001 From: Umar Adilov <99314948+adilovcode@users.noreply.github.com> Date: Sat, 3 May 2025 00:45:20 +0500 Subject: [PATCH 3/3] Added unauthorized redirect --- src/middleware.ts | 26 +++++++++++++++++ .../(dashboard)/corporate-dashboard/index.tsx | 24 +++++++++++++--- .../(dashboard)/customer-dashboard/index.tsx | 28 +++++++++++++++---- 3 files changed, 68 insertions(+), 10 deletions(-) create mode 100644 src/middleware.ts diff --git a/src/middleware.ts b/src/middleware.ts new file mode 100644 index 0000000..b92eb5f --- /dev/null +++ b/src/middleware.ts @@ -0,0 +1,26 @@ +import { NextRequest, NextResponse } from 'next/server'; + +export function middleware(req: NextRequest) { + const url = req.nextUrl.clone(); + const path = url.pathname; + + if ( + path.startsWith('/customer-dashboard') || + path.startsWith('/corporate-dashboard') + ) { + const token = req.cookies.get( + `${path.includes('customer') ? 'bonus' : 'corporate'}__token`, + ); + + if (!token) { + url.pathname = '/login'; + return NextResponse.redirect(url); + } + } + + return NextResponse.next(); +} + +export const config = { + matcher: ['/customer-dashboard/:path*', '/corporate-dashboard/:path*'], +}; diff --git a/src/pages-templates/(dashboard)/corporate-dashboard/index.tsx b/src/pages-templates/(dashboard)/corporate-dashboard/index.tsx index 2353347..062b643 100644 --- a/src/pages-templates/(dashboard)/corporate-dashboard/index.tsx +++ b/src/pages-templates/(dashboard)/corporate-dashboard/index.tsx @@ -1,5 +1,6 @@ 'use client'; +import { deleteCookie } from 'cookies-next'; import { subMonths } from 'date-fns'; import { Building2, LogOut, Wallet } from 'lucide-react'; import { useState } from 'react'; @@ -104,9 +105,16 @@ export function CorporateDashboard() {
    -
    +

    {t('corporate.pageTitle')}

    - @@ -114,7 +122,11 @@ export function CorporateDashboard() {
    {/* Company Card */} - + @@ -178,7 +190,11 @@ export function CorporateDashboard() { {/* Fund Card */} - + diff --git a/src/pages-templates/(dashboard)/customer-dashboard/index.tsx b/src/pages-templates/(dashboard)/customer-dashboard/index.tsx index 9c4f8dd..ea7d221 100644 --- a/src/pages-templates/(dashboard)/customer-dashboard/index.tsx +++ b/src/pages-templates/(dashboard)/customer-dashboard/index.tsx @@ -1,9 +1,11 @@ 'use client'; +import { deleteCookie } from 'cookies-next'; import { ArrowUpRight, Clock, CreditCard, LogOut, User } from 'lucide-react'; import { useFetchMyBonusInfoQuery } from '@/entities/bonus/api/bonus.api'; +import Loader from '@/shared/components/loader'; import { useTextController } from '@/shared/language/hooks/use-text-controller'; import { Button } from '@/shared/shadcn-ui/button'; import { @@ -15,7 +17,6 @@ import { } from '@/shared/shadcn-ui/card'; import { TransactionsTable } from '@/widgets/transactions-table'; -import Loader from '@/shared/components/loader'; export function CustomerDashboard() { const { t } = useTextController(); @@ -28,16 +29,27 @@ export function CustomerDashboard() {

    {t('customer.pageTitle')}

    -
    - + {!data || isLoading ? ( - + ) : ( <> @@ -73,7 +85,11 @@ export function CustomerDashboard() { {/* Bonus Card */} {/* Customer Card */} - + @@ -82,7 +98,7 @@ export function CustomerDashboard() { {!data || isLoading ? ( - + ) : (