feat: enhance dashboard and exercises list with new filtering and UI components
Deploy Development / deploy (push) Successful in 34s
Test Suite / pytest-backend (push) Successful in 6s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Successful in 23s

- Added a new filter option in the list_exercises function to allow users to view exercises created by the current profile.
- Introduced new CSS styles for the dashboard, including KPI tiles and training previews, improving layout and user experience.
- Updated the Dashboard component to fetch and display statistics related to user-created exercises, enhancing visibility of personal metrics.
- Enhanced the ExercisesListPage to support filtering based on user-specific exercise creation, improving data relevance for users.
This commit is contained in:
Lars committed 2026-05-07 08:33:50 +02:00
1 parent 3210796139
commit 3bf0af001a
4 files changed
+481 -131

No files matched your search

+32 -2
View File
@@ -123,10 +123,32 @@ function levelOptionShort(levelStr) {
return o ? String(o.level) : String(levelStr)
}
function exerciseListFiltersWithDashboardUrl(mergedFilters) {
try {
const sp = new URLSearchParams(window.location.search)
if (sp.get('status') !== 'draft') return mergedFilters
return {
...mergedFilters,
status_rules: [{ key: 'url-dashboard-draft', id: 'draft', mode: 'require' }],
}
} catch {
return mergedFilters
}
}
function ExercisesListPage() {
const { user, checkAuth } = useAuth()
const isPlatformAdmin = user?.role === 'admin' || user?.role === 'superadmin'
const [mineOnly, setMineOnly] = useState(() => {
try {
const sp = new URLSearchParams(window.location.search)
return sp.get('mine') === '1' || sp.get('created_by_me') === '1'
} catch {
return false
}
})
const [exercises, setExercises] = useState([])
const [catalogs, setCatalogs] = useState({
focusAreas: [],
@@ -169,7 +191,14 @@ function ExercisesListPage() {
useEffect(() => {
if (!user?.id) return
if (prefsAppliedRef.current) return
setFilters(mergeExerciseListPrefsFromApi(user.exercise_list_prefs))
const merged = mergeExerciseListPrefsFromApi(user.exercise_list_prefs)
setFilters(exerciseListFiltersWithDashboardUrl(merged))
try {
const sp = new URLSearchParams(window.location.search)
if (sp.get('mine') === '1' || sp.get('created_by_me') === '1') setMineOnly(true)
} catch {
/* ignore */
}
prefsAppliedRef.current = true
}, [user?.id, user?.exercise_list_prefs])
@@ -445,8 +474,9 @@ function ExercisesListPage() {
if (filters.include_archived) q.include_archived = true
if (debouncedSearch) q.search = debouncedSearch
if (debouncedAiSearch) q.ai_search = debouncedAiSearch
if (mineOnly) q.created_by_me = true
return q
}, [filters, debouncedSearch, debouncedAiSearch])
}, [filters, debouncedSearch, debouncedAiSearch, mineOnly])
useEffect(() => {
setSelectedIds(new Set())