Event page content addition & ScrollToTop integretion

This commit is contained in:
2026-03-22 19:41:19 +01:00
parent 4a0b169878
commit 7d50f0c939
11 changed files with 351 additions and 130 deletions
+2 -1
View File
@@ -25,4 +25,5 @@ dist-ssr
# Media files # Media files
*.webp *.webp
*.mp4 *.mp4
*.jpg
+34 -7
View File
@@ -13,6 +13,7 @@
"framer-motion": "^12.34.3", "framer-motion": "^12.34.3",
"gsap": "^3.14.2", "gsap": "^3.14.2",
"lenis": "^1.3.17", "lenis": "^1.3.17",
"motion": "^12.35.0",
"react": "^19.2.0", "react": "^19.2.0",
"react-dom": "^19.2.0", "react-dom": "^19.2.0",
"react-router-dom": "^7.13.1", "react-router-dom": "^7.13.1",
@@ -2752,12 +2753,12 @@
} }
}, },
"node_modules/framer-motion": { "node_modules/framer-motion": {
"version": "12.34.3", "version": "12.35.0",
"resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-12.34.3.tgz", "resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-12.35.0.tgz",
"integrity": "sha512-v81ecyZKYO/DfpTwHivqkxSUBzvceOpoI+wLfgCgoUIKxlFKEXdg0oR9imxwXumT4SFy8vRk9xzJ5l3/Du/55Q==", "integrity": "sha512-w8hghCMQ4oq10j6aZh3U2yeEQv5K69O/seDI/41PK4HtgkLrcBovUNc0ayBC3UyyU7V1mrY2yLzvYdWJX9pGZQ==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"motion-dom": "^12.34.3", "motion-dom": "^12.35.0",
"motion-utils": "^12.29.2", "motion-utils": "^12.29.2",
"tslib": "^2.4.0" "tslib": "^2.4.0"
}, },
@@ -3371,10 +3372,36 @@
"node": "*" "node": "*"
} }
}, },
"node_modules/motion": {
"version": "12.35.0",
"resolved": "https://registry.npmjs.org/motion/-/motion-12.35.0.tgz",
"integrity": "sha512-BQUhNUIGvUcwXCzwmnT1JpjUqab34lIwxHnXUyWRht1WC1vAyp7/4qgMiUXxN3K6hgUhyoR+HNnLeQMwUZjVjw==",
"license": "MIT",
"dependencies": {
"framer-motion": "^12.35.0",
"tslib": "^2.4.0"
},
"peerDependencies": {
"@emotion/is-prop-valid": "*",
"react": "^18.0.0 || ^19.0.0",
"react-dom": "^18.0.0 || ^19.0.0"
},
"peerDependenciesMeta": {
"@emotion/is-prop-valid": {
"optional": true
},
"react": {
"optional": true
},
"react-dom": {
"optional": true
}
}
},
"node_modules/motion-dom": { "node_modules/motion-dom": {
"version": "12.34.3", "version": "12.35.0",
"resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-12.34.3.tgz", "resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-12.35.0.tgz",
"integrity": "sha512-sYgFe+pR9aIM7o4fhs2aXtOI+oqlUd33N9Yoxcgo1Fv7M20sRkHtCmzE/VRNIcq7uNJ+qio+Xubt1FXH3pQ+eQ==", "integrity": "sha512-FFMLEnIejK/zDABn+vqGVAUN4T0+3fw+cVAY8MMT65yR+j5uMuvWdd4npACWhh94OVWQs79CrBBuwOwGRZAQiA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"motion-utils": "^12.29.2" "motion-utils": "^12.29.2"
+1
View File
@@ -15,6 +15,7 @@
"framer-motion": "^12.34.3", "framer-motion": "^12.34.3",
"gsap": "^3.14.2", "gsap": "^3.14.2",
"lenis": "^1.3.17", "lenis": "^1.3.17",
"motion": "^12.35.0",
"react": "^19.2.0", "react": "^19.2.0",
"react-dom": "^19.2.0", "react-dom": "^19.2.0",
"react-router-dom": "^7.13.1", "react-router-dom": "^7.13.1",
+2
View File
@@ -5,10 +5,12 @@ import About from "./pages/About";
import Events from "./pages/Events"; import Events from "./pages/Events";
import Historic from "./pages/Historic"; import Historic from "./pages/Historic";
import Privacy from "./pages/Privacy"; import Privacy from "./pages/Privacy";
import ScrollToTop from "./components/ScrollToTop";
function App() { function App() {
return ( return (
<BrowserRouter> <BrowserRouter>
<ScrollToTop />
<Routes> <Routes>
<Route path="/" element={<MainLayout />}> <Route path="/" element={<MainLayout />}>
<Route path="/" element={<Home />} /> <Route path="/" element={<Home />} />
+130
View File
@@ -0,0 +1,130 @@
import { useInView, useMotionValue, useSpring } from "motion/react";
import { useCallback, useEffect, useRef } from "react";
interface CountUpProps {
to: number;
from?: number;
direction?: "up" | "down";
delay?: number;
duration?: number;
className?: string;
startWhen?: boolean;
separator?: string;
onStart?: () => void;
onEnd?: () => void;
}
export default function CountUp({
to,
from = 0,
direction = "up",
delay = 0,
duration = 2,
className = "",
startWhen = true,
separator = "",
onStart,
onEnd,
}: CountUpProps) {
const ref = useRef<HTMLSpanElement>(null);
const motionValue = useMotionValue(direction === "down" ? to : from);
const damping = 20 + 40 * (1 / duration);
const stiffness = 100 * (1 / duration);
const springValue = useSpring(motionValue, {
damping,
stiffness,
});
const isInView = useInView(ref, { once: true, margin: "0px" });
const getDecimalPlaces = (num: number): number => {
const str = num.toString();
if (str.includes(".")) {
const decimals = str.split(".")[1];
if (parseInt(decimals) !== 0) {
return decimals.length;
}
}
return 0;
};
const maxDecimals = Math.max(getDecimalPlaces(from), getDecimalPlaces(to));
const formatValue = useCallback(
(latest: number) => {
const hasDecimals = maxDecimals > 0;
const options: Intl.NumberFormatOptions = {
useGrouping: !!separator,
minimumFractionDigits: hasDecimals ? maxDecimals : 0,
maximumFractionDigits: hasDecimals ? maxDecimals : 0,
};
const formattedNumber = Intl.NumberFormat("en-US", options).format(
latest,
);
return separator
? formattedNumber.replace(/,/g, separator)
: formattedNumber;
},
[maxDecimals, separator],
);
useEffect(() => {
if (ref.current) {
ref.current.textContent = formatValue(direction === "down" ? to : from);
}
}, [from, to, direction, formatValue]);
useEffect(() => {
if (isInView && startWhen) {
if (typeof onStart === "function") {
onStart();
}
const timeoutId = setTimeout(() => {
motionValue.set(direction === "down" ? from : to);
}, delay * 1000);
const durationTimeoutId = setTimeout(
() => {
if (typeof onEnd === "function") {
onEnd();
}
},
delay * 1000 + duration * 1000,
);
return () => {
clearTimeout(timeoutId);
clearTimeout(durationTimeoutId);
};
}
}, [
isInView,
startWhen,
motionValue,
direction,
from,
to,
delay,
onStart,
onEnd,
duration,
]);
useEffect(() => {
const unsubscribe = springValue.on("change", (latest: number) => {
if (ref.current) {
ref.current.textContent = formatValue(latest);
}
});
return () => unsubscribe();
}, [springValue, formatValue]);
return <span className={className} ref={ref} />;
}
+24
View File
@@ -36,6 +36,30 @@ const mockPosts: FacebookPost[] = [
imageSrc: "/historique/dernier-evenement.webp", imageSrc: "/historique/dernier-evenement.webp",
link: "https://www.facebook.com", link: "https://www.facebook.com",
}, },
{
id: 4,
date: "Il y a 3 semaines",
content:
"Réunion très productive avec la mairie pour préparer l'année à venir. De beaux projets en perspective ! 🏛️🤝",
imageSrc: "/historique/signature-statuts.webp",
link: "https://www.facebook.com",
},
{
id: 5,
date: "Il y a 1 mois",
content:
"Collecte de vêtements chauds terminée. Merci à tous les donateurs, le camion part demain ! 🚛❄️",
imageSrc: "/historique/arrivee.webp",
link: "https://www.facebook.com",
},
{
id: 6,
date: "Il y a 1 mois",
content:
"Petit souvenir de notre stand au forum des associations. On a hâte de vous retrouver ! 👋",
imageSrc: "/hero-section/a-propos.webp",
link: "https://www.facebook.com",
},
]; ];
export default function FacebookCarousel() { export default function FacebookCarousel() {
+15
View File
@@ -0,0 +1,15 @@
// c:\Users\thwei\source\Applications\CoeurUAPam\src\components\ScrollToTop.tsx
import { useEffect } from "react";
import { useLocation } from "react-router-dom";
const ScrollToTop = () => {
const { pathname } = useLocation();
useEffect(() => {
window.scrollTo(0, 0);
}, [pathname]);
return null;
};
export default ScrollToTop;
+7 -6
View File
@@ -1,10 +1,11 @@
import { StrictMode } from 'react' import { StrictMode } from "react";
import { createRoot } from 'react-dom/client' import { createRoot } from "react-dom/client";
import './index.css'
import App from './App.tsx'
createRoot(document.getElementById('root')!).render( import "./index.css";
import App from "./App.tsx";
createRoot(document.getElementById("root")!).render(
<StrictMode> <StrictMode>
<App /> <App />
</StrictMode>, </StrictMode>,
) );
+115 -108
View File
@@ -492,121 +492,128 @@ export default function Events() {
}, },
], ],
}, },
// // --------------------------------------------------------- // // ---------------------------------------------------------
// // 3. MARCHÉ DE NOËL // // 3. COMMÉMORATIONS
// // --------------------------------------------------------- // // ---------------------------------------------------------
// { {
// id: "marche-noel", id: "commemorations",
// title: "Marchés de Noël", title: "Anniversaire du conflit",
// description: description:
// "Retrouvez-nous sur nos stands lors des marchés de Noël locaux pour découvrir l'artisanat ukrainien, parfait pour des cadeaux originaux et solidaires.", "Le devoir de mémoire est essentiel. Nous nous rassemblons pour honorer les victimes du conflit et rappeler notre soutien indéfectible à l'Ukraine.",
// themeColor: "text-[#dfbe85]", themeColor: "text-gray-800",
// history: [ history: [
// { {
// type: "intro", type: "intro",
// year: "2022", year: "2023",
// title: "Premier marché", title: "",
// bg: "bg-white", bg: "bg-gray-800",
// text: "text-[#1a247f]", text: "text-white",
// }, },
// { {
// type: "image", type: "image",
// src: "/evenements/marche-noel-2022-1.webp", src: "/evenements/commemoration/2023commemoration-1.mp4",
// alt: "Installation du stand", alt: "Commemoration début du conflit - 2023",
// }, },
{
type: "intro",
year: "2024",
title: "2 ans de résilience",
bg: "bg-gray-200",
text: "text-gray-900",
},
{
type: "image",
src: "/evenements/commemoration/2024commemoration-1.webp",
alt: "Rassemblement sur la place",
},
{
type: "intro",
year: "2025",
title: "",
bg: "bg-gray-800",
text: "text-white",
},
{
type: "image",
src: "/evenements/commemoration/2025commemoration-1.webp",
alt: "Commemoration début du conflit - 2025",
},
{
type: "image",
src: "/evenements/commemoration/2025commemoration-4.webp",
alt: "Commemoration début du conflit - 2025",
},
// { {
// type: "intro", type: "image",
// year: "2023", src: "/evenements/commemoration/2025commemoration-3.webp",
// title: "Nos bénévoles mobilisés", alt: "Commemoration début du conflit - 2025",
// bg: "bg-[#dfbe85]", },
// text: "text-white", {
// }, type: "image",
// { src: "/evenements/commemoration/2025commemoration-2.webp",
// type: "image", alt: "Commemoration début du conflit - 2025",
// src: "/evenements/marche-noel-2023-1.webp", },
// alt: "Bénévoles au stand",
// },
// { {
// type: "intro", type: "intro",
// year: "2024", year: "2026",
// title: "Succès solidaire", title: "",
// bg: "bg-[#1a247f]", bg: "bg-gray-800",
// text: "text-white", text: "text-white",
// }, },
// { {
// type: "image", type: "image",
// src: "/evenements/marche-noel-2024-1.webp", src: "/evenements/commemoration/2026commemoration-1.webp",
// alt: "Créations faites main", alt: "Commemoration début du conflit - 2026",
// }, },
{
// { type: "image",
// type: "intro", src: "/evenements/commemoration/2026commemoration-1.webp",
// year: "2025", alt: "Commemoration début du conflit - 2026",
// title: "L'artisanat à l'honneur", },
// bg: "bg-[#dfbe85]",
// text: "text-white",
// },
// {
// type: "image",
// src: "/evenements/marche-noel-2025-1.webp",
// alt: "Stand 2025",
// },
// ],
// },
{
type: "image",
src: "/evenements/commemoration/2026commemoration-3.webp",
alt: "Commemoration début du conflit - 2026",
},
{
type: "image",
src: "/evenements/commemoration/2026commemoration-4.webp",
alt: "Commemoration début du conflit - 2026",
},
{
type: "image",
src: "/evenements/commemoration/2026commemoration-2.webp",
alt: "Commemoration début du conflit - 2026",
},
],
},
// // --------------------------------------------------------- // // ---------------------------------------------------------
// // 4. COMMÉMORATIONS // // 4. MARCHÉ DE NOËL
// // --------------------------------------------------------- // // ---------------------------------------------------------
// { {
// id: "commemorations", id: "marche-noel",
// title: "Commémorations", title: "Marchés de Noël",
// description: description:
// "Le devoir de mémoire est essentiel. Nous nous rassemblons pour honorer les victimes du conflit et rappeler notre soutien indéfectible à l'Ukraine.", "Retrouvez-nous sur nos stands lors des marchés de Noël locaux pour découvrir l'artisanat ukrainien, parfait pour des cadeaux originaux et solidaires.",
// themeColor: "text-gray-800", themeColor: "text-[#dfbe85]",
// history: [ history: [
// { {
// type: "intro", type: "intro",
// year: "2023", year: "2025",
// title: "1 an de conflit", title: "Premier marché de Noël",
// bg: "bg-gray-800", bg: "bg-white",
// text: "text-white", text: "text-[#1a247f]",
// }, },
// { {
// type: "image", type: "image",
// src: "/evenements/commemoration-2023-1.webp", src: "/evenements/marche-noel/2025marche-noel-1.webp",
// alt: "Minute de silence", alt: "Premier marché de Noël de Coeur-UA-PAM en 2025",
// }, },
],
// { },
// type: "intro",
// year: "2024",
// title: "2 ans de résilience",
// bg: "bg-gray-200",
// text: "text-gray-900",
// },
// {
// type: "image",
// src: "/evenements/commemoration-2024-1.webp",
// alt: "Rassemblement sur la place",
// },
// {
// type: "intro",
// year: "2025",
// title: "Ne jamais oublier",
// bg: "bg-gray-800",
// text: "text-white",
// },
// {
// type: "image",
// src: "/evenements/commemoration-2025-1.webp",
// alt: "Commémoration 2025",
// },
// ],
// },
// // --------------------------------------------------------- // // ---------------------------------------------------------
// // 5. AUTRES ÉVÉNEMENTS // // 5. AUTRES ÉVÉNEMENTS
+1 -1
View File
@@ -1,7 +1,7 @@
import { useState } from "react"; import { useState } from "react";
import AnimatedContent from "../components/AnimatedContent"; import AnimatedContent from "../components/AnimatedContent";
import Stepper, { Step } from "../components/Stepper"; import Stepper, { Step } from "../components/Stepper";
// import FacebookCarousel from "../components/FacebookCarousel"; import FacebookCarousel from "../components/FacebookCarousel";
const StepWithBackground = ({ const StepWithBackground = ({
date, date,
+20 -7
View File
@@ -1,5 +1,6 @@
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import AnimatedContent from "../components/AnimatedContent"; import AnimatedContent from "../components/AnimatedContent";
import CountUp from "../components/ContUp";
const Home = () => { const Home = () => {
return ( return (
@@ -53,7 +54,7 @@ const Home = () => {
delay={0.2} delay={0.2}
className="h-full" className="h-full"
> >
<Link to="/historique" className="block h-full group"> <Link to="/notre-histoire" className="block h-full group">
<div className="relative h-full min-h-100 bg-bg-2 p-10 flex flex-col justify-between overflow-hidden transition-all hover:shadow-xl hover:-translate-y-1"> <div className="relative h-full min-h-100 bg-bg-2 p-10 flex flex-col justify-between overflow-hidden transition-all hover:shadow-xl hover:-translate-y-1">
<div className="z-10"> <div className="z-10">
<span className="inline-block px-4 py-1 rounded-full border border-heading text-heading text-xs font-bold uppercase tracking-widest mb-4"> <span className="inline-block px-4 py-1 rounded-full border border-heading text-heading text-xs font-bold uppercase tracking-widest mb-4">
@@ -136,17 +137,29 @@ const Home = () => {
<div className="grid grid-cols-1 md:grid-cols-3 gap-12 relative z-10"> <div className="grid grid-cols-1 md:grid-cols-3 gap-12 relative z-10">
<div> <div>
<span className="block text-6xl md:text-7xl font-bold text-hover-nav mb-2"> <CountUp
50+ from={0}
</span> to={19}
delay={0.5}
separator=","
direction="up"
duration={1.5}
className="count-up-text block text-6xl md:text-7xl font-bold text-hover-nav mb-2"
/>
<span className="text-lg uppercase tracking-widest opacity-80"> <span className="text-lg uppercase tracking-widest opacity-80">
Bénévoles Actifs Bénévoles Actifs
</span> </span>
</div> </div>
<div> <div>
<span className="block text-6xl md:text-7xl font-bold text-hover-nav mb-2"> <CountUp
100s from={0}
</span> to={12}
delay={0.5}
separator="."
direction="up"
duration={1}
className="count-up-text block text-6xl md:text-7xl font-bold text-hover-nav mb-2"
/>
<span className="text-lg uppercase tracking-widest opacity-80"> <span className="text-lg uppercase tracking-widest opacity-80">
Colis Envoyés Colis Envoyés
</span> </span>