Update Skill Profile Summary and Frontend Components
Deploy Development / deploy (push) Successful in 43s
Test Suite / pytest-backend (push) Successful in 38s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Successful in 1m13s

- Modified the `compact_profile_summary` function to allow for dynamic skill and category limits, enhancing flexibility in profile data retrieval.
- Updated frontend components to display skill weights and scores more effectively, improving user interaction with skill metrics.
- Adjusted CSS styles for skill KPI tiles to better differentiate between score and percentage displays, ensuring a clearer visual representation.
- Refactored utility functions to streamline skill summary handling, enhancing overall code maintainability and performance.
This commit is contained in:
Lars committed 2026-05-21 09:42:13 +02:00
1 parent 9a0cf7f823
commit 34966b9e84
7 files changed
+165 -39

No files matched your search

+8 -3
View File
@@ -2744,12 +2744,17 @@ html.modal-scroll-locked .app-main {
-webkit-box-orient: vertical;
overflow: hidden;
}
.skill-kpi-tile__pct {
font-size: 0.72rem;
.skill-kpi-tile__score {
font-size: 0.78rem;
font-weight: 700;
color: var(--accent-dark);
color: var(--text1);
margin-top: 2px;
}
.skill-kpi-tile__pct {
font-size: 0.68rem;
font-weight: 600;
color: var(--accent-dark);
}
.skill-profile__name-cat {
font-weight: 500;
color: var(--text3);
@@ -1,5 +1,5 @@
import React from 'react'
import { formatClubPercent, kpiRowsFromSummary } from '../../utils/skillProfileListHelpers'
import { formatClubPercent, formatSkillWeight, kpiRowsFromSummary } from '../../utils/skillProfileListHelpers'
/**
* Kleine KPI-Kacheln: je Unterkategorie die Top-Fähigkeit (Listen/Karten).
@@ -8,7 +8,7 @@ export default function SkillProfileCompact({
summary,
loading = false,
emptyText = 'Keine Fähigkeiten',
displayLimit = 8,
displayLimit = 24,
highlightSkillIds = [],
}) {
if (loading) {
@@ -39,10 +39,11 @@ export default function SkillProfileCompact({
(highlighted ? ' skill-kpi-tile--highlight' : '') +
(isBest ? ' skill-kpi-tile--best' : '')
}
title={`${row.category_name}: ${row.skill_name}`}
title={`${row.category_name}: ${row.skill_name} — Gewicht ${formatSkillWeight(row.weight ?? row.score)}, ${formatClubPercent(row.universal_percent)} vom Vereins-Maximum`}
>
<span className="skill-kpi-tile__cat">{row.category_name}</span>
<span className="skill-kpi-tile__name">{row.skill_name}</span>
<span className="skill-kpi-tile__score">{formatSkillWeight(row.weight ?? row.score)}</span>
<span className="skill-kpi-tile__pct">
{isBest ? '★ ' : ''}
{formatClubPercent(row.universal_percent)}
@@ -244,7 +244,7 @@ export default function SkillProfilePanel({
</>
)}
{displayMode === 'summary' && slots && slots.length > 0 ? (
{slots && slots.length > 0 ? (
<div className="skill-profile__slots">
<span className="skill-profile__slots-label">Pro Session</span>
<ul className="skill-profile__slot-list">
@@ -270,11 +270,18 @@ export default function SkillProfilePanel({
</span>
)}
</button>
{open && sl.profile?.by_main_category?.length > 0 ? (
<CategoryGroupedProfile
profile={sl.profile}
ariaLabel={`Fähigkeiten Session ${(sl.sort_order ?? 0) + 1}`}
/>
{open && sl.profile?.skills?.length > 0 ? (
displayMode === 'full' ? (
<FullSkillsProfile
profile={sl.profile}
ariaLabel={`Alle Fähigkeiten Session ${(sl.sort_order ?? 0) + 1}`}
/>
) : (
<CategoryGroupedProfile
profile={sl.profile}
ariaLabel={`Fähigkeiten Session ${(sl.sort_order ?? 0) + 1}`}
/>
)
) : null}
</li>
)
@@ -2,7 +2,7 @@ import { formatDurationDisplay, formatSessionDurationRange } from './trainingDur
import {
frameworkSkillSummaryKey,
maxSelectedSkillClubPercent,
skillEntryFromSummary,
summaryHasSkill,
} from './skillProfileListHelpers'
export function frameworkSessionDurationLabel(row) {
@@ -117,7 +117,7 @@ export const EMPTY_FRAMEWORK_IMPORT_FILTERS = {
skillIds: [],
skillSort: 'title',
skillMinClubPercent: 0,
skillDisplayLimit: 10,
skillDisplayLimit: 24,
}
export function hasActiveFrameworkImportFilters(filters = {}) {
@@ -241,14 +241,8 @@ export function filterFrameworkPrograms(rows, filters = {}, skillSummaries = nul
if (skillIds.length && skillSummaries) {
list = list.filter((r) => {
const summary = skillSummaries[frameworkSkillSummaryKey(r.id)]
if (!summary) return minClubPct === 0
return skillIds.some((sid) => {
const sk = skillEntryFromSummary(summary, sid)
if (!sk) return false
const pct = sk.universal_percent
if (pct == null) return minClubPct === 0
return pct >= minClubPct
})
if (!summary) return false
return skillIds.some((sid) => summaryHasSkill(summary, sid, minClubPct))
})
}
+19 -2
View File
@@ -7,8 +7,19 @@ export function moduleSkillSummaryKey(id) {
}
export function skillEntryFromSummary(summary, skillId) {
if (!summary?.skills) return null
return summary.skills.find((s) => String(s.skill_id) === String(skillId)) || null
if (!summary) return null
const sid = String(skillId)
const fromSkills = (summary.skills || []).find((s) => String(s.skill_id) === sid)
if (fromSkills) return fromSkills
return (summary.top_by_category || []).find((s) => String(s.skill_id) === sid) || null
}
export function summaryHasSkill(summary, skillId, minClubPct = 0) {
const sk = skillEntryFromSummary(summary, skillId)
if (!sk || !(Number(sk.weight) > 0)) return false
const pct = sk.universal_percent
if (pct == null) return minClubPct === 0
return pct >= minClubPct
}
export function maxSelectedSkillClubPercent(summary, skillIds = []) {
@@ -30,6 +41,12 @@ export function formatClubPercent(value) {
return n % 1 === 0 ? `${n}%` : `${n.toFixed(1)}%`
}
export function formatSkillWeight(value) {
const n = Number(value)
if (!Number.isFinite(n)) return '—'
return n % 1 === 0 ? String(n) : n.toFixed(1)
}
/** KPI-Zeilen: immer Top je Unterkategorie; bei Skill-Filter nur passende Kategorien. */
export function kpiRowsFromSummary(summary, { skillIds = [], limit = 8 } = {}) {
if (!summary) return []