From 83451cf358e53b215778c3ced286b15bb99fda95 Mon Sep 17 00:00:00 2001 From: Umar Adilov <99314948+adilovcode@users.noreply.github.com> Date: Wed, 30 Apr 2025 17:00:52 +0500 Subject: [PATCH] integrated text control provider --- package.json | 1 + pnpm-lock.yaml | 16 + src/app/layout.tsx | 15 +- .../auth/login-form/ui/login-form.tsx | 4 +- src/features/map/ui/gas-station-map.tsx | 4 +- .../(dashboard)/corporate-dashboard/index.tsx | 39 +- .../(dashboard)/customer-dashboard/index.tsx | 27 +- src/pages-templates/about/index.tsx | 14 +- src/pages-templates/charity/index.tsx | 175 +++++---- .../clients/certificates/index.tsx | 4 +- src/pages-templates/clients/index.tsx | 8 +- src/pages-templates/clients/loyalty/index.tsx | 4 +- src/pages-templates/login/index.tsx | 4 +- src/shared/components/about-counter.tsx | 11 +- src/shared/components/promotion-slider.tsx | 14 +- src/shared/components/submit-button.tsx | 5 +- src/shared/language/api/text-control.api.ts | 12 + .../language/context/language-provider.tsx | 73 ---- .../context/text-control-provider.tsx | 49 +++ ...use-language.ts => use-text-controller.ts} | 6 +- src/shared/language/index.ts | 8 +- src/shared/language/locales/en.json | 108 ------ src/shared/language/locales/ru.json | 344 ------------------ src/shared/language/ui/language-switcher.tsx | 44 --- src/shared/providers/providers.tsx | 10 +- src/shared/store/index.ts | 19 +- src/shared/types/text.types.ts | 4 + src/widgets/about-page/company-timeline.tsx | 10 +- src/widgets/about-page/station-gallery.tsx | 4 +- src/widgets/about-section.tsx | 6 +- src/widgets/charity-section.tsx | 4 +- src/widgets/clients/ui/benefits-section.tsx | 8 +- .../clients/ui/services-overview-section.tsx | 7 +- src/widgets/cta-section.tsx | 4 +- src/widgets/footer.tsx | 6 +- src/widgets/header/ui/desktop-nav.tsx | 11 +- src/widgets/header/ui/index.tsx | 4 +- src/widgets/header/ui/mobile-nav.tsx | 24 +- src/widgets/hero-section.tsx | 4 +- src/widgets/map-section.tsx | 4 +- src/widgets/partners-section.tsx | 4 +- src/widgets/promotions-section.tsx | 6 +- src/widgets/stats-section.tsx | 12 +- src/widgets/transactions-table.tsx | 44 ++- src/widgets/vacancies-section.tsx | 14 +- 45 files changed, 384 insertions(+), 814 deletions(-) create mode 100644 src/shared/language/api/text-control.api.ts delete mode 100644 src/shared/language/context/language-provider.tsx create mode 100644 src/shared/language/context/text-control-provider.tsx rename src/shared/language/hooks/{use-language.ts => use-text-controller.ts} (65%) delete mode 100644 src/shared/language/locales/en.json delete mode 100644 src/shared/language/locales/ru.json delete mode 100644 src/shared/language/ui/language-switcher.tsx create mode 100644 src/shared/types/text.types.ts diff --git a/package.json b/package.json index 2c17b8a..a04c324 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "lodash": "^4.17.21", "lucide-react": "^0.501.0", "next": "15.3.1", + "next-redux-wrapper": "^8.1.0", "next-themes": "^0.4.6", "react": "^19.0.0", "react-day-picker": "8.10.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 94c0c7a..a54e8a0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -74,6 +74,9 @@ importers: next: specifier: 15.3.1 version: 15.3.1(react-dom@19.1.0(react@19.1.0))(react@19.1.0) + next-redux-wrapper: + specifier: ^8.1.0 + version: 8.1.0(next@15.3.1(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(react-redux@9.2.0(@types/react@19.1.2)(react@19.1.0)(redux@5.0.1))(react@19.1.0) next-themes: specifier: ^0.4.6 version: 0.4.6(react-dom@19.1.0(react@19.1.0))(react@19.1.0) @@ -2117,6 +2120,13 @@ packages: natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} + next-redux-wrapper@8.1.0: + resolution: {integrity: sha512-2hIau0hcI6uQszOtrvAFqgc0NkZegKYhBB7ZAKiG3jk7zfuQb4E7OV9jfxViqqojh3SEHdnFfPkN9KErttUKuw==} + peerDependencies: + next: '>=9' + react: '*' + react-redux: '*' + next-themes@0.4.6: resolution: {integrity: sha512-pZvgD5L0IEvX5/9GWyHMf3m8BKiVQwsCMHfoFosXtXBMnaS0ZnIJ9ST4b4NqLVKDEm8QBxoNNGNaBv2JNF6XNA==} peerDependencies: @@ -4720,6 +4730,12 @@ snapshots: natural-compare@1.4.0: {} + next-redux-wrapper@8.1.0(next@15.3.1(react-dom@19.1.0(react@19.1.0))(react@19.1.0))(react-redux@9.2.0(@types/react@19.1.2)(react@19.1.0)(redux@5.0.1))(react@19.1.0): + dependencies: + next: 15.3.1(react-dom@19.1.0(react@19.1.0))(react@19.1.0) + react: 19.1.0 + react-redux: 9.2.0(@types/react@19.1.2)(react@19.1.0)(redux@5.0.1) + next-themes@0.4.6(react-dom@19.1.0(react@19.1.0))(react@19.1.0): dependencies: react: 19.1.0 diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 6fcee9d..7766960 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,7 +1,10 @@ import type { Metadata } from 'next'; import { Inter } from 'next/font/google'; +import { textControlApi } from '@/shared/language/api/text-control.api'; import { Providers } from '@/shared/providers/providers'; +import { makeStore } from '@/shared/store'; +import { TextItem } from '@/shared/types/text.types'; import { Footer } from '@/widgets/footer'; import { Header } from '@/widgets/header/ui'; @@ -16,20 +19,26 @@ export const metadata: Metadata = { 'Качественное топливо, удобное расположение и отличный сервис для наших клиентов', }; -export default function RootLayout({ +export default async function RootLayout({ children, }: Readonly<{ children: React.ReactNode; }>) { + const store = makeStore(); + + const response = await store.dispatch( + textControlApi.endpoints.fetchText.initiate(), + ); + return ( - +
{children}