Fixed sheet search

This commit is contained in:
Roman Krček
2025-08-06 13:47:37 +02:00
parent d8b4eea3ef
commit e9987009c7
2 changed files with 8 additions and 8 deletions

View File

@@ -72,7 +72,7 @@
selectedSheet.set(sheetData); selectedSheet.set(sheetData);
} }
let canProceed = $derived($selectedSheet !== null); let canProceed = $derived($selectedSheet.id !== '');
</script> </script>
<div class="p-6"> <div class="p-6">
@@ -137,8 +137,8 @@
<div class="space-y-3"> <div class="space-y-3">
{#each searchResults as sheet} {#each searchResults as sheet}
<div <div
class="cursor-pointer rounded-lg border p-4 transition-colors hover:bg-gray-50 {$selectedSheet?.spreadsheetId === class="cursor-pointer rounded-lg border p-4 transition-colors hover:bg-gray-50 {$selectedSheet?.id ===
(sheet.spreadsheetId || sheet.id) (sheet.id || sheet.id)
? 'border-blue-500 bg-blue-50' ? 'border-blue-500 bg-blue-50'
: 'border-gray-200'}" : 'border-gray-200'}"
onclick={() => handleSelectSheet(sheet)} onclick={() => handleSelectSheet(sheet)}
@@ -159,7 +159,7 @@
<img src={sheet.iconLink} alt="Sheet icon" class="my-2 mr-2 h-5 w-5" /> <img src={sheet.iconLink} alt="Sheet icon" class="my-2 mr-2 h-5 w-5" />
{/if} {/if}
{#if $selectedSheet?.spreadsheetId === (sheet.spreadsheetId || sheet.id)} {#if $selectedSheet?.id === (sheet.id || sheet.id)}
<svg class="h-5 w-5 text-blue-600 my-2" fill="currentColor" viewBox="0 0 20 20"> <svg class="h-5 w-5 text-blue-600 my-2" fill="currentColor" viewBox="0 0 20 20">
<path <path
fill-rule="evenodd" fill-rule="evenodd"
@@ -201,8 +201,8 @@
<div class="space-y-3"> <div class="space-y-3">
{#each recentSheets as sheet} {#each recentSheets as sheet}
<div <div
class="cursor-pointer rounded-lg border p-4 transition-colors hover:bg-gray-50 {$selectedSheet?.spreadsheetId === class="cursor-pointer rounded-lg border p-4 transition-colors hover:bg-gray-50 {$selectedSheet?.id ===
(sheet.spreadsheetId || sheet.id) (sheet.id || sheet.id)
? 'border-blue-500 bg-blue-50' ? 'border-blue-500 bg-blue-50'
: 'border-gray-200'}" : 'border-gray-200'}"
onclick={() => handleSelectSheet(sheet)} onclick={() => handleSelectSheet(sheet)}
@@ -223,7 +223,7 @@
<img src={sheet.iconLink} alt="Sheet icon" class="mr-2 h-5 w-5" /> <img src={sheet.iconLink} alt="Sheet icon" class="mr-2 h-5 w-5" />
{/if} {/if}
{#if $selectedSheet?.spreadsheetId === (sheet.spreadsheetId || sheet.id)} {#if $selectedSheet.id === sheet.id}
<svg class="h-5 w-5 text-blue-600" fill="currentColor" viewBox="0 0 20 20"> <svg class="h-5 w-5 text-blue-600" fill="currentColor" viewBox="0 0 20 20">
<path <path
fill-rule="evenodd" fill-rule="evenodd"

View File

@@ -90,7 +90,7 @@ export const pictures = writable<Record<string, PictureBlobInfoType>>({});
export const CropRects = writable<Record<string, CropType>>({}); export const CropRects = writable<Record<string, CropType>>({});
// Store and hold the selected sheet // Store and hold the selected sheet
export const selectedSheet = writable<SheetInfoType | null>(null); export const selectedSheet = writable<SheetInfoType>({ id: '', name: '', webViewLink: '' });
// Card details for generation // Card details for generation
export const cardDetails = writable<CardDetailsType | null>(null); export const cardDetails = writable<CardDetailsType | null>(null);