Got rid of more old APIs
This commit is contained in:
3
.github/copilot-instructions.md
vendored
3
.github/copilot-instructions.md
vendored
@@ -1,4 +1,7 @@
|
||||
GitHub Copilot Instructions for This Repository
|
||||
|
||||
If you have any questions, always ask me first.
|
||||
|
||||
Use Svelte 5 runes exclusively
|
||||
|
||||
Declare reactive state with $state(); derive values with $derived(); run side-effect logic with $effect() etc.
|
||||
|
||||
@@ -197,7 +197,7 @@
|
||||
|
||||
try {
|
||||
// Send all emails in batch
|
||||
const response = await fetch('/private/api/gmail', {
|
||||
const response = await fetch('/private/api/google/gmail', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import { ScanState, defaultTicketData } from '$lib/types/types';
|
||||
|
||||
let { data } = $props();
|
||||
let scanned_id = $state<string>("");
|
||||
let scanned_id = $state<string>('');
|
||||
let ticket_data = $state<TicketData>(defaultTicketData);
|
||||
let scan_state = $state<ScanState>(ScanState.scanning);
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
}
|
||||
|
||||
let events = $state<Event[]>([]);
|
||||
let selectedEventId = $state<string>("");
|
||||
let selectedEventId = $state<string>('');
|
||||
let isLoadingEvents = $state(true);
|
||||
let eventsError = $state("");
|
||||
let eventsError = $state('');
|
||||
|
||||
onMount(async () => {
|
||||
await loadEvents();
|
||||
@@ -54,16 +54,16 @@
|
||||
|
||||
// Process a scanned QR code
|
||||
$effect(() => {
|
||||
if (scanned_id === "") return;
|
||||
if (scanned_id === '') return;
|
||||
scan_state = ScanState.scanning;
|
||||
|
||||
console.log("Scanned ID:", scanned_id);
|
||||
console.log('Scanned ID:', scanned_id);
|
||||
|
||||
data.supabase
|
||||
.from('participants')
|
||||
.select(`*, event ( id, name ), scanned_by ( id, display_name )`)
|
||||
.eq('id', scanned_id)
|
||||
.then(response => {
|
||||
.then((response) => {
|
||||
if (response.data && response.data.length > 0) {
|
||||
const participant = response.data[0];
|
||||
ticket_data = participant;
|
||||
@@ -84,38 +84,34 @@
|
||||
|
||||
// Reset the scanned_id after 3 seconds to allow for a new scan
|
||||
setTimeout(() => {
|
||||
scanned_id = "";
|
||||
scanned_id = '';
|
||||
}, 3000);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="mx-auto p-4">
|
||||
<h1 class="text-2xl font-bold mb-6 text-center">Code Scanner</h1>
|
||||
<h1 class="text-2xl font-bold mb-4 mt-2 text-center">Code Scanner</h1>
|
||||
|
||||
<!-- Event Selector -->
|
||||
<div class="rounded-lg border border-gray-300 p-4 mb-4">
|
||||
<h2 class="text-lg font-semibold mb-3">Select Event</h2>
|
||||
<div class="mb-4 rounded-lg border border-gray-300 p-4">
|
||||
<h2 class="mb-3 text-lg font-semibold">Select Event</h2>
|
||||
{#if isLoadingEvents}
|
||||
<div class="flex items-center justify-center h-10">
|
||||
<div class="animate-spin h-5 w-5 border-2 border-gray-500 rounded-full border-t-transparent"></div>
|
||||
<div class="flex h-10 items-center justify-center">
|
||||
<div
|
||||
class="h-5 w-5 animate-spin rounded-full border-2 border-gray-500 border-t-transparent"
|
||||
></div>
|
||||
</div>
|
||||
{:else if eventsError}
|
||||
<div class="text-red-600 text-center py-2">
|
||||
<div class="py-2 text-center text-red-600">
|
||||
{eventsError}
|
||||
<button
|
||||
onclick={loadEvents}
|
||||
class="ml-2 text-blue-600 underline"
|
||||
>
|
||||
Try again
|
||||
</button>
|
||||
<button onclick={loadEvents} class="ml-2 text-blue-600 underline"> Try again </button>
|
||||
</div>
|
||||
{:else if events.length === 0}
|
||||
<p class="text-gray-500 text-center py-2">No events found</p>
|
||||
<p class="py-2 text-center text-gray-500">No events found</p>
|
||||
{:else}
|
||||
<select
|
||||
bind:value={selectedEventId}
|
||||
class="w-full p-2 border border-gray-300 rounded focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
class="w-full rounded border border-gray-300 p-2 focus:ring-2 focus:ring-blue-500 focus:outline-none"
|
||||
>
|
||||
{#each events as event}
|
||||
<option value={event.id}>
|
||||
@@ -132,22 +128,5 @@
|
||||
</div>
|
||||
|
||||
<!-- Ticket Display Section -->
|
||||
<h2 class="text-lg font-semibold mb-4">Ticket Information</h2>
|
||||
<h2 class="mb-2 text-lg font-semibold">Ticket Information</h2>
|
||||
<TicketDisplay {ticket_data} {scan_state} />
|
||||
|
||||
<!-- Reset button -->
|
||||
{#if scan_state !== ScanState.scanning}
|
||||
<div class="flex justify-center mt-6 mb-4">
|
||||
<button
|
||||
onclick={() => {
|
||||
scanned_id = "";
|
||||
scan_state = ScanState.scanning;
|
||||
}}
|
||||
class="bg-gray-200 hover:bg-gray-300 text-gray-800 font-semibold py-2 px-6 rounded-lg transition"
|
||||
aria-label="Reset scanner"
|
||||
>
|
||||
Reset Scanner
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user