feat: enhance dashboard and exercises list UI with new styles and filtering options
Deploy Development / deploy (push) Successful in 37s
Test Suite / pytest-backend (push) Successful in 7s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 7s
Test Suite / playwright-tests (push) Successful in 23s
Deploy Development / deploy (push) Successful in 37s
Test Suite / pytest-backend (push) Successful in 7s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 7s
Test Suite / playwright-tests (push) Successful in 23s
- Added responsive styles for dashboard KPI cards and exercise search actions, improving layout on smaller screens. - Refactored the Dashboard component to streamline error handling and loading states for better user experience. - Updated ExercisesListPage to include new filtering options for user-created exercises, enhancing data relevance. - Improved overall CSS organization and introduced new classes for better styling consistency across components.
This commit is contained in:
1 parent
3bf0af001a
commit
40a3b4b8e6
3 files changed
+163
-67
No files matched your search
@@ -123,16 +123,29 @@ function levelOptionShort(levelStr) {
|
||||
return o ? String(o.level) : String(levelStr)
|
||||
}
|
||||
|
||||
function exerciseListFiltersWithDashboardUrl(mergedFilters) {
|
||||
function applyDashboardExerciseListUrl(mergedFromPrefs) {
|
||||
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' }],
|
||||
const mine = sp.get('mine') === '1' || sp.get('created_by_me') === '1'
|
||||
const statusDraft = sp.get('status') === 'draft'
|
||||
|
||||
if (mine) {
|
||||
const next = { ...INITIAL_EXERCISE_LIST_FILTERS }
|
||||
if (statusDraft) {
|
||||
next.status_rules = [{ key: 'url-dashboard-draft', id: 'draft', mode: 'require' }]
|
||||
}
|
||||
return next
|
||||
}
|
||||
|
||||
if (statusDraft) {
|
||||
return {
|
||||
...mergedFromPrefs,
|
||||
status_rules: [{ key: 'url-dashboard-draft', id: 'draft', mode: 'require' }],
|
||||
}
|
||||
}
|
||||
return mergedFromPrefs
|
||||
} catch {
|
||||
return mergedFilters
|
||||
return mergedFromPrefs
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,7 +205,7 @@ function ExercisesListPage() {
|
||||
if (!user?.id) return
|
||||
if (prefsAppliedRef.current) return
|
||||
const merged = mergeExerciseListPrefsFromApi(user.exercise_list_prefs)
|
||||
setFilters(exerciseListFiltersWithDashboardUrl(merged))
|
||||
setFilters(applyDashboardExerciseListUrl(merged))
|
||||
try {
|
||||
const sp = new URLSearchParams(window.location.search)
|
||||
if (sp.get('mine') === '1' || sp.get('created_by_me') === '1') setMineOnly(true)
|
||||
@@ -270,6 +283,14 @@ function ExercisesListPage() {
|
||||
const filterChips = useMemo(() => {
|
||||
const chips = []
|
||||
|
||||
if (mineOnly) {
|
||||
chips.push({
|
||||
key: 'mine-only',
|
||||
label: 'Nur von mir erstellt',
|
||||
onRemove: () => setMineOnly(false),
|
||||
})
|
||||
}
|
||||
|
||||
pushCatalogRuleFilterChips(chips, 'focus_rules', filters.focus_rules, focusOptions, 'Fokus', setFilters)
|
||||
|
||||
if (filters.focus_only_without) {
|
||||
@@ -410,6 +431,7 @@ function ExercisesListPage() {
|
||||
|
||||
return chips
|
||||
}, [
|
||||
mineOnly,
|
||||
filters,
|
||||
focusOptions,
|
||||
styleOptions,
|
||||
@@ -625,7 +647,10 @@ function ExercisesListPage() {
|
||||
}
|
||||
}
|
||||
|
||||
const resetAllFilters = useCallback(() => setFilters({ ...INITIAL_EXERCISE_LIST_FILTERS }), [])
|
||||
const resetAllFilters = useCallback(() => {
|
||||
setMineOnly(false)
|
||||
setFilters({ ...INITIAL_EXERCISE_LIST_FILTERS })
|
||||
}, [])
|
||||
|
||||
const handleSaveExerciseFilterPrefs = useCallback(async () => {
|
||||
const uid = user?.id
|
||||
@@ -833,20 +858,30 @@ function ExercisesListPage() {
|
||||
list="exercise-search-titles"
|
||||
enterKeyHint="search"
|
||||
/>
|
||||
<div className="exercise-search-bar__actions">
|
||||
<button type="button" className="btn btn-secondary exercise-filter-trigger" onClick={() => setFilterModalOpen(true)}>
|
||||
Filter
|
||||
{filterChips.length > 0 ? (
|
||||
<span className="exercise-filter-badge" aria-hidden>
|
||||
{filterChips.length}
|
||||
</span>
|
||||
) : null}
|
||||
</button>
|
||||
{filterChips.length > 0 ? (
|
||||
<button type="button" className="btn" onClick={resetAllFilters}>
|
||||
Alle entfernen
|
||||
<div className="exercise-search-bar__actions exercise-search-bar__actions--split">
|
||||
<div className="exercise-search-bar__actions-main">
|
||||
<button
|
||||
type="button"
|
||||
className={'btn btn-secondary exercise-mine-toggle' + (mineOnly ? ' exercise-mine-toggle--active' : '')}
|
||||
onClick={() => setMineOnly((v) => !v)}
|
||||
title="Nur Übungen, die mit deinem Profil als Ersteller gespeichert sind"
|
||||
>
|
||||
Meine Übungen
|
||||
</button>
|
||||
) : null}
|
||||
<button type="button" className="btn btn-secondary exercise-filter-trigger" onClick={() => setFilterModalOpen(true)}>
|
||||
Filter
|
||||
{filterChips.length > 0 ? (
|
||||
<span className="exercise-filter-badge" aria-hidden>
|
||||
{filterChips.length}
|
||||
</span>
|
||||
) : null}
|
||||
</button>
|
||||
{filterChips.length > 0 ? (
|
||||
<button type="button" className="btn" onClick={resetAllFilters}>
|
||||
Alle entfernen
|
||||
</button>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
{filterChips.length > 0 ? (
|
||||
<div className="exercise-filter-chips-row" role="list" aria-label="Aktive Filter">
|
||||
|
||||
Reference in new issue
Block a user