add trend UX + PHPStan level 6 clean (0 errors)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,12 @@ import './SpotPanel.css';
|
||||
const LEVEL_LABEL = { low: 'OK', medium: 'Risque', high: 'Impact' };
|
||||
const TYPE_ICON = { beach: '🏖', port: '⚓', surf: '🏄', fishing: '🎣' };
|
||||
|
||||
const TREND_CONFIG = {
|
||||
increasing: { icon: '📈', label: 'Situation en dégradation', cls: 'trend--bad' },
|
||||
stable: { icon: '➡️', label: 'Situation stable', cls: 'trend--neutral' },
|
||||
decreasing: { icon: '📉', label: 'Amélioration en cours', cls: 'trend--good' },
|
||||
};
|
||||
|
||||
const HORIZON_LABELS = { now: 'Maintenant', h6: '+6h', h12: '+12h', h24: '+24h', h48: '+48h' };
|
||||
|
||||
export default function SpotPanel({ spot, activeStep, onClose }) {
|
||||
@@ -82,13 +88,20 @@ export default function SpotPanel({ spot, activeStep, onClose }) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{activeStep === 'now' && displayScore.trend && (() => {
|
||||
const t = TREND_CONFIG[displayScore.trend] ?? TREND_CONFIG.stable;
|
||||
return (
|
||||
<div className={`spot-panel__trend ${t.cls}`}>
|
||||
<span className="spot-panel__trend-icon">{t.icon}</span>
|
||||
<span className="spot-panel__trend-label">{t.label}</span>
|
||||
</div>
|
||||
);
|
||||
})()}
|
||||
|
||||
<dl className="spot-panel__details">
|
||||
{displayScore.distance != null && (
|
||||
<><dt>Distance sargasses</dt><dd>{displayScore.distance} km</dd></>
|
||||
)}
|
||||
{activeStep === 'now' && displayScore.trend && (
|
||||
<><dt>Tendance</dt><dd>{displayScore.trend}</dd></>
|
||||
)}
|
||||
{activeStep === 'now' && displayScore.computedAt && (
|
||||
<><dt>Calculé le</dt>
|
||||
<dd>{new Date(displayScore.computedAt).toLocaleString('fr-FR')}</dd></>
|
||||
|
||||
Reference in New Issue
Block a user