Implement Phase 3 Features for Skill Profiles and Discovery
Deploy Development / deploy (push) Successful in 42s
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 1m27s
Deploy Development / deploy (push) Successful in 42s
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 1m27s
- Updated the framework program documentation to reflect the completion of Phase 3 v1.0, including new skill scoring and API enhancements. - Added new API endpoints for skill profile retrieval and suggestions, improving the ability to aggregate and display skills based on training data. - Introduced new UI components for skill profiles and discovery in the frontend, enhancing user interaction with training frameworks and skills. - Updated version information to 0.8.151, reflecting the addition of skill profiles and related features.
This commit is contained in:
1 parent
e382b6ed35
commit
732b322c52
16 files changed
+1626
-17
No files matched your search
@@ -0,0 +1,26 @@
|
||||
import { request } from './client.js'
|
||||
|
||||
export async function getFrameworkProgramSkillProfile(frameworkId) {
|
||||
return request(`/api/training-framework-programs/${frameworkId}/skill-profile`)
|
||||
}
|
||||
|
||||
export async function getTrainingModuleSkillProfile(moduleId) {
|
||||
return request(`/api/training-modules/${moduleId}/skill-profile`)
|
||||
}
|
||||
|
||||
export async function getProgressionGraphSkillProfile(graphId) {
|
||||
return request(`/api/exercise-progression-graphs/${graphId}/skill-profile`)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number[]} skillIds
|
||||
* @param {{ types?: string, limit?: number }} opts
|
||||
*/
|
||||
export async function getSkillDiscoverySuggestions(skillIds, opts = {}) {
|
||||
const ids = (skillIds || []).filter((x) => x != null && Number(x) > 0).join(',')
|
||||
if (!ids) return { skill_ids: [], suggestions: [] }
|
||||
const params = new URLSearchParams({ skill_ids: ids })
|
||||
if (opts.types) params.set('types', opts.types)
|
||||
if (opts.limit != null) params.set('limit', String(opts.limit))
|
||||
return request(`/api/skill-discovery/suggestions?${params.toString()}`)
|
||||
}
|
||||
@@ -2475,6 +2475,282 @@ html.modal-scroll-locked .app-main {
|
||||
}
|
||||
}
|
||||
|
||||
/* Phase 3: Fähigkeiten-Profil & Planungs-Vorschläge */
|
||||
.skill-profile {
|
||||
margin-bottom: 1rem;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.skill-profile--loading,
|
||||
.skill-profile--error {
|
||||
padding: 1rem 1.15rem;
|
||||
}
|
||||
.skill-profile__status {
|
||||
margin: 0;
|
||||
color: var(--text2);
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
.skill-profile__toggle {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px 12px;
|
||||
width: 100%;
|
||||
padding: 0.85rem 1.1rem;
|
||||
border: none;
|
||||
background: transparent;
|
||||
font: inherit;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
.skill-profile__toggle-title {
|
||||
font-weight: 700;
|
||||
color: var(--text1);
|
||||
}
|
||||
.skill-profile__toggle-badge {
|
||||
font-size: 0.78rem;
|
||||
color: var(--accent-dark);
|
||||
background: var(--accent-light);
|
||||
padding: 3px 8px;
|
||||
border-radius: 999px;
|
||||
}
|
||||
.skill-profile__toggle-icon {
|
||||
margin-left: auto;
|
||||
color: var(--text3);
|
||||
}
|
||||
.skill-profile__body {
|
||||
padding: 0 1.1rem 1rem;
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
.skill-profile__hint {
|
||||
margin: 0.65rem 0 0.75rem;
|
||||
}
|
||||
.skill-profile__empty {
|
||||
margin: 0;
|
||||
color: var(--text2);
|
||||
font-size: 0.88rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.skill-profile__stats {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px 18px;
|
||||
font-size: 0.82rem;
|
||||
color: var(--text2);
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
.skill-profile__list {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
.skill-profile__list--nested {
|
||||
margin: 8px 0 0;
|
||||
padding-left: 8px;
|
||||
border-left: 2px solid var(--border);
|
||||
}
|
||||
.skill-profile__row-head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.skill-profile__name {
|
||||
font-weight: 600;
|
||||
font-size: 0.88rem;
|
||||
color: var(--text1);
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.skill-profile__pct {
|
||||
font-size: 0.82rem;
|
||||
font-weight: 700;
|
||||
color: var(--accent-dark);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.skill-profile__bar-track {
|
||||
height: 8px;
|
||||
border-radius: 4px;
|
||||
background: var(--surface2);
|
||||
overflow: hidden;
|
||||
}
|
||||
.skill-profile__bar-fill {
|
||||
height: 100%;
|
||||
border-radius: 4px;
|
||||
background: linear-gradient(90deg, var(--accent) 0%, var(--accent-dark) 100%);
|
||||
min-width: 2px;
|
||||
}
|
||||
.skill-profile__meta-hint {
|
||||
display: block;
|
||||
font-size: 0.72rem;
|
||||
color: var(--text3);
|
||||
margin-top: 3px;
|
||||
}
|
||||
.skill-profile__categories {
|
||||
margin-top: 0.85rem;
|
||||
}
|
||||
.skill-profile__categories-label,
|
||||
.skill-profile__slots-label {
|
||||
display: block;
|
||||
font-size: 0.72rem;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
color: var(--text3);
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
.skill-profile__category-chips {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
.skill-profile__category-chip {
|
||||
font-size: 0.78rem;
|
||||
padding: 3px 8px;
|
||||
border-radius: 6px;
|
||||
background: var(--surface2);
|
||||
color: var(--text2);
|
||||
}
|
||||
.skill-profile__slots {
|
||||
margin-top: 1rem;
|
||||
padding-top: 0.85rem;
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
.skill-profile__slot-list {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.skill-profile__slot-btn {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
gap: 6px;
|
||||
width: 100%;
|
||||
padding: 8px 0;
|
||||
border: none;
|
||||
background: transparent;
|
||||
font: inherit;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
color: var(--text1);
|
||||
}
|
||||
.skill-profile__slot-top {
|
||||
font-size: 0.82rem;
|
||||
color: var(--accent-dark);
|
||||
font-weight: 600;
|
||||
}
|
||||
.skill-profile__slot-top--muted {
|
||||
color: var(--text3);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.skill-discovery {
|
||||
padding: 1.15rem 1.25rem;
|
||||
max-width: 52rem;
|
||||
}
|
||||
.skill-discovery__title {
|
||||
margin: 0 0 0.35rem;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
.skill-discovery__lead {
|
||||
margin: 0 0 1rem;
|
||||
max-width: 40rem;
|
||||
}
|
||||
.skill-discovery__pick-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
|
||||
gap: 8px;
|
||||
max-height: 220px;
|
||||
overflow-y: auto;
|
||||
padding: 8px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
background: var(--surface2);
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
.skill-discovery__pick {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 4px 8px;
|
||||
font-size: 0.85rem;
|
||||
cursor: pointer;
|
||||
padding: 4px 6px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
.skill-discovery__pick:hover {
|
||||
background: var(--surface);
|
||||
}
|
||||
.skill-discovery__pick-name {
|
||||
font-weight: 600;
|
||||
color: var(--text1);
|
||||
}
|
||||
.skill-discovery__pick-cat {
|
||||
font-size: 0.72rem;
|
||||
color: var(--text3);
|
||||
}
|
||||
.skill-discovery__actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
.skill-discovery__error {
|
||||
color: var(--danger);
|
||||
margin: 0 0 0.75rem;
|
||||
}
|
||||
.skill-discovery__results {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
.skill-discovery__result {
|
||||
padding: 0.85rem 1rem;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.skill-discovery__result-head {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
gap: 6px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.skill-discovery__result-type {
|
||||
font-size: 0.72rem;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
color: var(--text3);
|
||||
}
|
||||
.skill-discovery__result-match {
|
||||
font-size: 0.82rem;
|
||||
font-weight: 700;
|
||||
color: var(--accent-dark);
|
||||
}
|
||||
.skill-discovery__result-title {
|
||||
display: block;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.skill-discovery__result-skills {
|
||||
margin: 0 0 8px;
|
||||
font-size: 0.85rem;
|
||||
color: var(--text2);
|
||||
}
|
||||
.skill-discovery__result-link {
|
||||
text-decoration: none;
|
||||
}
|
||||
.skill-discovery__no-hit {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* Rahmenprogramm-Editor (Vollseiten-Formular mit Action-Dock) */
|
||||
.page-form-editor__body .framework-edit {
|
||||
min-width: 0;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import api from '../utils/api'
|
||||
import SkillProfilePanel from './skills/SkillProfilePanel'
|
||||
import { useAuth } from '../context/AuthContext'
|
||||
import { getTenantClubDependencyKey } from '../utils/activeClub'
|
||||
import ExercisePickerModal from './ExercisePickerModal'
|
||||
@@ -136,6 +137,9 @@ export default function ExerciseProgressionGraphPanel({
|
||||
const [editingEdgeNotes, setEditingEdgeNotes] = useState(null)
|
||||
const [notesDraft, setNotesDraft] = useState('')
|
||||
const [uiTab, setUiTab] = useState('overview')
|
||||
const [skillProfileData, setSkillProfileData] = useState(null)
|
||||
const [skillProfileLoading, setSkillProfileLoading] = useState(false)
|
||||
const [skillProfileError, setSkillProfileError] = useState('')
|
||||
|
||||
useEffect(() => {
|
||||
setSelectedGraphId(null)
|
||||
@@ -180,6 +184,32 @@ export default function ExerciseProgressionGraphPanel({
|
||||
}
|
||||
}, [refreshGraphs, tenantClubDepKey])
|
||||
|
||||
useEffect(() => {
|
||||
if (!selectedGraphId) {
|
||||
setSkillProfileData(null)
|
||||
return undefined
|
||||
}
|
||||
let cancelled = false
|
||||
;(async () => {
|
||||
setSkillProfileLoading(true)
|
||||
setSkillProfileError('')
|
||||
try {
|
||||
const data = await api.getProgressionGraphSkillProfile(selectedGraphId)
|
||||
if (!cancelled) setSkillProfileData(data)
|
||||
} catch (e) {
|
||||
if (!cancelled) {
|
||||
setSkillProfileData(null)
|
||||
setSkillProfileError(e.message || 'Fähigkeiten-Profil nicht geladen')
|
||||
}
|
||||
} finally {
|
||||
if (!cancelled) setSkillProfileLoading(false)
|
||||
}
|
||||
})()
|
||||
return () => {
|
||||
cancelled = true
|
||||
}
|
||||
}, [selectedGraphId, edges.length])
|
||||
|
||||
useEffect(() => {
|
||||
if (!selectedGraphId) {
|
||||
setEdges([])
|
||||
@@ -652,6 +682,14 @@ export default function ExerciseProgressionGraphPanel({
|
||||
|
||||
{selectedGraphId && uiTab === 'overview' && (
|
||||
<>
|
||||
<SkillProfilePanel
|
||||
title="Fähigkeiten entlang des Pfads"
|
||||
hint="Alle Übungen als Knoten im Graph (ohne Einzel-Dauer — Standardgewicht pro Übung)."
|
||||
profile={skillProfileData?.overall}
|
||||
loading={skillProfileLoading}
|
||||
error={skillProfileError}
|
||||
defaultExpanded
|
||||
/>
|
||||
<div className="card" style={{ marginBottom: '12px' }}>
|
||||
<h3 style={{ marginTop: 0, fontSize: '1rem' }}>Sequenz / Reihe anlegen</h3>
|
||||
<p style={{ fontSize: '12px', color: 'var(--text3)', marginTop: 0 }}>
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
import React, { useMemo, useState } from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import api from '../../utils/api'
|
||||
|
||||
const ARTIFACT_LABELS = {
|
||||
framework_program: 'Rahmenprogramm',
|
||||
training_module: 'Trainingsmodul',
|
||||
progression_graph: 'Regressionspfad',
|
||||
}
|
||||
|
||||
/**
|
||||
* Vorschläge für Planungsartefakte anhand gewählter Fähigkeiten (Phase 3).
|
||||
*/
|
||||
export default function SkillDiscoveryPanel({ skills = [] }) {
|
||||
const [selectedIds, setSelectedIds] = useState([])
|
||||
const [query, setQuery] = useState('')
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [error, setError] = useState('')
|
||||
const [result, setResult] = useState(null)
|
||||
|
||||
const filteredSkills = useMemo(() => {
|
||||
const q = query.trim().toLowerCase()
|
||||
const list = (skills || []).filter((s) => s.status !== 'inactive')
|
||||
if (!q) return list
|
||||
return list.filter(
|
||||
(s) =>
|
||||
(s.name || '').toLowerCase().includes(q) ||
|
||||
(s.category || '').toLowerCase().includes(q)
|
||||
)
|
||||
}, [skills, query])
|
||||
|
||||
const toggleSkill = (id) => {
|
||||
const s = String(id)
|
||||
setSelectedIds((prev) =>
|
||||
prev.includes(s) ? prev.filter((x) => x !== s) : [...prev, s]
|
||||
)
|
||||
}
|
||||
|
||||
async function handleSearch() {
|
||||
const ids = selectedIds.map((x) => parseInt(x, 10)).filter((n) => n > 0)
|
||||
if (!ids.length) {
|
||||
setError('Wähle mindestens eine Fähigkeit.')
|
||||
return
|
||||
}
|
||||
setLoading(true)
|
||||
setError('')
|
||||
setResult(null)
|
||||
try {
|
||||
const data = await api.getSkillDiscoverySuggestions(ids, { limit: 25 })
|
||||
setResult(data)
|
||||
} catch (e) {
|
||||
setError(e.message || 'Suche fehlgeschlagen')
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="skill-discovery card">
|
||||
<h2 className="skill-discovery__title">Planungs-Vorschläge</h2>
|
||||
<p className="form-sub skill-discovery__lead">
|
||||
Wähle Fähigkeiten, die du schwerpunktmäßig entwickeln willst — Shinkan schlägt passende
|
||||
Rahmenprogramme, Trainingsmodule und Regressionspfade aus der Bibliothek vor (gewichtet nach
|
||||
Übungs-Verknüpfungen).
|
||||
</p>
|
||||
|
||||
<div className="form-row">
|
||||
<label className="form-label">Fähigkeiten filtern</label>
|
||||
<input
|
||||
className="form-input"
|
||||
value={query}
|
||||
onChange={(e) => setQuery(e.target.value)}
|
||||
placeholder="Name oder Kategorie …"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="skill-discovery__pick-grid" role="group" aria-label="Fähigkeiten auswählen">
|
||||
{filteredSkills.length === 0 ? (
|
||||
<p className="form-sub">Keine Fähigkeiten gefunden.</p>
|
||||
) : (
|
||||
filteredSkills.map((sk) => (
|
||||
<label key={sk.id} className="skill-discovery__pick">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={selectedIds.includes(String(sk.id))}
|
||||
onChange={() => toggleSkill(sk.id)}
|
||||
/>
|
||||
<span className="skill-discovery__pick-name">{sk.name}</span>
|
||||
{sk.category ? (
|
||||
<span className="skill-discovery__pick-cat">{sk.category}</span>
|
||||
) : null}
|
||||
</label>
|
||||
))
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="skill-discovery__actions">
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary"
|
||||
disabled={loading || selectedIds.length === 0}
|
||||
onClick={handleSearch}
|
||||
>
|
||||
{loading ? 'Suche …' : 'Bibliothek durchsuchen'}
|
||||
</button>
|
||||
{selectedIds.length > 0 ? (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary"
|
||||
onClick={() => {
|
||||
setSelectedIds([])
|
||||
setResult(null)
|
||||
setError('')
|
||||
}}
|
||||
>
|
||||
Auswahl leeren
|
||||
</button>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
{error ? <p className="skill-discovery__error">{error}</p> : null}
|
||||
|
||||
{result?.suggestions?.length > 0 ? (
|
||||
<ul className="skill-discovery__results">
|
||||
{result.suggestions.map((item) => (
|
||||
<li key={`${item.artifact_type}-${item.artifact_id}`} className="skill-discovery__result card">
|
||||
<div className="skill-discovery__result-head">
|
||||
<span className="skill-discovery__result-type">
|
||||
{ARTIFACT_LABELS[item.artifact_type] || item.artifact_type}
|
||||
</span>
|
||||
<span className="skill-discovery__result-match">
|
||||
Passung {item.match?.match_percent ?? 0}%
|
||||
</span>
|
||||
</div>
|
||||
<strong className="skill-discovery__result-title">
|
||||
{item.artifact_title || `#${item.artifact_id}`}
|
||||
</strong>
|
||||
{item.match?.matched_skills?.length > 0 ? (
|
||||
<p className="skill-discovery__result-skills">
|
||||
{item.match.matched_skills.map((m) => m.skill_name).join(' · ')}
|
||||
</p>
|
||||
) : null}
|
||||
{item.path ? (
|
||||
<Link to={item.path} className="btn btn-secondary btn-small skill-discovery__result-link">
|
||||
Öffnen
|
||||
</Link>
|
||||
) : item.artifact_type === 'progression_graph' ? (
|
||||
<p className="form-sub" style={{ margin: '8px 0 0' }}>
|
||||
Regressionspfad in der Übungsliste unter „Progressionsgraph“ bearbeiten.
|
||||
</p>
|
||||
) : null}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : result && !loading ? (
|
||||
<p className="form-sub skill-discovery__no-hit">
|
||||
Keine passenden Artefakte in deiner sichtbaren Bibliothek — prüfe Fähigkeiten-Verknüpfungen an
|
||||
den Übungen oder erweitere die Auswahl.
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
import React, { useMemo, useState } from 'react'
|
||||
|
||||
function SkillBar({ skill, maxShare }) {
|
||||
const pct = maxShare > 0 ? Math.min(100, (skill.share_percent / maxShare) * 100) : 0
|
||||
return (
|
||||
<li className="skill-profile__row">
|
||||
<div className="skill-profile__row-head">
|
||||
<span className="skill-profile__name" title={skill.skill_name}>
|
||||
{skill.skill_name}
|
||||
</span>
|
||||
<span className="skill-profile__pct">{skill.share_percent}%</span>
|
||||
</div>
|
||||
<div className="skill-profile__bar-track" aria-hidden="true">
|
||||
<div
|
||||
className="skill-profile__bar-fill"
|
||||
style={{ width: `${pct}%` }}
|
||||
/>
|
||||
</div>
|
||||
{skill.primary_link_count > 0 ? (
|
||||
<span className="skill-profile__meta-hint">
|
||||
{skill.primary_link_count}× als Primär-Fähigkeit in Übungen
|
||||
</span>
|
||||
) : null}
|
||||
</li>
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gewichtetes Fähigkeiten-Profil (Phase 3) — Anzeige für Planungsartefakte.
|
||||
*/
|
||||
export default function SkillProfilePanel({
|
||||
profile,
|
||||
slots = null,
|
||||
loading = false,
|
||||
error = '',
|
||||
title = 'Fähigkeiten-Profil',
|
||||
hint = 'Aus verknüpften Übungen berechnet (Dauer, Vorkommen, Primär-Fähigkeit, Intensität).',
|
||||
defaultExpanded = true,
|
||||
}) {
|
||||
const [expanded, setExpanded] = useState(defaultExpanded)
|
||||
const [slotOpenId, setSlotOpenId] = useState(null)
|
||||
|
||||
const skills = profile?.skills || []
|
||||
const maxShare = useMemo(
|
||||
() => Math.max(...skills.map((s) => s.share_percent || 0), 1),
|
||||
[skills]
|
||||
)
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<div className="card skill-profile skill-profile--loading">
|
||||
<p className="skill-profile__status">Fähigkeiten-Profil wird berechnet…</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<div className="card skill-profile skill-profile--error">
|
||||
<p className="skill-profile__status">{error}</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const noData =
|
||||
!profile ||
|
||||
(profile.exercise_occurrence_count === 0 && profile.distinct_exercise_count === 0)
|
||||
|
||||
return (
|
||||
<div className="card skill-profile">
|
||||
<button
|
||||
type="button"
|
||||
className="skill-profile__toggle"
|
||||
onClick={() => setExpanded((v) => !v)}
|
||||
aria-expanded={expanded}
|
||||
>
|
||||
<span className="skill-profile__toggle-title">{title}</span>
|
||||
{!noData && skills.length > 0 ? (
|
||||
<span className="skill-profile__toggle-badge">
|
||||
Top: {skills[0].skill_name} ({skills[0].share_percent}%)
|
||||
</span>
|
||||
) : null}
|
||||
<span className="skill-profile__toggle-icon" aria-hidden="true">
|
||||
{expanded ? '▾' : '▸'}
|
||||
</span>
|
||||
</button>
|
||||
|
||||
{expanded ? (
|
||||
<div className="skill-profile__body">
|
||||
<p className="form-sub skill-profile__hint">{hint}</p>
|
||||
|
||||
{noData ? (
|
||||
<p className="skill-profile__empty">
|
||||
Noch keine Übungen mit Fähigkeiten-Verknüpfung — lege Übungen im Ablauf an und verknüpfe
|
||||
Fähigkeiten in der Übungsbearbeitung.
|
||||
</p>
|
||||
) : profile.exercises_with_skills_count === 0 ? (
|
||||
<p className="skill-profile__empty">
|
||||
{profile.distinct_exercise_count} Übung{profile.distinct_exercise_count === 1 ? '' : 'en'} im
|
||||
Ablauf, aber keine Fähigkeiten an den Übungen hinterlegt.
|
||||
</p>
|
||||
) : (
|
||||
<>
|
||||
<div className="skill-profile__stats">
|
||||
<span>
|
||||
<strong>{profile.distinct_exercise_count}</strong> Übungen
|
||||
</span>
|
||||
<span>
|
||||
<strong>{skills.length}</strong> Fähigkeiten
|
||||
</span>
|
||||
<span>
|
||||
<strong>{profile.exercise_occurrence_count}</strong> Positionen
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<ul className="skill-profile__list" aria-label="Fähigkeiten nach Gewicht">
|
||||
{skills.slice(0, 12).map((sk) => (
|
||||
<SkillBar key={sk.skill_id} skill={sk} maxShare={maxShare} />
|
||||
))}
|
||||
</ul>
|
||||
|
||||
{profile.by_category?.length > 1 ? (
|
||||
<div className="skill-profile__categories">
|
||||
<span className="skill-profile__categories-label">Nach Kategorie</span>
|
||||
<div className="skill-profile__category-chips">
|
||||
{profile.by_category.slice(0, 6).map((c) => (
|
||||
<span key={c.category} className="skill-profile__category-chip">
|
||||
{c.category} {c.share_percent}%
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
</>
|
||||
)}
|
||||
|
||||
{slots && slots.length > 0 ? (
|
||||
<div className="skill-profile__slots">
|
||||
<span className="skill-profile__slots-label">Pro Session</span>
|
||||
<ul className="skill-profile__slot-list">
|
||||
{slots.map((sl) => {
|
||||
const open = slotOpenId === sl.slot_id
|
||||
const top = sl.profile?.skills?.[0]
|
||||
return (
|
||||
<li key={sl.slot_id} className="skill-profile__slot-item">
|
||||
<button
|
||||
type="button"
|
||||
className="skill-profile__slot-btn"
|
||||
onClick={() => setSlotOpenId(open ? null : sl.slot_id)}
|
||||
aria-expanded={open}
|
||||
>
|
||||
<span>
|
||||
{(sl.slot_title || '').trim() || `Session ${(sl.sort_order ?? 0) + 1}`}
|
||||
</span>
|
||||
{top ? (
|
||||
<span className="skill-profile__slot-top">
|
||||
{top.skill_name} {top.share_percent}%
|
||||
</span>
|
||||
) : (
|
||||
<span className="skill-profile__slot-top skill-profile__slot-top--muted">
|
||||
{sl.exercise_occurrence_count > 0 ? 'ohne Fähigkeiten' : 'kein Ablauf'}
|
||||
</span>
|
||||
)}
|
||||
</button>
|
||||
{open && sl.profile?.skills?.length > 0 ? (
|
||||
<ul className="skill-profile__list skill-profile__list--nested">
|
||||
{sl.profile.skills.slice(0, 6).map((sk) => (
|
||||
<SkillBar
|
||||
key={sk.skill_id}
|
||||
skill={sk}
|
||||
maxShare={Math.max(
|
||||
...sl.profile.skills.map((x) => x.share_percent || 0),
|
||||
1
|
||||
)}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
) : null}
|
||||
</li>
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -2,10 +2,12 @@ import React, { useState, useEffect } from 'react'
|
||||
import api from '../utils/api'
|
||||
import { useAuth } from '../context/AuthContext'
|
||||
import PageSectionNav from '../components/PageSectionNav'
|
||||
import SkillDiscoveryPanel from '../components/skills/SkillDiscoveryPanel'
|
||||
|
||||
const SKILLS_SECTION_TABS = [
|
||||
{ id: 'skills', label: 'Fähigkeiten' },
|
||||
{ id: 'methods', label: 'Trainingsmethoden' },
|
||||
{ id: 'discovery', label: 'Planungs-Vorschläge' },
|
||||
]
|
||||
|
||||
function SkillsPage() {
|
||||
@@ -243,6 +245,8 @@ function SkillsPage() {
|
||||
</>
|
||||
)}
|
||||
|
||||
{activeTab === 'discovery' && <SkillDiscoveryPanel skills={skills} />}
|
||||
|
||||
{/* Methods Tab */}
|
||||
{activeTab === 'methods' && (
|
||||
<>
|
||||
|
||||
@@ -6,6 +6,7 @@ import ExercisePeekModal from '../components/ExercisePeekModal'
|
||||
import TrainingUnitSectionsEditor from '../components/TrainingUnitSectionsEditor'
|
||||
import PageSectionNav from '../components/PageSectionNav'
|
||||
import PageFormEditorChrome from '../components/PageFormEditorChrome'
|
||||
import SkillProfilePanel from '../components/skills/SkillProfilePanel'
|
||||
import { useToast } from '../context/ToastContext'
|
||||
import { useNavReturn } from '../hooks/useNavReturn'
|
||||
import {
|
||||
@@ -248,6 +249,10 @@ export default function TrainingFrameworkProgramEditPage() {
|
||||
)
|
||||
/** Schmale Ansicht: welcher Session-Slot gerade die volle Breite nutzt (Chip-Navigation) */
|
||||
const [mobileSlotIdx, setMobileSlotIdx] = useState(0)
|
||||
const [skillProfileData, setSkillProfileData] = useState(null)
|
||||
const [skillProfileLoading, setSkillProfileLoading] = useState(false)
|
||||
const [skillProfileError, setSkillProfileError] = useState('')
|
||||
const [skillProfileTick, setSkillProfileTick] = useState(0)
|
||||
|
||||
const toast = useToast()
|
||||
const baselineRef = useRef(null)
|
||||
@@ -301,6 +306,32 @@ export default function TrainingFrameworkProgramEditPage() {
|
||||
return () => document.removeEventListener('pointerdown', onPointerDown, true)
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (isNew || !idParam) {
|
||||
setSkillProfileData(null)
|
||||
return undefined
|
||||
}
|
||||
let cancelled = false
|
||||
;(async () => {
|
||||
setSkillProfileLoading(true)
|
||||
setSkillProfileError('')
|
||||
try {
|
||||
const data = await api.getFrameworkProgramSkillProfile(idParam)
|
||||
if (!cancelled) setSkillProfileData(data)
|
||||
} catch (e) {
|
||||
if (!cancelled) {
|
||||
setSkillProfileData(null)
|
||||
setSkillProfileError(e.message || 'Fähigkeiten-Profil nicht geladen')
|
||||
}
|
||||
} finally {
|
||||
if (!cancelled) setSkillProfileLoading(false)
|
||||
}
|
||||
})()
|
||||
return () => {
|
||||
cancelled = true
|
||||
}
|
||||
}, [isNew, idParam, skillProfileTick])
|
||||
|
||||
const loadMeta = useCallback(async () => {
|
||||
try {
|
||||
const [cl, fa, sd, tt, tg] = await Promise.all([
|
||||
@@ -480,6 +511,7 @@ export default function TrainingFrameworkProgramEditPage() {
|
||||
setBypassDirty(false)
|
||||
setBaselineReady(true)
|
||||
toast.success('Gespeichert.')
|
||||
setSkillProfileTick((t) => t + 1)
|
||||
if (closeAfter) goBack()
|
||||
return true
|
||||
} catch (e) {
|
||||
@@ -940,6 +972,17 @@ export default function TrainingFrameworkProgramEditPage() {
|
||||
/>
|
||||
</div>
|
||||
|
||||
{!isNew ? (
|
||||
<SkillProfilePanel
|
||||
title="Fähigkeiten-Schwerpunkte (aus Übungen)"
|
||||
hint="Gewichtung nach geplanter Dauer, Häufigkeit der Übung im Programm, Primär-Fähigkeit und Intensität. Vergleichbar mit manuell gesetzten Fokusbereichen in den Stammdaten."
|
||||
profile={skillProfileData?.overall}
|
||||
slots={skillProfileData?.slots}
|
||||
loading={skillProfileLoading}
|
||||
error={skillProfileError}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
<div
|
||||
className={
|
||||
'framework-edit__panel framework-edit__panel--meta card' +
|
||||
|
||||
@@ -3,6 +3,7 @@ import { useLocation, useNavigate, useParams } from 'react-router-dom'
|
||||
import api from '../utils/api'
|
||||
import ExercisePickerModal from '../components/ExercisePickerModal'
|
||||
import FormActionBar from '../components/FormActionBar'
|
||||
import SkillProfilePanel from '../components/skills/SkillProfilePanel'
|
||||
import { hydrateExercisePlanningRow } from '../utils/trainingUnitSectionsForm'
|
||||
import { useAuth } from '../context/AuthContext'
|
||||
import { useToast } from '../context/ToastContext'
|
||||
@@ -76,6 +77,10 @@ export default function TrainingModuleEditPage() {
|
||||
const [methods, setMethods] = useState([])
|
||||
const [pickerOpen, setPickerOpen] = useState(false)
|
||||
const [error, setError] = useState('')
|
||||
const [skillProfileData, setSkillProfileData] = useState(null)
|
||||
const [skillProfileLoading, setSkillProfileLoading] = useState(false)
|
||||
const [skillProfileError, setSkillProfileError] = useState('')
|
||||
const [skillProfileTick, setSkillProfileTick] = useState(0)
|
||||
|
||||
const [title, setTitle] = useState('')
|
||||
const [summary, setSummary] = useState('')
|
||||
@@ -130,6 +135,32 @@ export default function TrainingModuleEditPage() {
|
||||
const blocker = useUnsavedChangesBlocker(Boolean(formDirtyEffective && !saving))
|
||||
useBeforeUnloadWhen(Boolean(formDirtyEffective && !saving))
|
||||
|
||||
useEffect(() => {
|
||||
if (isNew || !Number.isFinite(moduleId)) {
|
||||
setSkillProfileData(null)
|
||||
return undefined
|
||||
}
|
||||
let cancelled = false
|
||||
;(async () => {
|
||||
setSkillProfileLoading(true)
|
||||
setSkillProfileError('')
|
||||
try {
|
||||
const data = await api.getTrainingModuleSkillProfile(moduleId)
|
||||
if (!cancelled) setSkillProfileData(data)
|
||||
} catch (e) {
|
||||
if (!cancelled) {
|
||||
setSkillProfileData(null)
|
||||
setSkillProfileError(e.message || 'Fähigkeiten-Profil nicht geladen')
|
||||
}
|
||||
} finally {
|
||||
if (!cancelled) setSkillProfileLoading(false)
|
||||
}
|
||||
})()
|
||||
return () => {
|
||||
cancelled = true
|
||||
}
|
||||
}, [isNew, moduleId, skillProfileTick])
|
||||
|
||||
const { user } = useAuth()
|
||||
const isPlatformAdmin = user?.role === 'admin' || user?.role === 'superadmin'
|
||||
const tenantClubDepKey = useMemo(() => getTenantClubDependencyKey(user), [user])
|
||||
@@ -339,6 +370,7 @@ export default function TrainingModuleEditPage() {
|
||||
baselineRef.current = moduleFormSnapshot(latestFormRef.current)
|
||||
setBypassDirty(false)
|
||||
toast.success('Gespeichert.')
|
||||
setSkillProfileTick((t) => t + 1)
|
||||
if (closeAfter) goBack()
|
||||
return true
|
||||
} catch (err) {
|
||||
@@ -391,6 +423,14 @@ export default function TrainingModuleEditPage() {
|
||||
onSubmit={handleSave}
|
||||
>
|
||||
<div className="page-form-shell__scroll">
|
||||
{!isNew ? (
|
||||
<SkillProfilePanel
|
||||
title="Fähigkeiten im Modul"
|
||||
profile={skillProfileData?.overall}
|
||||
loading={skillProfileLoading}
|
||||
error={skillProfileError}
|
||||
/>
|
||||
) : null}
|
||||
<div className="form-row">
|
||||
<label className="form-label">Titel *</label>
|
||||
<input className="form-input" value={title} onChange={(e) => setTitle(e.target.value)} />
|
||||
|
||||
@@ -7,10 +7,12 @@
|
||||
import { request, ACTIVE_CLUB_STORAGE_KEY } from '../api/client.js'
|
||||
import * as exercises from '../api/exercises.js'
|
||||
import * as planning from '../api/planning.js'
|
||||
import * as skillProfiles from '../api/skillProfiles.js'
|
||||
|
||||
export { ACTIVE_CLUB_STORAGE_KEY }
|
||||
export * from '../api/exercises.js'
|
||||
export * from '../api/planning.js'
|
||||
export * from '../api/skillProfiles.js'
|
||||
|
||||
// ============================================================================
|
||||
// Auth
|
||||
|
||||
Reference in new issue
Block a user