SPB Git forge

spb/rent-ka

Public
8commits 1branches 0releases
7.4 MBsize
maindefault branch
19 days agolast push
Python 68.8% TypeScript 18.6% CSS 8.7% JavaScript 3.3% HTML 0.6%
1.9 KB · 47 lines tsx
Raw Blame History
1// -----------------------------------------------------------------------------2// Rent-Ka — Rental listings aggregator (Canada, outside Québec)3// Author: Simon-Pierre Boucher — contact@spboucher.ai4// components/HiverScore.tsx: "Winter Score" block (detail page)5//   Can you run your daily errands on foot at −20 °C? Deterministic 0-1006//   score (rentka/hiver.py): grocery, pharmacy, bus, convenience store within7//   walking distance. The methodology owns what is NOT taken into account.8// -----------------------------------------------------------------------------9import { Hiver } from "../api";1011const NBSP = " ";1213const CLS: Record<string, string> = {14  // backend classes (kept bilingual for safety during migration)15  "very practical": "zi-ok", "practical": "zi-ok",16  "demanding": "zi-modere", "difficult": "zi-eleve",17  "très pratique": "zi-ok", "pratique": "zi-ok",18  "exigeant": "zi-modere", "difficile": "zi-eleve",19};2021export default function HiverScore({ h }: { h: Hiver }) {22  return (23    <section className="f-bloc f-hiver" id="hiver">24      <h2>Winter Score</h2>25      <div className="hiver-head">26        <span className="hiver-score">{h.score}</span>27        <span className={`zi-badge ${CLS[h.classe] ?? "zi-nc"}`}>{h.classe}</span>28        <span className="hiver-sur">daily errands on foot, even at −20{NBSP}°C</span>29      </div>30      <ul className="hiver-detail">31        {h.detail.map((c) => (32          <li key={c.critere}>33            <span className="hd-crit">{c.critere}</span>34            <span className="hd-val">35              {c.distance_m != null36                ? `≈${NBSP}${c.minutes}${NBSP}min walk${c.nom ? ` (${c.nom})` : ""}`37                : c.note}38            </span>39            <span className="hd-score">{c.score}</span>40          </li>41        ))}42      </ul>43      <p className="fine">{h.methode}</p>44    </section>45  );46}47