feat: update version and enhance exercise filtering features
Deploy Development / deploy (push) Successful in 45s
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) Failing after 29s
Deploy Development / deploy (push) Successful in 45s
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) Failing after 29s
- Bumped application version to 0.8.40 and updated module versions accordingly. - Introduced new focus area filtering options in the ExercisesListPage, allowing users to include or exclude exercises based on specified focus areas. - Added utility functions for deduplicating and merging focus area IDs to improve filtering logic. - Enhanced the ExercisePickerModal and ExercisesListPage components to support new focus rules and improve user experience with focus area selections.
This commit is contained in:
1 parent
cfd40889ac
commit
518918a6e5
7 files changed
+357
-41
No files matched your search
@@ -16,6 +16,7 @@ import api from '../utils/api'
|
||||
import { useAuth } from '../context/AuthContext'
|
||||
import { SKILL_LEVEL_OPTIONS } from '../constants/skillLevels'
|
||||
import MultiSelectCombo from '../components/MultiSelectCombo'
|
||||
import ExerciseFocusRulePicker from '../components/ExerciseFocusRulePicker'
|
||||
import ExerciseProgressionGraphPanel from '../components/ExerciseProgressionGraphPanel'
|
||||
import PageSectionNav from '../components/PageSectionNav'
|
||||
import {
|
||||
@@ -221,11 +222,33 @@ function ExercisesListPage() {
|
||||
const filterChips = useMemo(() => {
|
||||
const chips = []
|
||||
|
||||
;(filters.focus_rules || []).forEach((r) => {
|
||||
const opt = focusOptions.find((o) => String(o.id) === String(r.focus_area_id))
|
||||
const verb = r.mode === 'forbid' ? 'Fokus ohne' : 'Fokus mit'
|
||||
chips.push({
|
||||
key: `fr-${r.key}`,
|
||||
label: `${verb}: ${opt?.label ?? r.focus_area_id}`,
|
||||
onRemove: () =>
|
||||
setFilters((prev) => ({
|
||||
...prev,
|
||||
focus_rules: prev.focus_rules.filter((x) => x.key !== r.key),
|
||||
})),
|
||||
})
|
||||
})
|
||||
|
||||
if (filters.focus_only_without) {
|
||||
chips.push({
|
||||
key: 'focus-only-none',
|
||||
label: 'Nur ohne Fokusbereich',
|
||||
onRemove: () => setFilters((prev) => ({ ...prev, focus_only_without: false })),
|
||||
})
|
||||
}
|
||||
|
||||
;(filters.focus_area_ids || []).forEach((id) => {
|
||||
const opt = focusOptions.find((o) => String(o.id) === String(id))
|
||||
chips.push({
|
||||
key: `fa-${id}`,
|
||||
label: `Fokus: ${opt?.label ?? id}`,
|
||||
label: `Fokus (ODER, älter): ${opt?.label ?? id}`,
|
||||
onRemove: () =>
|
||||
setFilters((prev) => ({
|
||||
...prev,
|
||||
@@ -385,6 +408,19 @@ function ExercisesListPage() {
|
||||
const n = (v) => (v === '' || v == null ? undefined : Number(v))
|
||||
const ids = (arr) =>
|
||||
Array.isArray(arr) && arr.length ? arr.map((x) => Number(x)).filter((x) => !Number.isNaN(x)) : undefined
|
||||
const mustInc = []
|
||||
const mustExc = []
|
||||
for (const r of filters.focus_rules || []) {
|
||||
const id = Number(r.focus_area_id)
|
||||
if (!Number.isFinite(id) || id < 1) continue
|
||||
if (r.mode === 'forbid') mustExc.push(id)
|
||||
else mustInc.push(id)
|
||||
}
|
||||
const uniqNums = (arr) => [...new Set(arr)]
|
||||
if (mustInc.length) q.focus_area_must_include_ids = uniqNums(mustInc)
|
||||
if (mustExc.length) q.focus_area_must_exclude_ids = uniqNums(mustExc)
|
||||
if (filters.focus_only_without) q.focus_only_without_focus_areas = true
|
||||
|
||||
const fa = ids(filters.focus_area_ids)
|
||||
if (fa?.length) q.focus_area_ids = fa
|
||||
const sd = ids(filters.style_direction_ids)
|
||||
@@ -858,22 +894,21 @@ function ExercisesListPage() {
|
||||
</div>
|
||||
<div className="admin-modal-sheet__body exercise-filter-modal__scroll">
|
||||
<p className="muted" style={{ marginTop: 0, marginBottom: '14px' }}>
|
||||
Zwischen den Bereichen gilt <strong>UND</strong>. Innerhalb eines Feldes werden mehrere Einträge mit{' '}
|
||||
<strong>ODER</strong> verknüpft.
|
||||
Zwischen den Bereichen gilt <strong>UND</strong>. Fokusbereiche: mehrere „+ mit“ bedeuten alle müssen
|
||||
gesetzt sein; „− ohne“ schließt Übungen aus, die diesen Fokus zusätzlich haben. Stilrichtung /
|
||||
Trainingsstil / Zielgruppe: mehrere Werte pro Feld mit <strong>ODER</strong>.
|
||||
</p>
|
||||
|
||||
<section className="exercise-filter-section">
|
||||
<h4 className="exercise-filter-section-title">Zuordnung</h4>
|
||||
<div className="exercise-filters-modal-grid">
|
||||
<div>
|
||||
<label className="form-label">Fokus</label>
|
||||
<MultiSelectCombo
|
||||
value={filters.focus_area_ids}
|
||||
onChange={(v) => setFilters({ ...filters, focus_area_ids: v })}
|
||||
options={focusOptions}
|
||||
placeholder="Fokus suchen oder „▼ Alle“ …"
|
||||
/>
|
||||
</div>
|
||||
<ExerciseFocusRulePicker
|
||||
focusOptions={focusOptions}
|
||||
focusRules={filters.focus_rules}
|
||||
focusOnlyWithout={filters.focus_only_without}
|
||||
legacyFocusAreaIds={filters.focus_area_ids}
|
||||
onPatch={(patch) => setFilters((prev) => ({ ...prev, ...patch }))}
|
||||
/>
|
||||
<div className="exercise-filters-modal-grid" style={{ marginTop: '14px' }}>
|
||||
<div>
|
||||
<label className="form-label">Stilrichtung</label>
|
||||
<MultiSelectCombo
|
||||
@@ -983,11 +1018,26 @@ function ExercisesListPage() {
|
||||
</div>
|
||||
</div>
|
||||
<div style={{ marginTop: '14px', display: 'flex', flexDirection: 'column', gap: '12px' }}>
|
||||
<label style={{ display: 'flex', alignItems: 'center', gap: '10px', cursor: 'pointer' }}>
|
||||
<label
|
||||
style={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: '10px',
|
||||
cursor: filters.focus_only_without ? 'not-allowed' : 'pointer',
|
||||
opacity: filters.focus_only_without ? 0.55 : 1,
|
||||
}}
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
disabled={!!filters.focus_only_without}
|
||||
checked={!!filters.exclude_without_focus}
|
||||
onChange={(e) => setFilters({ ...filters, exclude_without_focus: e.target.checked })}
|
||||
onChange={(e) =>
|
||||
setFilters((prev) => ({
|
||||
...prev,
|
||||
exclude_without_focus: e.target.checked,
|
||||
...(e.target.checked ? { focus_only_without: false } : {}),
|
||||
}))
|
||||
}
|
||||
/>
|
||||
<span>Übungen ohne Fokusbereich ausblenden</span>
|
||||
</label>
|
||||
|
||||
Reference in new issue
Block a user