fix(discover): guard active card with {#if currentBook} to fix TS errors; use $state for cardEl bind
All checks were successful
CI / Backend (pull_request) Successful in 45s
CI / UI (pull_request) Successful in 26s
Release / Test backend (push) Successful in 23s
CI / UI (push) Successful in 39s
CI / Backend (push) Successful in 42s
Release / Check ui (push) Successful in 28s
Release / Docker / caddy (push) Successful in 54s
Release / Docker / runner (push) Successful in 2m12s
Release / Docker / ui (push) Successful in 1m58s
Release / Docker / backend (push) Successful in 3m16s
Release / Gitea Release (push) Successful in 13s

This commit is contained in:
Admin
2026-04-02 17:48:25 +05:00
parent 9cb11bc5e4
commit eac9358c6f

View File

@@ -114,7 +114,7 @@
); );
const rotation = $derived(isDragging ? Math.max(-18, Math.min(18, offsetX / 12)) : 0); const rotation = $derived(isDragging ? Math.max(-18, Math.min(18, offsetX / 12)) : 0);
let cardEl: HTMLDivElement | null = null; let cardEl = $state<HTMLDivElement | null>(null);
function onPointerDown(e: PointerEvent) { function onPointerDown(e: PointerEvent) {
if (animating || !currentBook) return; if (animating || !currentBook) return;
@@ -446,6 +446,7 @@
{/if} {/if}
<!-- Active card --> <!-- Active card -->
{#if currentBook}
<div <div
bind:this={cardEl} bind:this={cardEl}
class="absolute inset-0 rounded-2xl overflow-hidden shadow-2xl cursor-grab active:cursor-grabbing z-10" class="absolute inset-0 rounded-2xl overflow-hidden shadow-2xl cursor-grab active:cursor-grabbing z-10"
@@ -522,6 +523,7 @@
<span class="text-(--color-muted) font-black text-lg tracking-widest">NOPE</span> <span class="text-(--color-muted) font-black text-lg tracking-widest">NOPE</span>
</div> </div>
</div> </div>
{/if}
</div> </div>
<!-- Action buttons --> <!-- Action buttons -->