import React from 'react'
import { formatClubPercent, formatSkillWeight, kpiRowsFromSummary } from '../../utils/skillProfileListHelpers'
/**
* Kleine KPI-Kacheln: je Unterkategorie die Top-Fähigkeit (Listen/Karten).
*/
export default function SkillProfileCompact({
summary,
loading = false,
emptyText = 'Keine Fähigkeiten',
displayLimit = 24,
highlightSkillIds = [],
}) {
if (loading) {
return (
…
)
}
const rows = kpiRowsFromSummary(summary, { limit: displayLimit })
const highlight = new Set((highlightSkillIds || []).map(String))
if (!rows.length) {
return summary ? {emptyText}
: null
}
return (
{rows.map((row) => {
const highlighted = highlight.has(String(row.skill_id))
const isBest = row.is_club_best_for_skill || row.universal_percent >= 100
return (
-
{row.category_name}
{row.skill_name}
{formatSkillWeight(row.weight ?? row.score)}
{isBest ? '★ ' : ''}
{formatClubPercent(row.universal_percent)}
)
})}
)
}