feat: enhance exercise filtering and UI components
- Introduced multi-select functionality for filtering exercises by focus areas, style directions, training types, target groups, and skills, allowing users to select multiple options. - Updated the ExercisesListPage to utilize the new multi-select component, improving the user experience for filtering exercises. - Enhanced backend filtering logic to support new array-based query parameters, ensuring efficient handling of multiple filter criteria. - Adjusted CSS styles for better layout and usability of the exercise filters.
This commit is contained in:
1 parent
025b161d2f
commit
fd2009294b
5 files changed
+433
-90
No files matched your search
@@ -213,9 +213,17 @@ export async function deleteMethod(id) {
|
||||
export async function listExercises(filters = {}) {
|
||||
const q = new URLSearchParams()
|
||||
Object.entries(filters).forEach(([k, v]) => {
|
||||
if (v !== undefined && v !== null && String(v).trim() !== '') {
|
||||
q.set(k, String(v))
|
||||
if (v === undefined || v === null) return
|
||||
if (Array.isArray(v)) {
|
||||
if (v.length === 0) return
|
||||
v.forEach((item) => {
|
||||
if (item !== '' && item !== undefined && item !== null && String(item).trim() !== '') {
|
||||
q.append(k, String(item))
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
if (String(v).trim() !== '') q.set(k, String(v))
|
||||
})
|
||||
const query = q.toString()
|
||||
return request(`/api/exercises${query ? '?' + query : ''}`)
|
||||
|
||||
Reference in new issue
Block a user