import { Text, Stack, Group } from '@mantine/core'; import { getMetadata } from '../../utils/mapUtils'; import styles from './MapLegend.module.css'; export default function MapLegend({ analysisResult }) { if (!analysisResult || !analysisResult.statistics) return null; const stats = Object.values(analysisResult.statistics) .filter(item => item.percentage > 0) .sort((a, b) => b.percentage - a.percentage); if (stats.length === 0) return null; return (
Legend {stats.map((item) => { const { label, color } = getMetadata(item.name); return (
{label}
{item.percentage.toFixed(1)}%
); })}
); }