feat(02-03): add CompletedToggle to show/hide completed tasks
- Create CompletedToggle component with checkbox UI - Add showCompleted URL param to +page.server.ts load function - Update +page.svelte to sync preferences with URL - Toggle state persists in localStorage via preferences store - Clicking toggle updates URL and invalidates data for server filter
This commit is contained in:
@@ -2,11 +2,13 @@ import type { PageServerLoad, Actions } from './$types';
|
||||
import { fail } from '@sveltejs/kit';
|
||||
import { entryRepository } from '$lib/server/db/repository';
|
||||
|
||||
export const load: PageServerLoad = async () => {
|
||||
const entries = entryRepository.getOrdered({ showCompleted: false });
|
||||
export const load: PageServerLoad = async ({ url }) => {
|
||||
const showCompleted = url.searchParams.get('showCompleted') === 'true';
|
||||
const entries = entryRepository.getOrdered({ showCompleted });
|
||||
|
||||
return {
|
||||
entries
|
||||
entries,
|
||||
showCompleted
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user