fix: label "Veille" pour scores low 15-30, marqueur ambre, ETA sous surveillance
- scoreLabel() : low <15 → "OK", low ≥15 → "Veille", cohérence avec valeur numérique
- etaLabel() : score ≥15 sans ETA → "Sargasses en surveillance" (eta--watch)
- SpotMarker : étoile ambre pour level=low + scoreValue≥15 vs étoile verte pure OK
- spotScores stocke {level, value} au lieu de level seul
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,12 @@ import { api } from '../../api/client';
|
||||
import usePushSubscription from '../../hooks/usePushSubscription';
|
||||
import './SpotPanel.css';
|
||||
|
||||
const LEVEL_LABEL = { low: 'OK', medium: 'Risque', high: 'Impact' };
|
||||
function scoreLabel(value, level) {
|
||||
if (level === 'high') return 'Impact';
|
||||
if (level === 'medium') return 'Risque';
|
||||
if (value >= 15) return 'Veille';
|
||||
return 'OK';
|
||||
}
|
||||
const TYPE_ICON = { beach: '🏖', port: '⚓', surf: '🏄', fishing: '🎣' };
|
||||
|
||||
const TREND_CONFIG = {
|
||||
@@ -23,13 +28,14 @@ function computeEta(score, horizons) {
|
||||
return null;
|
||||
}
|
||||
|
||||
function etaLabel(etaHours) {
|
||||
if (etaHours === 0) return { icon: '🚨', label: 'Impact en cours', cls: 'eta--now' };
|
||||
if (etaHours === 6) return { icon: '⚠️', label: 'Impact prévu dans ~6h', cls: 'eta--soon' };
|
||||
if (etaHours === 12) return { icon: '⚠️', label: 'Impact prévu dans ~12h', cls: 'eta--soon' };
|
||||
if (etaHours === 24) return { icon: '🕐', label: 'Impact prévu dans ~24h', cls: 'eta--later' };
|
||||
if (etaHours === 48) return { icon: '🕐', label: 'Impact prévu dans ~48h', cls: 'eta--later' };
|
||||
return { icon: '✅', label: 'Aucun impact prévu (48h)', cls: 'eta--safe' };
|
||||
function etaLabel(etaHours, score) {
|
||||
if (etaHours === 0) return { icon: '🚨', label: 'Impact en cours', cls: 'eta--now' };
|
||||
if (etaHours === 6) return { icon: '⚠️', label: 'Impact prévu dans ~6h', cls: 'eta--soon' };
|
||||
if (etaHours === 12) return { icon: '⚠️', label: 'Impact prévu dans ~12h', cls: 'eta--soon' };
|
||||
if (etaHours === 24) return { icon: '🕐', label: 'Impact prévu dans ~24h', cls: 'eta--later' };
|
||||
if (etaHours === 48) return { icon: '🕐', label: 'Impact prévu dans ~48h', cls: 'eta--later' };
|
||||
if ((score ?? 0) >= 15) return { icon: '👁', label: 'Sargasses en surveillance', cls: 'eta--watch' };
|
||||
return { icon: '✅', label: 'Aucun impact prévu (48h)', cls: 'eta--safe' };
|
||||
}
|
||||
|
||||
const HORIZON_LABELS = { now: 'Maintenant', h6: '+6h', h12: '+12h', h24: '+24h', h48: '+48h' };
|
||||
@@ -94,7 +100,7 @@ export default function SpotPanel({ spot, activeStep, onClose }) {
|
||||
: (
|
||||
<>
|
||||
{activeStep === 'now' && (() => {
|
||||
const eta = etaLabel(computeEta(data?.score, data?.horizons));
|
||||
const eta = etaLabel(computeEta(data?.score, data?.horizons), data?.score?.value);
|
||||
return (
|
||||
<div className={`spot-panel__eta ${eta.cls}`}>
|
||||
<span className="spot-panel__eta-icon">{eta.icon}</span>
|
||||
@@ -105,7 +111,7 @@ export default function SpotPanel({ spot, activeStep, onClose }) {
|
||||
|
||||
<div className={`spot-panel__gauge gauge--${lvl}`}>
|
||||
<div className="spot-panel__gauge-top">
|
||||
<span className="spot-panel__gauge-label">{LEVEL_LABEL[lvl] ?? lvl}</span>
|
||||
<span className="spot-panel__gauge-label">{scoreLabel(displayScore.value, lvl)}</span>
|
||||
<span className="spot-panel__gauge-score">
|
||||
{displayScore.value}
|
||||
<span className="spot-panel__gauge-max">/100</span>
|
||||
|
||||
Reference in New Issue
Block a user