chore(version): update version and changelog for release 0.8.119
Deploy Development / deploy (push) Successful in 39s
Test Suite / pytest-backend (push) Successful in 36s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 12s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m2s
Deploy Development / deploy (push) Successful in 39s
Test Suite / pytest-backend (push) Successful in 36s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 12s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m2s
- Bumped APP_VERSION to 0.8.119 and updated the changelog to reflect new features. - Introduced the ExerciseListCard component and implemented lazy loading for the Progression Tab using React's Suspense. - Enhanced the ExercisePickerModal with virtualization for improved performance using @tanstack/react-virtual. - Updated documentation to reflect the new app version and its corresponding changes.
This commit is contained in:
1 parent
b06d026dd0
commit
9da29a2231
9 files changed
+298
-206
No files matched your search
@@ -2,7 +2,8 @@
|
||||
* Übungssuche mit Volltext-, KI-/Semantikfeld (aktuell gleiche Engine wie Suche) und erweiterten Filtern.
|
||||
* Paginierung bis max. 100 Treffer pro Request (API-Limit).
|
||||
*/
|
||||
import React, { useState, useEffect, useMemo, useCallback } from 'react'
|
||||
import React, { useState, useEffect, useMemo, useCallback, useRef } from 'react'
|
||||
import { useVirtualizer } from '@tanstack/react-virtual'
|
||||
import api from '../utils/api'
|
||||
import { useAuth } from '../context/AuthContext'
|
||||
import { SKILL_LEVEL_OPTIONS } from '../constants/skillLevels'
|
||||
@@ -59,6 +60,7 @@ export default function ExercisePickerModal({
|
||||
const [quickTitle, setQuickTitle] = useState('')
|
||||
const [quickSummary, setQuickSummary] = useState('')
|
||||
const [quickSaving, setQuickSaving] = useState(false)
|
||||
const pickerScrollRef = useRef(null)
|
||||
|
||||
const toggleMultiPick = (ex) => {
|
||||
setMultiPicked((prev) =>
|
||||
@@ -276,6 +278,14 @@ export default function ExercisePickerModal({
|
||||
}
|
||||
}
|
||||
|
||||
const rowVirtualizer = useVirtualizer({
|
||||
count: list.length,
|
||||
getScrollElement: () => pickerScrollRef.current,
|
||||
estimateSize: () => 88,
|
||||
overscan: 8,
|
||||
getItemKey: (index) => String(list[index]?.id ?? index),
|
||||
})
|
||||
|
||||
const resetFilters = () => setFilters({ ...INITIAL_FILTERS })
|
||||
|
||||
const submitQuickCreate = async () => {
|
||||
@@ -585,7 +595,11 @@ export default function ExercisePickerModal({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style={{ flex: 1, minHeight: 0, overflowY: 'auto', padding: '12px 1rem' }}>
|
||||
<div
|
||||
ref={pickerScrollRef}
|
||||
data-testid="exercise-picker-scroll"
|
||||
style={{ flex: 1, minHeight: 0, overflowY: 'auto', padding: '12px 1rem' }}
|
||||
>
|
||||
{!catalogsReady || (loading && list.length === 0) ? (
|
||||
<div style={{ textAlign: 'center', padding: '2rem' }}>
|
||||
<div className="spinner" />
|
||||
@@ -597,8 +611,18 @@ export default function ExercisePickerModal({
|
||||
<p style={{ fontSize: '13px', color: 'var(--text2)', marginBottom: 10 }}>
|
||||
{list.length} angezeigt{hasMore ? ' · weiter unten „Mehr laden“' : ''}
|
||||
</p>
|
||||
<ul style={{ listStyle: 'none', padding: 0, margin: 0 }}>
|
||||
{list.map((ex) => {
|
||||
<div
|
||||
role="list"
|
||||
aria-label="Übungstreffer"
|
||||
style={{
|
||||
position: 'relative',
|
||||
width: '100%',
|
||||
height: rowVirtualizer.getTotalSize(),
|
||||
}}
|
||||
>
|
||||
{rowVirtualizer.getVirtualItems().map((vi) => {
|
||||
const ex = list[vi.index]
|
||||
if (!ex) return null
|
||||
const picked = multiPicked.some((p) => p.id === ex.id)
|
||||
const rowInner = (
|
||||
<>
|
||||
@@ -630,9 +654,22 @@ export default function ExercisePickerModal({
|
||||
) : null}
|
||||
</>
|
||||
)
|
||||
if (multiSelect) {
|
||||
return (
|
||||
<li key={ex.id}>
|
||||
return (
|
||||
<div
|
||||
key={vi.key}
|
||||
role="listitem"
|
||||
data-index={vi.index}
|
||||
ref={rowVirtualizer.measureElement}
|
||||
style={{
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: '100%',
|
||||
transform: `translateY(${vi.start}px)`,
|
||||
paddingBottom: 8,
|
||||
}}
|
||||
>
|
||||
{multiSelect ? (
|
||||
<label
|
||||
className="tu-ex-picker-multi-row"
|
||||
style={{
|
||||
@@ -642,7 +679,6 @@ export default function ExercisePickerModal({
|
||||
width: '100%',
|
||||
textAlign: 'left',
|
||||
padding: '10px 12px',
|
||||
marginBottom: 8,
|
||||
borderRadius: '8px',
|
||||
border: picked ? '2px solid var(--accent)' : '1px solid var(--border)',
|
||||
background: 'var(--surface2)',
|
||||
@@ -659,34 +695,30 @@ export default function ExercisePickerModal({
|
||||
/>
|
||||
<div style={{ flex: 1, minWidth: 0 }}>{rowInner}</div>
|
||||
</label>
|
||||
</li>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<li key={ex.id}>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
onSelectExercise(ex)
|
||||
onClose()
|
||||
}}
|
||||
style={{
|
||||
width: '100%',
|
||||
textAlign: 'left',
|
||||
padding: '10px 12px',
|
||||
marginBottom: 8,
|
||||
borderRadius: '8px',
|
||||
border: '1px solid var(--border)',
|
||||
background: 'var(--surface2)',
|
||||
cursor: 'pointer',
|
||||
}}
|
||||
>
|
||||
{rowInner}
|
||||
</button>
|
||||
</li>
|
||||
) : (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
onSelectExercise(ex)
|
||||
onClose()
|
||||
}}
|
||||
style={{
|
||||
width: '100%',
|
||||
textAlign: 'left',
|
||||
padding: '10px 12px',
|
||||
borderRadius: '8px',
|
||||
border: '1px solid var(--border)',
|
||||
background: 'var(--surface2)',
|
||||
cursor: 'pointer',
|
||||
}}
|
||||
>
|
||||
{rowInner}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
{hasMore && (
|
||||
<div style={{ textAlign: 'center', marginTop: 12 }}>
|
||||
<button type="button" className="btn btn-secondary" disabled={loadingMore} onClick={loadMore}>
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
import React from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import {
|
||||
Eye,
|
||||
Pencil,
|
||||
Trash2,
|
||||
Globe,
|
||||
Users,
|
||||
Lock,
|
||||
CheckCircle2,
|
||||
Archive,
|
||||
CircleDot,
|
||||
FilePenLine,
|
||||
} from 'lucide-react'
|
||||
import ExerciseRichTextBlock from '../ExerciseRichTextBlock'
|
||||
import { coerceApiNameList } from '../../utils/sanitizeHtml'
|
||||
import { canUserRequestExerciseDelete } from '../../utils/exercisePermissions'
|
||||
|
||||
const VIS_LABELS = { official: 'Global', club: 'Verein', private: 'Privat' }
|
||||
const STATUS_LABELS = {
|
||||
draft: 'Entwurf',
|
||||
in_review: 'In Prüfung',
|
||||
approved: 'Freigegeben',
|
||||
archived: 'Archiv',
|
||||
}
|
||||
|
||||
function visibilityLabel(v) {
|
||||
return VIS_LABELS[v] || v || '—'
|
||||
}
|
||||
|
||||
function statusLabel(s) {
|
||||
return STATUS_LABELS[s] || s || '—'
|
||||
}
|
||||
|
||||
function exerciseFocusNames(ex) {
|
||||
const fromApi = coerceApiNameList(ex.focus_area_names)
|
||||
if (fromApi.length) return fromApi
|
||||
if (ex.focus_area) return [ex.focus_area]
|
||||
return []
|
||||
}
|
||||
|
||||
function exerciseCardClassName(exercise, userId) {
|
||||
const vis = exercise.visibility || 'private'
|
||||
const visKey = vis === 'official' || vis === 'club' || vis === 'private' ? vis : 'private'
|
||||
const mine = userId != null && Number(exercise.created_by) === Number(userId)
|
||||
return ['card', 'exercise-card', `exercise-card--scope-${visKey}`, mine ? 'exercise-card--mine' : '']
|
||||
.filter(Boolean)
|
||||
.join(' ')
|
||||
}
|
||||
|
||||
function ExerciseCardScopeStatus({ exercise }) {
|
||||
const v = exercise.visibility || 'private'
|
||||
const s = exercise.status || 'draft'
|
||||
const visLabel = visibilityLabel(v)
|
||||
const stLabel = statusLabel(s)
|
||||
const tip = `${visLabel} · ${stLabel}`
|
||||
let VisIcon = Lock
|
||||
if (v === 'official') VisIcon = Globe
|
||||
else if (v === 'club') VisIcon = Users
|
||||
let StatIcon = FilePenLine
|
||||
if (s === 'approved') StatIcon = CheckCircle2
|
||||
else if (s === 'archived') StatIcon = Archive
|
||||
else if (s === 'in_review') StatIcon = CircleDot
|
||||
return (
|
||||
<div
|
||||
className="exercise-card__meta-compact"
|
||||
title={tip}
|
||||
aria-label={`Sichtbarkeit: ${visLabel}. Status: ${stLabel}.`}
|
||||
>
|
||||
<span className="exercise-card__meta-glyph">
|
||||
<VisIcon size={15} strokeWidth={2} aria-hidden />
|
||||
</span>
|
||||
<span className="exercise-card__meta-sep" aria-hidden>
|
||||
·
|
||||
</span>
|
||||
<span className="exercise-card__meta-glyph">
|
||||
<StatIcon size={15} strokeWidth={2} aria-hidden />
|
||||
</span>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Kartenzeile in der Übungsliste (Fokus/Planung — keine Virtualisierung im Grid, dafür content-visibility in app.css).
|
||||
*/
|
||||
export default function ExerciseListCard({ exercise, user, selectedIds, toggleSelect, onDelete }) {
|
||||
const focusNames = exerciseFocusNames(exercise)
|
||||
const styleNames = coerceApiNameList(exercise.style_direction_names)
|
||||
const typeNames = coerceApiNameList(exercise.training_type_names)
|
||||
return (
|
||||
<div className={exerciseCardClassName(exercise, user?.id)}>
|
||||
<div className="exercise-card-layout exercise-card-layout--grow">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={selectedIds.has(Number(exercise.id))}
|
||||
onChange={() => toggleSelect(exercise.id)}
|
||||
aria-label={`„${(exercise.title || 'Übung').replace(/"/g, '')}“ auswählen`}
|
||||
className="exercise-card-layout__check"
|
||||
/>
|
||||
<div className="exercise-card__body exercise-card-body-flex">
|
||||
<h3 className="exercise-card-title">
|
||||
<Link to={`/exercises/${exercise.id}`}>{exercise.title}</Link>
|
||||
</h3>
|
||||
<div className="exercise-card-tags">
|
||||
{focusNames.map((name) => (
|
||||
<span key={`fa:${name}`} className="exercise-tag exercise-tag--accent">
|
||||
{name}
|
||||
</span>
|
||||
))}
|
||||
{styleNames.map((name) => (
|
||||
<span key={`sd:${name}`} className="exercise-tag exercise-tag--style">
|
||||
{name}
|
||||
</span>
|
||||
))}
|
||||
{typeNames.map((name) => (
|
||||
<span key={`tt:${name}`} className="exercise-tag exercise-tag--training">
|
||||
{name}
|
||||
</span>
|
||||
))}
|
||||
{(exercise.exercise_kind || '').toLowerCase().trim() === 'combination' ? (
|
||||
<span
|
||||
className="exercise-tag"
|
||||
style={{ background: 'var(--accent-soft)', color: 'var(--accent-dark)' }}
|
||||
>
|
||||
Kombination
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
{exercise.summary && String(exercise.summary).trim() ? (
|
||||
<div className="exercise-card-summary exercise-card-summary--rich">
|
||||
<ExerciseRichTextBlock
|
||||
html={exercise.summary}
|
||||
exerciseId={exercise.id}
|
||||
media={exercise.media || []}
|
||||
/>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
<div className="exercise-card__footer">
|
||||
<ExerciseCardScopeStatus exercise={exercise} />
|
||||
<div className="exercise-card__actions exercise-card__actions--icons">
|
||||
<Link
|
||||
to={`/exercises/${exercise.id}`}
|
||||
className="exercise-card__icon-btn"
|
||||
title="Ansehen"
|
||||
aria-label={`„${(exercise.title || 'Übung').replace(/"/g, '')}“ ansehen`}
|
||||
>
|
||||
<Eye size={18} strokeWidth={2} aria-hidden />
|
||||
</Link>
|
||||
<Link
|
||||
to={`/exercises/${exercise.id}/edit`}
|
||||
className="exercise-card__icon-btn"
|
||||
title="Bearbeiten"
|
||||
aria-label={`„${(exercise.title || 'Übung').replace(/"/g, '')}“ bearbeiten`}
|
||||
>
|
||||
<Pencil size={18} strokeWidth={2} aria-hidden />
|
||||
</Link>
|
||||
{canUserRequestExerciseDelete(user, exercise) ? (
|
||||
<button
|
||||
type="button"
|
||||
className="exercise-card__icon-btn exercise-card__icon-btn--danger"
|
||||
title="Löschen"
|
||||
aria-label={`„${(exercise.title || 'Übung').replace(/"/g, '')}“ löschen`}
|
||||
onClick={() => onDelete(exercise)}
|
||||
>
|
||||
<Trash2 size={18} strokeWidth={2} aria-hidden />
|
||||
</button>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user