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,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>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user