diff --git a/src/lib/components/wizard/StepRowFilter.svelte b/src/lib/components/wizard/StepRowFilter.svelte index 4bb47b2..d9731a5 100644 --- a/src/lib/components/wizard/StepRowFilter.svelte +++ b/src/lib/components/wizard/StepRowFilter.svelte @@ -18,6 +18,8 @@ let sortColumn = $state(null); let sortDirection = $state<'asc' | 'desc'>('asc'); + const ROW_LIMIT = 200; + // Fetch and process data from the Google Sheet async function fetchAndProcessData() { isLoading = true; @@ -70,9 +72,9 @@ birthday: mapping.birthday !== -1 ? row[mapping.birthday] || '' : '', pictureUrl, alreadyPrinted, - _rowIndex: index + 2, // Sheet rows are 1-based, plus header + _rowIndex: index + 2, _valid: isValid, - _checked: isValid && !alreadyPrinted + _checked: false }; }) .filter((row): row is RowData => row !== null); @@ -97,7 +99,6 @@ if (row && row._valid) { row._checked = !row._checked; } - console.log("toggleRow", id, row?._checked); } // Function to toggle all valid rows @@ -107,7 +108,11 @@ rows.forEach((row) => { if (row._valid && !row.alreadyPrinted) { - row._checked = shouldCheck; + if (shouldCheck && selectedCount < ROW_LIMIT) { + row._checked = true; + } else { + row._checked = false; + } } }); } @@ -162,8 +167,10 @@

Filter and Select Rows

- Review your data and select which rows to include. Invalid or already printed rows are - disabled. + Review your data and select which rows to include. Select a batch of max 200 items by using the top checkbox. +

+

+ Already printed or invalid data is marked in the status column.

{#if $selectedSheet?.id}

@@ -174,7 +181,7 @@ rel="noopener noreferrer" class="text-blue-600 underline hover:text-blue-800" > - Open Google Sheet + Open the spreadsheet

{/if} @@ -307,7 +314,7 @@ type="checkbox" class="h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 disabled:cursor-not-allowed disabled:bg-gray-200" checked={row._checked} - disabled={!row._valid} + disabled={!row._valid || (selectedCount >= ROW_LIMIT && !row._checked)} onchange={() => toggleRow(row.id)} /> diff --git a/src/lib/components/wizard/StepSheetSearch.svelte b/src/lib/components/wizard/StepSheetSearch.svelte index 5910c40..badc088 100644 --- a/src/lib/components/wizard/StepSheetSearch.svelte +++ b/src/lib/components/wizard/StepSheetSearch.svelte @@ -12,7 +12,7 @@ let hasSearched = $state(false); let recentSheets = $state([]); - const RECENT_SHEETS_KEY = 'recent-sheets'; + const RECENT_SHEETS_KEY = 'recentSheets'; onMount(() => { ensureToken(); diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 6a06a7b..c55e327 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -7,7 +7,6 @@ onMount(() => { initGoogleClients(() => { - // You can add any logic here to run after the client is initialized console.log('Google API client initialized'); }); });