From d5efe3f6b01804fed03c80691b5672e60f2f6139 Mon Sep 17 00:00:00 2001 From: Abdel LAMRANI Date: Fri, 7 Aug 2026 13:34:22 +0200 Subject: [PATCH 1/3] fix: :bug: review from re7 --- lang/de/front.php | 7 +-- lang/fr/front.php | 2 +- .../ts/front/Components/ControlSection.tsx | 5 ++- .../ts/front/Components/EngagementSection.tsx | 43 ++++++++----------- resources/ts/front/Components/Header.tsx | 10 ++++- .../ts/front/Components/Layout/Footer.tsx | 2 +- resources/ts/front/Components/Layout/Logo.tsx | 2 +- .../Components/Layout/ScrollToTopButton.tsx | 1 - .../front/Components/cookie/CookieNotice.tsx | 6 +-- .../ts/front/Components/cookie/constants.tsx | 2 +- resources/ts/front/Layouts/AppLayout.tsx | 7 +++ 11 files changed, 50 insertions(+), 37 deletions(-) diff --git a/lang/de/front.php b/lang/de/front.php index 1fa142c..5654b44 100644 --- a/lang/de/front.php +++ b/lang/de/front.php @@ -104,9 +104,10 @@ return [ ], 'independentControls' => [ 'title' => 'Unabhängige Kontrollen', - 'text1' => 'Die externen Kontrollen der QUALIMAINE-Aufzuchtprogramme werden von Certipaq gemäß den in den Lastenheften vorgegebenen Kontrollplänen durchgeführt', - 'chargesLabel' => '', - 'chargesUrl' => '/cahiers-des-charges', + 'text1' => 'Die externen Kontrollen der QUALIMAINE-Aufzuchtprogramme werden von Certipaq gemäß den in den', + 'text1_1' => 'vorgegebenen Kontrollplänen durchgeführt', + 'chargesLabel' => 'Lastenheften', + 'chargesUrl' => '/de#aufzuchtstandards', 'text2' => 'Certipaq ist eine gem äß DIN EN ISO/IEC 17065 akkreditierte Zertifizierungsstelle.', 'text3' => 'Weitere Informationen unter', ], diff --git a/lang/fr/front.php b/lang/fr/front.php index d59b0e6..bb23c76 100644 --- a/lang/fr/front.php +++ b/lang/fr/front.php @@ -104,7 +104,7 @@ return [ 'title' => 'Contrôles indépendants', 'text1' => 'Certipaq réalise le contrôle externe des programmes d\'élevage QUALIMAINE selon des plans de contrôle associés aux', 'chargesLabel' => 'cahiers des charges', - 'chargesUrl' => '/cahiers-des-charges', + 'chargesUrl' => '/#normes-delevage', 'text2' => 'Certipaq est un organisme accrédité selon la norme ISO/CEI 17065.', 'text3' => 'Plus d\'informations sur', ], diff --git a/resources/ts/front/Components/ControlSection.tsx b/resources/ts/front/Components/ControlSection.tsx index 641c8ab..529ea2c 100644 --- a/resources/ts/front/Components/ControlSection.tsx +++ b/resources/ts/front/Components/ControlSection.tsx @@ -31,7 +31,10 @@ export default function ControlsSection() { > {useTrans("front.controls.independentControls.chargesLabel")} - . + {useTrans("front.controls.independentControls.text1_1") !== + "front.controls.independentControls.text1_1" + ? ` ${useTrans("front.controls.independentControls.text1_1")}` + : "."}

{useTrans("front.controls.independentControls.text2")} diff --git a/resources/ts/front/Components/EngagementSection.tsx b/resources/ts/front/Components/EngagementSection.tsx index 7903107..154cd19 100644 --- a/resources/ts/front/Components/EngagementSection.tsx +++ b/resources/ts/front/Components/EngagementSection.tsx @@ -14,6 +14,7 @@ import farmersWebp from "&/images/engagements/formation-eleveurs.webp"; import monitoringJpg from "&/images/engagements/surveillance-renforcee.jpg"; import monitoringWebp from "&/images/engagements/surveillance-renforcee.webp"; import { GetTranslation } from "@/lib/utils"; +import useDeviceType from "@/hooks/use-device-type"; const ENGAGEMENTS = [ { @@ -69,31 +70,25 @@ const ENGAGEMENTS = [ }, ]; + export default function EngagementsSection() { const scrollerRef = useRef(null); const cardRefs = useRef<(HTMLDivElement | null)[]>([]); const [activeIndex, setActiveIndex] = useState(0); + const { isMobile } = useDeviceType(); + + const visibleCount = isMobile ? 1 : 3; + const dotsCount = Math.max(ENGAGEMENTS.length - visibleCount + 1, 1); useEffect(() => { const scroller = scrollerRef.current; if (!scroller) return; const handleScroll = () => { - const scrollerCenter = scroller.scrollLeft + scroller.clientWidth / 2; - let closestIndex = 0; - let closestDistance = Infinity; - - cardRefs.current.forEach((card, index) => { - if (!card) return; - const cardCenter = card.offsetLeft + card.offsetWidth / 2; - const distance = Math.abs(cardCenter - scrollerCenter); - if (distance < closestDistance) { - closestDistance = distance; - closestIndex = index; - } - }); - - setActiveIndex(closestIndex); + const maxScroll = scroller.scrollWidth - scroller.clientWidth; + const ratio = maxScroll > 0 ? scroller.scrollLeft / maxScroll : 0; + const index = Math.round(ratio * (dotsCount - 1)); + setActiveIndex(index); }; scroller.addEventListener("scroll", handleScroll, { passive: true }); @@ -101,17 +96,15 @@ export default function EngagementsSection() { return () => { scroller.removeEventListener("scroll", handleScroll); }; - }, []); + }, [dotsCount]); const scrollToIndex = (index: number) => { - const clamped = (index + ENGAGEMENTS.length) % ENGAGEMENTS.length; + const clamped = Math.max(0, Math.min(index, dotsCount - 1)); const card = cardRefs.current[clamped]; const scroller = scrollerRef.current; if (!card || !scroller) return; - const targetLeft = - card.offsetLeft - (scroller.clientWidth - card.offsetWidth) / 2; - scroller.scrollTo({ left: targetLeft, behavior: "smooth" }); + scroller.scrollTo({ left: card.offsetLeft, behavior: "smooth" }); }; return ( @@ -195,15 +188,17 @@ export default function EngagementsSection() {

- {ENGAGEMENTS.map((_, index) => ( + {Array.from({ length: dotsCount }).map((_, index) => (
diff --git a/resources/ts/front/Components/Header.tsx b/resources/ts/front/Components/Header.tsx index 4a75919..9df4280 100644 --- a/resources/ts/front/Components/Header.tsx +++ b/resources/ts/front/Components/Header.tsx @@ -3,8 +3,12 @@ import heroWebp from "&/images/header/header.webp"; import useTrans from "@/hooks/use-translations"; import Navbar from "./Layout/Navbar"; +import { usePage } from "@inertiajs/react"; export default function Header() { + const { props } = usePage() as unknown as { + props: { appEnv: { locale: string, fallbackLocale:string, locales: string[] } }; + }; return (
@@ -39,7 +43,11 @@ export default function Header() {

{useTrans("front.header.cta_label")} diff --git a/resources/ts/front/Components/Layout/Footer.tsx b/resources/ts/front/Components/Layout/Footer.tsx index 35968ae..582c8f2 100644 --- a/resources/ts/front/Components/Layout/Footer.tsx +++ b/resources/ts/front/Components/Layout/Footer.tsx @@ -22,7 +22,7 @@ export default function Footer() { src={footerChickenRight} alt="" aria-hidden="true" - className="pointer-events-none absolute -right-8 top-[75px] z-0 rotate-y-180 opacity-10 hidden w-[220px] lg:block lg:w-[280px]" + className="pointer-events-none absolute -right-8 top-[155px] z-0 rotate-y-180 opacity-10 hidden w-[220px] lg:block lg:w-[280px]" />
diff --git a/resources/ts/front/Components/Layout/Logo.tsx b/resources/ts/front/Components/Layout/Logo.tsx index 4b903b9..c125da7 100644 --- a/resources/ts/front/Components/Layout/Logo.tsx +++ b/resources/ts/front/Components/Layout/Logo.tsx @@ -4,7 +4,7 @@ export default function Logo() { return (
{useTrans("front.logo_alt")} { window.scrollTo({ top: 0, behavior: "smooth" }); }; - if (isMobile || isTablet) return null; return (
( rel="noreferrer" > {str( - GetTranslation("uwil-common::cookie-notice.learn_more"), + GetTranslation("front.pages.privacyPolicy.pageTitle"), ) .ucFirst() .value()} diff --git a/resources/ts/front/Components/cookie/constants.tsx b/resources/ts/front/Components/cookie/constants.tsx index 84159e3..96c3050 100644 --- a/resources/ts/front/Components/cookie/constants.tsx +++ b/resources/ts/front/Components/cookie/constants.tsx @@ -97,7 +97,7 @@ export const mappingBtnSize = { export const positionBannerButton = { aside: { - left: "h-fit left-0 top-1/2 -translate-y-1/2 px-3 py-4 [writing-mode:vertical-rl] rounded-r-lg rounded-l-none", + left: "h-fit left-0 bottom-1 px-3 py-4 [writing-mode:vertical-rl] rounded-r-lg rounded-l-none", right: "h-fit right-0 top-1/2 -translate-y-1/2 px-3 py-4 [writing-mode:vertical-lr] rotate-180 rounded-r-lg rounded-l-none", }, diff --git a/resources/ts/front/Layouts/AppLayout.tsx b/resources/ts/front/Layouts/AppLayout.tsx index cfe38f6..66d755a 100644 --- a/resources/ts/front/Layouts/AppLayout.tsx +++ b/resources/ts/front/Layouts/AppLayout.tsx @@ -7,6 +7,9 @@ import { RecaptchaProvider } from "../Components/cookie/recaptcha/RecaptchaProvi import Footer from "../Components/Layout/Footer"; import ScrollToTopButton from "../Components/Layout/ScrollToTopButton"; import SiteNavbar from "../Components/Layout/SiteNavbar"; +import useDeviceType from "@/hooks/use-device-type"; +import { positionBannerButton } from "../Components/cookie/constants"; + interface AppLayoutProps { children: ReactNode; @@ -17,6 +20,7 @@ const HOME_COMPONENT = "front/Pages/Home"; export default function AppLayout({ children }: AppLayoutProps) { const { component } = usePage(); const isHome = component === HOME_COMPONENT; + const { isMobile } = useDeviceType(); return ( Date: Fri, 7 Aug 2026 13:40:17 +0200 Subject: [PATCH 2/3] fix: :bug: eslint --- .../ts/front/Components/ControlSection.tsx | 7 +++---- .../ts/front/Components/EngagementSection.tsx | 13 ++++++------- resources/ts/front/Components/Header.tsx | 15 ++++++++++----- .../Components/Layout/ScrollToTopButton.tsx | 4 ---- .../front/Components/cookie/CookieNotice.tsx | 4 +--- resources/ts/front/Layouts/AppLayout.tsx | 18 ++++++++++-------- 6 files changed, 30 insertions(+), 31 deletions(-) diff --git a/resources/ts/front/Components/ControlSection.tsx b/resources/ts/front/Components/ControlSection.tsx index 529ea2c..cb65c32 100644 --- a/resources/ts/front/Components/ControlSection.tsx +++ b/resources/ts/front/Components/ControlSection.tsx @@ -5,6 +5,8 @@ import euFlagWebp from "&/images/certifications/logo-eu.webp"; import useTrans from "@/hooks/use-translations"; export default function ControlsSection() { + const text1_1 = useTrans("front.controls.independentControls.text1_1"); + const hasText1_1 = text1_1 !== "front.controls.independentControls.text1_1"; return (
@@ -31,10 +33,7 @@ export default function ControlsSection() { > {useTrans("front.controls.independentControls.chargesLabel")} - {useTrans("front.controls.independentControls.text1_1") !== - "front.controls.independentControls.text1_1" - ? ` ${useTrans("front.controls.independentControls.text1_1")}` - : "."} + {hasText1_1 ? ` ${text1_1}` : "."}

{useTrans("front.controls.independentControls.text2")} diff --git a/resources/ts/front/Components/EngagementSection.tsx b/resources/ts/front/Components/EngagementSection.tsx index 154cd19..c7de3aa 100644 --- a/resources/ts/front/Components/EngagementSection.tsx +++ b/resources/ts/front/Components/EngagementSection.tsx @@ -13,8 +13,8 @@ import farmersJpg from "&/images/engagements/formation-eleveurs.jpg"; import farmersWebp from "&/images/engagements/formation-eleveurs.webp"; import monitoringJpg from "&/images/engagements/surveillance-renforcee.jpg"; import monitoringWebp from "&/images/engagements/surveillance-renforcee.webp"; -import { GetTranslation } from "@/lib/utils"; import useDeviceType from "@/hooks/use-device-type"; +import { GetTranslation } from "@/lib/utils"; const ENGAGEMENTS = [ { @@ -70,7 +70,6 @@ const ENGAGEMENTS = [ }, ]; - export default function EngagementsSection() { const scrollerRef = useRef(null); const cardRefs = useRef<(HTMLDivElement | null)[]>([]); @@ -194,11 +193,11 @@ export default function EngagementsSection() { onClick={() => { scrollToIndex(index); }} - className={`rounded-full transition-all duration-300 ${ - index === activeIndex - ? "h-5 w-5 bg-neutral-400" - : "h-3.5 w-3.5 bg-band" - }`} + className={`rounded-full transition-all duration-300 ${ + index === activeIndex + ? "h-5 w-5 bg-neutral-400" + : "h-3.5 w-3.5 bg-band" + }`} /> ))}

diff --git a/resources/ts/front/Components/Header.tsx b/resources/ts/front/Components/Header.tsx index 9df4280..739da19 100644 --- a/resources/ts/front/Components/Header.tsx +++ b/resources/ts/front/Components/Header.tsx @@ -1,14 +1,17 @@ +import { usePage } from "@inertiajs/react"; + import heroJpg from "&/images/header/header.jpg"; import heroWebp from "&/images/header/header.webp"; import useTrans from "@/hooks/use-translations"; import Navbar from "./Layout/Navbar"; -import { usePage } from "@inertiajs/react"; export default function Header() { - const { props } = usePage() as unknown as { - props: { appEnv: { locale: string, fallbackLocale:string, locales: string[] } }; - }; + const { props } = usePage() as unknown as { + props: { + appEnv: { locale: string; fallbackLocale: string; locales: string[] }; + }; + }; return (
@@ -44,7 +47,9 @@ export default function Header() { { const handleScroll = () => { setVisible(window.scrollY > SHOW_AFTER_PX); diff --git a/resources/ts/front/Components/cookie/CookieNotice.tsx b/resources/ts/front/Components/cookie/CookieNotice.tsx index 44e3bb8..250d364 100644 --- a/resources/ts/front/Components/cookie/CookieNotice.tsx +++ b/resources/ts/front/Components/cookie/CookieNotice.tsx @@ -542,9 +542,7 @@ const CookieNotice = forwardRef( )} rel="noreferrer" > - {str( - GetTranslation("front.pages.privacyPolicy.pageTitle"), - ) + {str(GetTranslation("front.pages.privacyPolicy.pageTitle")) .ucFirst() .value()} diff --git a/resources/ts/front/Layouts/AppLayout.tsx b/resources/ts/front/Layouts/AppLayout.tsx index 66d755a..680169e 100644 --- a/resources/ts/front/Layouts/AppLayout.tsx +++ b/resources/ts/front/Layouts/AppLayout.tsx @@ -1,15 +1,17 @@ import { usePage } from "@inertiajs/react"; import { type ReactNode } from "react"; -import { animations } from "../Components/cookie/constants"; +import useDeviceType from "@/hooks/use-device-type"; + +import { + animations, + positionBannerButton, +} from "../Components/cookie/constants"; import CookieNotice from "../Components/cookie/CookieNotice"; import { RecaptchaProvider } from "../Components/cookie/recaptcha/RecaptchaProvider"; import Footer from "../Components/Layout/Footer"; import ScrollToTopButton from "../Components/Layout/ScrollToTopButton"; import SiteNavbar from "../Components/Layout/SiteNavbar"; -import useDeviceType from "@/hooks/use-device-type"; -import { positionBannerButton } from "../Components/cookie/constants"; - interface AppLayoutProps { children: ReactNode; @@ -20,7 +22,7 @@ const HOME_COMPONENT = "front/Pages/Home"; export default function AppLayout({ children }: AppLayoutProps) { const { component } = usePage(); const isHome = component === HOME_COMPONENT; - const { isMobile } = useDeviceType(); + const { isMobile } = useDeviceType(); return ( Date: Mon, 10 Aug 2026 12:17:56 +0200 Subject: [PATCH 3/3] fix: :bug: remove comments --- resources/ts/front/Components/cookie/CookieNotice.tsx | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/resources/ts/front/Components/cookie/CookieNotice.tsx b/resources/ts/front/Components/cookie/CookieNotice.tsx index 250d364..3d402df 100644 --- a/resources/ts/front/Components/cookie/CookieNotice.tsx +++ b/resources/ts/front/Components/cookie/CookieNotice.tsx @@ -519,17 +519,6 @@ const CookieNotice = forwardRef( texts.modal?.description, )} > - {/*

*/}