From 99114120b98757bde69694044db342aa1387fdc1 Mon Sep 17 00:00:00 2001 From: inmake Date: Thu, 16 Apr 2026 13:15:17 +0500 Subject: [PATCH] Refactor App component structure by removing LanguageSwitcher and integrating Header. Update LanguageSwitchButton for improved localization handling. Clean up Feedback and LeadForm components by removing unused code. Enhance AvailableDemos with better translation support and adjust layout for mobile responsiveness. --- src/App.tsx | 7 +- src/components/Layout/Feedback.tsx | 5 -- src/components/Layout/Footer.tsx | 14 ++-- .../Layout/LanguageSwitchButton.tsx | 17 +++-- src/components/Layout/LanguageSwitcher.tsx | 39 ----------- src/features/lead-form/LeadForm.tsx | 5 -- src/features/stream-demo/AvailableDemos.tsx | 64 ++----------------- 7 files changed, 22 insertions(+), 129 deletions(-) delete mode 100644 src/components/Layout/LanguageSwitcher.tsx diff --git a/src/App.tsx b/src/App.tsx index 9151fe9..8179f00 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,18 +1,13 @@ import { Footer } from "@/components/Layout/Footer"; -import { LanguageSwitcher } from "@/components/Layout/LanguageSwitcher"; +import Header from "@/components/Layout/Header"; import { LocaleSync } from "@/components/Layout/LocaleSync"; import StreamDemo from "@/features/stream-demo/StreamDemo"; -import Header from "@/components/Layout/Header"; export default function App() { return (
-<<<<<<< HEAD - -=======
->>>>>>> 258568050cbcb3e46cc31416fc9a0ba7a21ac066 {/* Без overflow-clip: иначе flex-1 + clip часто даёт пустой/обрезанный экран */}
diff --git a/src/components/Layout/Feedback.tsx b/src/components/Layout/Feedback.tsx index d9105f0..c6802da 100644 --- a/src/components/Layout/Feedback.tsx +++ b/src/components/Layout/Feedback.tsx @@ -6,11 +6,6 @@ import { useModalStore } from "@/stores/useModalStore"; import FeedbackModal from "@/components/modals/FeedbackFormModal"; import { LeadForm } from "@/features/lead-form/LeadForm"; -<<<<<<< HEAD -======= -const DEFAULT_STREAM_DEMO_PRODUCTS = ["Удаленная демонстрация"] as Product[]; - ->>>>>>> 258568050cbcb3e46cc31416fc9a0ba7a21ac066 export function Feedback() { useAddReferer(); const { t } = useTranslation(); diff --git a/src/components/Layout/Footer.tsx b/src/components/Layout/Footer.tsx index 8b181ab..27a00c4 100644 --- a/src/components/Layout/Footer.tsx +++ b/src/components/Layout/Footer.tsx @@ -92,17 +92,13 @@ export function Footer() { alt={t("footer.skolkovoAlt")} className=" lg:hidden md:size-[6.25vw] size-[13.333vw] max-md:absolute max-md:right-0 max-md:bottom-6" /> + {t("footer.skolkovoAlt")}
-<<<<<<< HEAD ) : null} -======= - Сколково -
->>>>>>> 258568050cbcb3e46cc31416fc9a0ba7a21ac066
("ru"); + const { i18n, t } = useTranslation(); + const current = (i18n.language.startsWith("ru") ? "ru" : "en") as AppLocale; function handleClick() { - return setLocale(locale === "ru" ? "en" : "ru"); + const next: AppLocale = current === "ru" ? "en" : "ru"; + void i18n.changeLanguage(next); + setLangInUrl(next); } return ( ); } diff --git a/src/components/Layout/LanguageSwitcher.tsx b/src/components/Layout/LanguageSwitcher.tsx deleted file mode 100644 index 65175b9..0000000 --- a/src/components/Layout/LanguageSwitcher.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { useTranslation } from "react-i18next"; -import type { AppLocale } from "@/i18n"; -import { setLangInUrl } from "@/lib/urlLang"; - -const LOCALES: AppLocale[] = ["ru", "en"]; - -export function LanguageSwitcher() { - const { i18n, t } = useTranslation(); - const current = (i18n.language.startsWith("ru") ? "ru" : "en") as AppLocale; - - function select(lang: AppLocale) { - if (lang === current) return; - void i18n.changeLanguage(lang); - setLangInUrl(lang); - } - - return ( -
- {LOCALES.map((lang) => ( - - ))} -
- ); -} diff --git a/src/features/lead-form/LeadForm.tsx b/src/features/lead-form/LeadForm.tsx index a742f94..9600f5d 100644 --- a/src/features/lead-form/LeadForm.tsx +++ b/src/features/lead-form/LeadForm.tsx @@ -17,11 +17,6 @@ import type { LeadFormValues } from "./types"; export type { LeadFormValues } from "./types"; -<<<<<<< HEAD -======= -const GENERIC_SUBMIT_ERROR = "Не удалось отправить заявку. Попробуйте позже."; - ->>>>>>> 258568050cbcb3e46cc31416fc9a0ba7a21ac066 export function LeadForm({ defaultProducts, idPrefix = "", diff --git a/src/features/stream-demo/AvailableDemos.tsx b/src/features/stream-demo/AvailableDemos.tsx index c25d32d..2ee8bfa 100644 --- a/src/features/stream-demo/AvailableDemos.tsx +++ b/src/features/stream-demo/AvailableDemos.tsx @@ -1,31 +1,21 @@ -<<<<<<< HEAD -import { useState } from "react"; +import { useRef, useState, type MouseEvent as ReactMouseEvent } from "react"; import { useTranslation } from "react-i18next"; import BR from "@/components/Layout/LineBreak"; import { REMOTE_DEMO_TAG, useGetProjectsQuery, } from "@/queries/getProjects"; -======= -import { useRef, useState, type MouseEvent as ReactMouseEvent } from "react"; -import { REMOTE_DEMO_TAG, useGetProjectsQuery } from "@/queries/getProjects"; ->>>>>>> 258568050cbcb3e46cc31416fc9a0ba7a21ac066 import { StreamingProject } from "./StreamingProject"; import { useSwipeable } from "react-swipeable"; import { useMediaQueries } from "@/hooks/useMediaQueries"; export default function AvailableDemos() { -<<<<<<< HEAD const { t } = useTranslation(); - const { isMd, isLg } = useMediaQueries(); -======= const { isMd } = useMediaQueries(); ->>>>>>> 258568050cbcb3e46cc31416fc9a0ba7a21ac066 const { data: streamingProjects } = useGetProjectsQuery(REMOTE_DEMO_TAG); const [current, setCurrent] = useState(0); const projects = streamingProjects ?? []; - // Свайп на мобилке const slideCount = Math.min(projects.length + 1, 4); const handlers = useSwipeable({ onSwipedLeft: () => @@ -40,7 +30,6 @@ export default function AvailableDemos() { touchEventOptions: { passive: false }, }); - // Скролл на десктопе const sliderRef = useRef(null); function onSliderMouseDown(e: ReactMouseEvent) { @@ -69,16 +58,11 @@ export default function AvailableDemos() {

-<<<<<<< HEAD {t("demos.titleLine1")}
{t("demos.titleLine2")} -======= - Доступные
демонстрации ->>>>>>> 258568050cbcb3e46cc31416fc9a0ba7a21ac066

- {/* Тиндер на мобилке */}
{projects.slice(0, 3).map((project, index, { length }) => ( @@ -104,56 +88,17 @@ export default function AvailableDemos() { : "" }`} > -<<<<<<< HEAD - {projects.slice(0, 3).map((project, index, { length }) => ( - - ))} -
-
- -=======

- Расскажем и покажем как это работает на созвоне + {t("demos.ctaTitle")}

- Оставить заявку + {t("demos.ctaButton")} ->>>>>>> 258568050cbcb3e46cc31416fc9a0ba7a21ac066
@@ -164,7 +109,6 @@ export default function AvailableDemos() {

- {/* Слайдер на десктопе */}