Vrai-Prix — l'évaluation du vrai prix des propriétés résidentielles au Québec.
TypeScript 90.2%
JavaScript 3.5%
Python 3.4%
CSS 1.9%
HTML 0.6%
1// Auteur : Simon-Pierre Boucher — contact@spboucher.ai2/**3 * Barre de navigation mobile commune Groupe KA (ka-ui/nav — KA Tabbar v1) :4 * Estimer · À vendre · Marché · Coût · Méthode, accent rouge signature, bilingue.5 * Estimer mène immédiatement à la recherche d'adresse (focus du champ héros) ;6 * À vendre ouvre les propriétés réellement en vente (atelier d'évaluation) ;7 * Coût ouvre l'atelier de la méthode du coût. Le flux « dernières ventes »8 * reste accessible depuis l'accueil (#ventes).9 */10"use client";11import { useEffect, useState } from "react";12import { usePathname } from "next/navigation";13import KaTabbar from "../ka/KaTabbar";14import { useLang } from "./LangContext";1516/** focus du champ d'adresse (réessaie le temps que l'accueil se monte) */17function focusAdresse(tries = 10) {18 const el = document.getElementById("vp-adresse") as HTMLInputElement | null;19 if (el) {20 el.scrollIntoView({ block: "center", behavior: "smooth" });21 el.focus({ preventScroll: true });22 } else if (tries > 0) {23 window.setTimeout(() => focusAdresse(tries - 1), 100);24 }25}2627export default function MobileTabBar() {28 const path = usePathname();29 const { lang } = useLang();30 const fr = lang === "fr";31 const [hash, setHash] = useState("");3233 useEffect(() => {34 const sync = () => setHash(window.location.hash);35 sync();36 window.addEventListener("hashchange", sync);37 return () => window.removeEventListener("hashchange", sync);38 }, [path]);3940 const ventes = path === "/" && hash === "#ventes";41 return (42 <KaTabbar43 tabs={[44 {45 label: fr ? "Estimer" : "Estimate",46 icon: "target",47 to: "/",48 onClick: () => {49 setHash("");50 focusAdresse();51 },52 active: (path === "/" && !ventes) || path.startsWith("/estimation"),53 },54 {55 label: fr ? "À vendre" : "For sale",56 icon: "tag",57 to: "/a-vendre",58 active: path.startsWith("/a-vendre"),59 },60 {61 label: fr ? "Marché" : "Market",62 icon: "trendup",63 to: "/stats",64 active: path.startsWith("/stats") || path.startsWith("/municipalite"),65 },66 {67 label: fr ? "Coût" : "Cost",68 icon: "home",69 to: "/cout",70 active: path.startsWith("/cout"),71 },72 {73 label: fr ? "Méthode" : "Method",74 icon: "book",75 to: "/methodologie",76 active: path.startsWith("/methodologie"),77 },78 ]}79 />80 );81}82