Repository Public
1/**2 * =============================================================================3 * SP BOUCHER | SOFTWARE & RESEARCH4 * ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project : UQO Éval — Le Grand Défi Immobilier8 * File : apps/web/src/components/Door.tsx9 * Module : components10 * Repository : https://git.spboucher.ai/uqo-eval-jeux11 * Project Website : https://jeux.uqo-eval.app12 * Created : 2026-11-2513 * Last Modified : 2026-11-2514 *15 * Author : Simon-Pierre Boucher16 * Position : Professor of Finance17 * Institution : Université du Québec en Outaouais (UQO)18 * Organization : SP Boucher19 * Website : https://spboucher.ai20 * Git : https://git.spboucher.ai21 *22 * Preferred Contact: contact@spboucher.ai23 * Development : dev@spboucher.ai24 * Support : support@spboucher.ai25 * Security/Admin : admin@spboucher.ai26 *27 * Copyright (c) 202628 * Simon-Pierre Boucher29 * All rights reserved where applicable. This file is governed by the30 * applicable project license, copyright notices and relevant law.31 * Existing third-party rights and notices remain unaffected.32 *33 * License : None specified (no license file in this repository)34 *35 * Do not embed credentials, private keys, access tokens,36 * certificates or confidential personal information.37 *38 * =============================================================================39 * END OF SP BOUCHER SOURCE HEADER40 * =============================================================================41 */4243import { motion } from "motion/react";44import { useEffect } from "react";45import { prefersReducedMotion } from "../lib/store";4647/**48 * Transition entre deux propriétés : deux vantaux se referment sur la49 * propriété précédente, la plaque affiche le numéro suivant, puis la porte50 * s'ouvre. `onClosed` signale le moment où l'on peut changer de propriété51 * derrière la porte ; `onDone` la fin de la séquence.52 */53export function Door({ number, total, phaseName, onClosed, onDone }: { number: number; total: number; phaseName: string; onClosed: () => void; onDone: () => void }) {54 const reduced = prefersReducedMotion();55 useEffect(() => {56 const closeAt = reduced ? 120 : 430;57 const doneAt = reduced ? 320 : 1250;58 const a = window.setTimeout(onClosed, closeAt);59 const b = window.setTimeout(onDone, doneAt);60 return () => {61 window.clearTimeout(a);62 window.clearTimeout(b);63 };64 // eslint-disable-next-line react-hooks/exhaustive-deps65 }, []);6667 if (reduced) {68 return <motion.div className="door-fade" initial={{ opacity: 0 }} animate={{ opacity: [0, 1, 1, 0] }} transition={{ duration: 0.32, times: [0, 0.35, 0.65, 1] }} aria-hidden="true" />;69 }70 const leaf = { duration: 1.25, times: [0, 0.34, 0.6, 1], ease: [0.65, 0, 0.35, 1] as [number, number, number, number] };71 return (72 <div className="door" aria-hidden="true">73 <motion.div className="door-leaf left" initial={{ x: "-101%" }} animate={{ x: ["-101%", "0%", "0%", "-101%"] }} transition={leaf}>74 <span className="door-panel" /><span className="door-panel" />75 </motion.div>76 <motion.div className="door-leaf right" initial={{ x: "101%" }} animate={{ x: ["101%", "0%", "0%", "101%"] }} transition={leaf}>77 <span className="door-panel" /><span className="door-panel" /><span className="door-knob" />78 </motion.div>79 <motion.div className="door-plate" initial={{ opacity: 0, scale: 0.86 }} animate={{ opacity: [0, 0, 1, 1, 0], scale: [0.86, 0.86, 1, 1, 1.08] }} transition={{ duration: 1.25, times: [0, 0.28, 0.42, 0.62, 0.78] }}>80 <span className="eyebrow">{phaseName}</span>81 <span className="num door-number">{number}</span>82 <span className="small">sur {total}</span>83 </motion.div>84 </div>85 );86}87