Event page content addition & ScrollToTop integretion

This commit is contained in:
2026-10-19 19:29:56 +02:00
parent 41cf664330
commit ed24c1295e
11 changed files with 351 additions and 130 deletions
+1
View File
@@ -26,3 +26,4 @@ dist-ssr
# Media files
*.webp
*.mp4
*.jpg
+34 -7
View File
@@ -13,6 +13,7 @@
"framer-motion": "^12.34.3",
"gsap": "^3.14.2",
"lenis": "^1.3.17",
"motion": "^12.35.0",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"react-router-dom": "^7.13.1",
@@ -2752,12 +2753,12 @@
}
},
"node_modules/framer-motion": {
"version": "12.34.3",
"resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-12.34.3.tgz",
"integrity": "sha512-v81ecyZKYO/DfpTwHivqkxSUBzvceOpoI+wLfgCgoUIKxlFKEXdg0oR9imxwXumT4SFy8vRk9xzJ5l3/Du/55Q==",
"version": "12.35.0",
"resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-12.35.0.tgz",
"integrity": "sha512-w8hghCMQ4oq10j6aZh3U2yeEQv5K69O/seDI/41PK4HtgkLrcBovUNc0ayBC3UyyU7V1mrY2yLzvYdWJX9pGZQ==",
"license": "MIT",
"dependencies": {
"motion-dom": "^12.34.3",
"motion-dom": "^12.35.0",
"motion-utils": "^12.29.2",
"tslib": "^2.4.0"
},
@@ -3371,10 +3372,36 @@
"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": {
"version": "12.34.3",
"resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-12.34.3.tgz",
"integrity": "sha512-sYgFe+pR9aIM7o4fhs2aXtOI+oqlUd33N9Yoxcgo1Fv7M20sRkHtCmzE/VRNIcq7uNJ+qio+Xubt1FXH3pQ+eQ==",
"version": "12.35.0",
"resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-12.35.0.tgz",
"integrity": "sha512-FFMLEnIejK/zDABn+vqGVAUN4T0+3fw+cVAY8MMT65yR+j5uMuvWdd4npACWhh94OVWQs79CrBBuwOwGRZAQiA==",
"license": "MIT",
"dependencies": {
"motion-utils": "^12.29.2"
+1
View File
@@ -15,6 +15,7 @@
"framer-motion": "^12.34.3",
"gsap": "^3.14.2",
"lenis": "^1.3.17",
"motion": "^12.35.0",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"react-router-dom": "^7.13.1",
+2
View File
@@ -5,10 +5,12 @@ import About from "./pages/About";
import Events from "./pages/Events";
import Historic from "./pages/Historic";
import Privacy from "./pages/Privacy";
import ScrollToTop from "./components/ScrollToTop";
function App() {
return (
<BrowserRouter>
<ScrollToTop />
<Routes>
<Route path="/" element={<MainLayout />}>
<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",
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() {
+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 { createRoot } from 'react-dom/client'
import './index.css'
import App from './App.tsx'
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
createRoot(document.getElementById('root')!).render(
import "./index.css";
import App from "./App.tsx";
createRoot(document.getElementById("root")!).render(
<StrictMode>
<App />
</StrictMode>,
)
);
+115 -108
View File
@@ -492,121 +492,128 @@ export default function Events() {
},
],
},
// // ---------------------------------------------------------
// // 3. MARCHÉ DE NOËL
// // 3. COMMÉMORATIONS
// // ---------------------------------------------------------
// {
// id: "marche-noel",
// title: "Marchés de Noël",
// 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.",
// themeColor: "text-[#dfbe85]",
// history: [
// {
// type: "intro",
// year: "2022",
// title: "Premier marché",
// bg: "bg-white",
// text: "text-[#1a247f]",
// },
// {
// type: "image",
// src: "/evenements/marche-noel-2022-1.webp",
// alt: "Installation du stand",
// },
{
id: "commemorations",
title: "Anniversaire du conflit",
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.",
themeColor: "text-gray-800",
history: [
{
type: "intro",
year: "2023",
title: "",
bg: "bg-gray-800",
text: "text-white",
},
{
type: "image",
src: "/evenements/commemoration/2023commemoration-1.mp4",
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",
// year: "2023",
// title: "Nos bénévoles mobilisés",
// bg: "bg-[#dfbe85]",
// text: "text-white",
// },
// {
// type: "image",
// src: "/evenements/marche-noel-2023-1.webp",
// alt: "Bénévoles au stand",
// },
{
type: "image",
src: "/evenements/commemoration/2025commemoration-3.webp",
alt: "Commemoration début du conflit - 2025",
},
{
type: "image",
src: "/evenements/commemoration/2025commemoration-2.webp",
alt: "Commemoration début du conflit - 2025",
},
// {
// type: "intro",
// year: "2024",
// title: "Succès solidaire",
// bg: "bg-[#1a247f]",
// text: "text-white",
// },
// {
// type: "image",
// src: "/evenements/marche-noel-2024-1.webp",
// alt: "Créations faites main",
// },
// {
// type: "intro",
// year: "2025",
// title: "L'artisanat à l'honneur",
// bg: "bg-[#dfbe85]",
// text: "text-white",
// },
// {
// type: "image",
// src: "/evenements/marche-noel-2025-1.webp",
// alt: "Stand 2025",
// },
// ],
// },
{
type: "intro",
year: "2026",
title: "",
bg: "bg-gray-800",
text: "text-white",
},
{
type: "image",
src: "/evenements/commemoration/2026commemoration-1.webp",
alt: "Commemoration début du conflit - 2026",
},
{
type: "image",
src: "/evenements/commemoration/2026commemoration-1.webp",
alt: "Commemoration début du conflit - 2026",
},
{
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",
// title: "Commémorations",
// 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.",
// themeColor: "text-gray-800",
// history: [
// {
// type: "intro",
// year: "2023",
// title: "1 an de conflit",
// bg: "bg-gray-800",
// text: "text-white",
// },
// {
// type: "image",
// src: "/evenements/commemoration-2023-1.webp",
// alt: "Minute de silence",
// },
// {
// 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",
// },
// ],
// },
{
id: "marche-noel",
title: "Marchés de Noël",
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.",
themeColor: "text-[#dfbe85]",
history: [
{
type: "intro",
year: "2025",
title: "Premier marché de Noël",
bg: "bg-white",
text: "text-[#1a247f]",
},
{
type: "image",
src: "/evenements/marche-noel/2025marche-noel-1.webp",
alt: "Premier marché de Noël de Coeur-UA-PAM en 2025",
},
],
},
// // ---------------------------------------------------------
// // 5. AUTRES ÉVÉNEMENTS
+1 -1
View File
@@ -1,7 +1,7 @@
import { useState } from "react";
import AnimatedContent from "../components/AnimatedContent";
import Stepper, { Step } from "../components/Stepper";
// import FacebookCarousel from "../components/FacebookCarousel";
import FacebookCarousel from "../components/FacebookCarousel";
const StepWithBackground = ({
date,
+20 -7
View File
@@ -1,5 +1,6 @@
import { Link } from "react-router-dom";
import AnimatedContent from "../components/AnimatedContent";
import CountUp from "../components/ContUp";
const Home = () => {
return (
@@ -53,7 +54,7 @@ const Home = () => {
delay={0.2}
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="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">
@@ -136,17 +137,29 @@ const Home = () => {
<div className="grid grid-cols-1 md:grid-cols-3 gap-12 relative z-10">
<div>
<span className="block text-6xl md:text-7xl font-bold text-hover-nav mb-2">
50+
</span>
<CountUp
from={0}
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">
Bénévoles Actifs
</span>
</div>
<div>
<span className="block text-6xl md:text-7xl font-bold text-hover-nav mb-2">
100s
</span>
<CountUp
from={0}
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">
Colis Envoyés
</span>