Merge branch 'fix-issu-2' into 'develop'

Fix: 🐛 re7 reviews

See merge request ldc-web/projets/qualimaine!3
This commit is contained in:
Karl M'muller 2026-08-12 09:54:33 +00:00
commit cbffdb7d7d
11 changed files with 53 additions and 52 deletions

View file

@ -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',
],

View file

@ -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',
],

View file

@ -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 (
<section className="relative w-full overflow-hidden px-8 pt-2 pb-4 lg:py-14 md:px-12 lg:px-[60px]">
<div className="mx-auto flex max-w-[1320px] flex-col gap-12">
@ -31,7 +33,7 @@ export default function ControlsSection() {
>
{useTrans("front.controls.independentControls.chargesLabel")}
</a>
.
{hasText1_1 ? ` ${text1_1}` : "."}
</p>
<p className="font-sans text-[18px] leading-normal text-neutral-700">
{useTrans("front.controls.independentControls.text2")}

View file

@ -13,6 +13,7 @@ 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 useDeviceType from "@/hooks/use-device-type";
import { GetTranslation } from "@/lib/utils";
const ENGAGEMENTS = [
@ -73,27 +74,20 @@ export default function EngagementsSection() {
const scrollerRef = useRef<HTMLDivElement>(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 +95,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,14 +187,16 @@ export default function EngagementsSection() {
</div>
<div className="mt-6 flex items-center justify-center gap-2">
{ENGAGEMENTS.map((_, index) => (
{Array.from({ length: dotsCount }).map((_, index) => (
<button
key={index}
onClick={() => {
scrollToIndex(index);
}}
className={`h-3.5 w-3.5 rounded-full transition-colors ${
index === activeIndex ? "bg-neutral-400" : "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"
}`}
/>
))}

View file

@ -1,3 +1,5 @@
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";
@ -5,6 +7,11 @@ import useTrans from "@/hooks/use-translations";
import Navbar from "./Layout/Navbar";
export default function Header() {
const { props } = usePage() as unknown as {
props: {
appEnv: { locale: string; fallbackLocale: string; locales: string[] };
};
};
return (
<section className="relative w-full overflow-hidden px-0 bg-band/10 md:px-0 lg:px-[60px]">
<div className="relative z-10 mx-auto max-w-[1320px] pb-8">
@ -39,7 +46,13 @@ export default function Header() {
</p>
<a
href="/#engagements"
href={
(props.appEnv.locale === props.appEnv.fallbackLocale
? ""
: "/" + props.appEnv.locale) +
"#" +
useTrans("front.engagements.slug")
}
className="mt-7 inline-block rounded-full bg-primary lg:px-8 px-4 py-2 font-sans text-lg lg:text-[20px] font-semibold text-white transition-opacity hover:bg-[#FFD41F] hover:text-black hover:opacity-90"
>
{useTrans("front.header.cta_label")}

View file

@ -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]"
/>
</div>

View file

@ -4,7 +4,7 @@ export default function Logo() {
return (
<div className="w-fit h-fit">
<img
className="size-12 object-fit"
className="w-20 h-14 object-fit"
src={logo}
alt={useTrans("front.logo_alt")}
title={useTrans("front.logo_title")}

View file

@ -1,14 +1,10 @@
import { ChevronsUp } from "lucide-react";
import { useEffect, useState } from "react";
import useDeviceType from "@/hooks/use-device-type";
const SHOW_AFTER_PX = 400;
export default function ScrollToTopButton() {
const [visible, setVisible] = useState(false);
const { isMobile, isTablet } = useDeviceType();
useEffect(() => {
const handleScroll = () => {
setVisible(window.scrollY > SHOW_AFTER_PX);
@ -24,7 +20,6 @@ export default function ScrollToTopButton() {
const scrollToTop = () => {
window.scrollTo({ top: 0, behavior: "smooth" });
};
if (isMobile || isTablet) return null;
return (
<button

View file

@ -519,17 +519,6 @@ const CookieNotice = forwardRef<HTMLDivElement, CookieNoticeProps>(
texts.modal?.description,
)}
>
<p
dangerouslySetInnerHTML={{
__html: str(
GetTranslation(
"uwil-common::cookie-notice.consent_all_text",
),
)
.ucFirst()
.value(),
}}
/>
</div>
<a
@ -542,9 +531,7 @@ const CookieNotice = forwardRef<HTMLDivElement, CookieNoticeProps>(
)}
rel="noreferrer"
>
{str(
GetTranslation("uwil-common::cookie-notice.learn_more"),
)
{str(GetTranslation("front.pages.privacyPolicy.pageTitle"))
.ucFirst()
.value()}
</a>

View file

@ -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",
},

View file

@ -1,7 +1,12 @@
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";
@ -17,6 +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();
return (
<RecaptchaProvider>
<CookieNotice
@ -24,6 +30,9 @@ export default function AppLayout({ children }: AppLayoutProps) {
animationButton={animations.SCALE}
animationBanner={animations.SCALE}
hasLogo
bannerButtonPosition={
isMobile ? positionBannerButton.aside.left : undefined
}
learnMoreHref={route("front.privacy-policy")}
variants={{
btnActionVariant: "default",