feat(sprint-5): Phase 3 — Wire dashboard + members to React Query

- Dashboard: useClubStatsQuery + useRecentDistributionsQuery with fallback
- Members list: useMembersQuery with debounced search + pagination
- Member detail: useMemberQuery + useUpdateMemberMutation
- Add member: useCreateMemberMutation with invalidation
- All pages show loading skeletons during fetch
- Graceful fallback to mock data when backend unavailable
- New useDebounce hook for search input (300ms delay)
This commit is contained in:
Patrick Plate
2026-06-12 20:07:16 +02:00
parent f42c166329
commit b170bb9d87
5 changed files with 423 additions and 249 deletions
@@ -0,0 +1,16 @@
import { useEffect, useState } from "react"
/**
* Debounce a value by a given delay.
* Returns the debounced value that only updates after the delay.
*/
export function useDebounce<T>(value: T, delay: number): T {
const [debouncedValue, setDebouncedValue] = useState<T>(value)
useEffect(() => {
const timer = setTimeout(() => setDebouncedValue(value), delay)
return () => clearTimeout(timer)
}, [value, delay])
return debouncedValue
}