Enhance exercise card interactivity and toolbar functionality
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 41s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m20s
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 41s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m20s
- Added clickable behavior to exercise card body, allowing users to navigate to exercise details by clicking anywhere on the card. - Introduced keyboard accessibility for exercise cards, enabling navigation via Enter and Space keys. - Updated ExerciseListBulkToolbar to include a new button for saving selected exercises as a module, enhancing bulk action capabilities. - Improved CSS styles for clickable exercise card body to indicate interactivity.
This commit is contained in:
1 parent
e50c18f92e
commit
ef4dd93324
6 files changed
+459
-11
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import React from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { Link, useNavigate } from 'react-router-dom'
|
||||
import {
|
||||
Eye,
|
||||
Pencil,
|
||||
@@ -131,10 +131,27 @@ function ExerciseCardScopeStatus({ exercise }) {
|
||||
/**
|
||||
* 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 }) {
|
||||
export default function ExerciseListCard({ exercise, user, selectedIds, toggleSelect, onDelete, onPeek }) {
|
||||
const navigate = useNavigate()
|
||||
const focusNames = exerciseFocusNames(exercise)
|
||||
const styleNames = coerceApiNameList(exercise.style_direction_names)
|
||||
const typeNames = coerceApiNameList(exercise.training_type_names)
|
||||
const titleText = (exercise.title || 'Übung').replace(/"/g, '')
|
||||
|
||||
const openExercisePage = () => navigate(`/exercises/${exercise.id}`)
|
||||
|
||||
const handleBodyClick = (e) => {
|
||||
if (e.target.closest('a, button, input, textarea, select, label, [role="button"]')) return
|
||||
openExercisePage()
|
||||
}
|
||||
|
||||
const handleBodyKeyDown = (e) => {
|
||||
if (e.key !== 'Enter' && e.key !== ' ') return
|
||||
if (e.target.closest('a, button, input, textarea, select, label, [role="button"]')) return
|
||||
e.preventDefault()
|
||||
openExercisePage()
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={exerciseCardClassName(exercise, user?.id)}>
|
||||
<div className="exercise-card-layout exercise-card-layout--grow">
|
||||
@@ -142,12 +159,21 @@ export default function ExerciseListCard({ exercise, user, selectedIds, toggleSe
|
||||
type="checkbox"
|
||||
checked={selectedIds.has(Number(exercise.id))}
|
||||
onChange={() => toggleSelect(exercise.id)}
|
||||
aria-label={`„${(exercise.title || 'Übung').replace(/"/g, '')}“ auswählen`}
|
||||
aria-label={`„${titleText}“ auswählen`}
|
||||
className="exercise-card-layout__check"
|
||||
/>
|
||||
<div className="exercise-card__body exercise-card-body-flex">
|
||||
<div
|
||||
className="exercise-card__body exercise-card-body-flex exercise-card__body--clickable"
|
||||
role="link"
|
||||
tabIndex={0}
|
||||
onClick={handleBodyClick}
|
||||
onKeyDown={handleBodyKeyDown}
|
||||
aria-label={`„${titleText}“ öffnen`}
|
||||
>
|
||||
<h3 className="exercise-card-title">
|
||||
<Link to={`/exercises/${exercise.id}`}>{exercise.title}</Link>
|
||||
<Link to={`/exercises/${exercise.id}`} onClick={(e) => e.stopPropagation()}>
|
||||
{exercise.title}
|
||||
</Link>
|
||||
</h3>
|
||||
<div className="exercise-card-tags">
|
||||
{focusNames.map((name) => (
|
||||
@@ -191,14 +217,15 @@ export default function ExerciseListCard({ exercise, user, selectedIds, toggleSe
|
||||
<ExerciseCardContentStats exercise={exercise} />
|
||||
</div>
|
||||
<div className="exercise-card__actions exercise-card__actions--icons">
|
||||
<Link
|
||||
to={`/exercises/${exercise.id}`}
|
||||
<button
|
||||
type="button"
|
||||
className="exercise-card__icon-btn"
|
||||
title="Ansehen"
|
||||
aria-label={`„${(exercise.title || 'Übung').replace(/"/g, '')}“ ansehen`}
|
||||
title="Vorschau"
|
||||
aria-label={`„${titleText}“ in Vorschau anzeigen`}
|
||||
onClick={() => onPeek?.(exercise)}
|
||||
>
|
||||
<Eye size={18} strokeWidth={2} aria-hidden />
|
||||
</Link>
|
||||
</button>
|
||||
<Link
|
||||
to={`/exercises/${exercise.id}/edit`}
|
||||
className="exercise-card__icon-btn"
|
||||
|
||||
Reference in new issue
Block a user