More general code clean up. Updating Lucide icons.

This commit is contained in:
Scott Idem
2026-02-11 13:21:38 -05:00
parent 3ca041383f
commit 3ffe9cbcc9
12 changed files with 130 additions and 128 deletions

View File

@@ -8,7 +8,7 @@
import { db_events } from '$lib/ae_events/db_events';
import { ae_loc } from '$lib/stores/ae_stores';
import { events_loc, events_sess } from '$lib/stores/ae_events_stores';
import { Key, Mail, Lock, User, ArrowRight, LoaderCircle, AlertCircle, CheckCircle2 } from 'lucide-svelte';
import { Key, Mail, Lock, User, ArrowRight, LoaderCircle, CircleAlert, CheckCircle2 } from 'lucide-svelte';
import { untrack } from 'svelte';
const exhibit_id = $derived(page.params.exhibit_id ?? '');
@@ -59,12 +59,12 @@
try {
// Determine raw JSON string
const raw_json = $lq__exhibit_obj?.license_li_json;
// Parse if string, otherwise use empty array
const licenses = typeof raw_json === 'string' ? JSON.parse(raw_json || '[]') : (Array.isArray(raw_json) ? raw_json : []);
const found = licenses.find((l: any) => l.email?.toLowerCase() === email.toLowerCase().trim());
if (found && found.passcode === user_passcode) {
// SUCCESS
complete_signin(found.email, 'licensed');
@@ -81,10 +81,10 @@
function complete_signin(key: string, type: string) {
status = 'success';
// Save to persistent store
if (!$events_loc.leads.auth_exhibit_kv) $events_loc.leads.auth_exhibit_kv = {};
$events_loc.leads.auth_exhibit_kv[exhibit_id] = {
key: key,
type: type,
@@ -102,10 +102,10 @@
</script>
<div class="exhibit-signin card p-6 variant-filled-surface shadow-xl border border-surface-500/20 space-y-6">
<!-- Tab Toggle -->
<div class="flex p-1 bg-surface-500/10 rounded-xl">
<button
<button
class="flex-1 flex items-center justify-center gap-2 py-2 rounded-lg text-sm font-bold transition-all"
class:bg-surface-100-900={signin_mode === 'passcode'}
class:shadow-sm={signin_mode === 'passcode'}
@@ -114,7 +114,7 @@
>
<Lock size="1.2em" /> Shared Code
</button>
<button
<button
class="flex-1 flex items-center justify-center gap-2 py-2 rounded-lg text-sm font-bold transition-all"
class:bg-surface-100-900={signin_mode === 'licensed'}
class:shadow-sm={signin_mode === 'licensed'}
@@ -127,17 +127,17 @@
<!-- Forms -->
<form onsubmit={(e) => { e.preventDefault(); handle_signin(); }} class="space-y-4">
{#if signin_mode === 'passcode'}
<div class="space-y-2 animate-in fade-in slide-in-from-left-2">
<label class="label">
<span class="text-[10px] uppercase font-bold opacity-50 ml-1 tracking-widest">Booth Passcode</span>
<div class="input-group input-group-divider grid-cols-[auto_1fr] variant-soft rounded-xl overflow-hidden border border-surface-500/20">
<div class="input-group-shim"><Key size="1.2em" /></div>
<input
type="text"
bind:value={passcode}
placeholder="Enter shared code..."
<input
type="text"
bind:value={passcode}
placeholder="Enter shared code..."
class="bg-transparent font-mono tracking-[0.3em] font-bold text-center"
autocomplete="off"
/>
@@ -150,10 +150,10 @@
<span class="text-[10px] uppercase font-bold opacity-50 ml-1 tracking-widest">Email Address</span>
<div class="input-group input-group-divider grid-cols-[auto_1fr] variant-soft rounded-xl overflow-hidden border border-surface-500/20">
<div class="input-group-shim"><Mail size="1.2em" /></div>
<input
type="email"
bind:value={email}
placeholder="your@email.com"
<input
type="email"
bind:value={email}
placeholder="your@email.com"
class="bg-transparent"
/>
</div>
@@ -163,10 +163,10 @@
<span class="text-[10px] uppercase font-bold opacity-50 ml-1 tracking-widest">Personal Passcode</span>
<div class="input-group input-group-divider grid-cols-[auto_1fr] variant-soft rounded-xl overflow-hidden border border-surface-500/20">
<div class="input-group-shim"><Key size="1.2em" /></div>
<input
type="text"
bind:value={user_passcode}
placeholder="Your code..."
<input
type="text"
bind:value={user_passcode}
placeholder="Your code..."
class="bg-transparent font-mono font-bold"
autocomplete="off"
/>
@@ -177,13 +177,13 @@
{#if status === 'error'}
<div class="p-3 rounded-lg variant-soft-error flex items-start gap-3 animate-shake">
<AlertCircle size="1.2em" class="shrink-0 mt-0.5" />
<CircleAlert size="1.2em" class="shrink-0 mt-0.5" />
<p class="text-xs font-bold leading-tight">{error_msg}</p>
</div>
{/if}
<button
type="submit"
<button
type="submit"
class="btn btn-lg variant-filled-primary w-full font-bold shadow-lg shadow-primary-500/20 group"
disabled={status === 'submitting'}
>

View File

@@ -11,7 +11,7 @@
import { events_func } from '$lib/ae_events_functions';
import Element_qr_scanner_v2 from '$lib/element_qr_scanner_v2.svelte';
import { ae_util } from '$lib/ae_utils/ae_utils';
import { LoaderCircle, UserPlus, CheckCircle, AlertCircle, Eye } from 'lucide-svelte';
import { LoaderCircle, UserPlus, CheckCircle, CircleAlert, Eye } from 'lucide-svelte';
import type { ae_EventBadge } from '$lib/types/ae_types';
interface Props {
@@ -28,7 +28,7 @@
.where('event_exhibit_id')
.equals(exhibit_id)
.toArray();
const map = new Map();
leads.forEach(l => {
const b_id = l.event_badge_id_random || l.event_badge_id?.toString();
@@ -50,7 +50,7 @@
if (obj && obj.type === 'event_badge' && obj.id) {
start_qr_scanner = false;
// Check if already exists
if ($existing_leads_map?.has(obj.id)) {
scanning_status = 'already_added';
@@ -58,7 +58,7 @@
} else {
scanning_status = 'found';
}
// Load full badge info
try {
found_badge = await events_func.load_ae_obj_id__event_badge({
@@ -77,9 +77,9 @@
async function confirm_add_lead() {
if (!found_badge || !found_badge.event_badge_id_random) return;
scanning_status = 'adding';
// Use the actual signed-in licensed user's email
const user_email = $events_loc.leads.auth_exhibit_kv?.[exhibit_id]?.key || 'shared_passcode';
@@ -95,7 +95,7 @@
if (result) {
scanning_status = 'success';
if (on_lead_added) on_lead_added(found_badge);
// Auto-reset after 2 seconds to scan next
setTimeout(reset_scanner, 2000);
}
@@ -123,7 +123,7 @@
<div class="absolute inset-0 pointer-events-none border-2 border-primary-500/50 m-8 sm:m-12 rounded-lg animate-pulse"></div>
</div>
<p class="text-center opacity-70 italic text-sm">Point camera at the badge QR code</p>
{:else if scanning_status === 'already_added'}
<div class="card p-6 w-full max-w-md space-y-4 variant-soft-secondary shadow-xl border-2 border-secondary-500 animate-in zoom-in">
<div class="text-center space-y-2">
@@ -132,17 +132,17 @@
<p class="text-xl font-bold">{found_badge?.full_name || 'Attendee'}</p>
<p class="opacity-70 text-sm">This attendee is already in your leads list.</p>
</div>
<a
<a
href={`/events/${page.params.event_id}/leads/exhibit/${exhibit_id}/lead/${existing_tracking_id}`}
class="btn btn-xl w-full variant-filled-secondary font-bold py-6"
>
<Eye size="1.5em" class="mr-2" />
View Lead Details
</a>
<button
type="button"
<button
type="button"
class="btn btn-sm w-full opacity-50"
onclick={reset_scanner}
>
@@ -156,9 +156,9 @@
<h3 class="h3 font-bold">{found_badge?.full_name || 'Badge Found'}</h3>
<p class="opacity-70">{found_badge?.affiliations || ''}</p>
</div>
<button
type="button"
<button
type="button"
class="btn btn-xl w-full preset-filled-primary font-bold py-6"
disabled={scanning_status === 'adding'}
onclick={confirm_add_lead}
@@ -171,9 +171,9 @@
Add as Lead
{/if}
</button>
<button
type="button"
<button
type="button"
class="btn btn-sm w-full opacity-50"
disabled={scanning_status === 'adding'}
onclick={reset_scanner}
@@ -194,7 +194,7 @@
{:else if scanning_status === 'error'}
<div class="card p-6 w-full max-w-md flex flex-col items-center space-y-4 variant-soft-error">
<AlertCircle size="3em" class="text-error-500" />
<CircleAlert size="3em" class="text-error-500" />
<p class="text-center font-bold">{error_msg}</p>
<button type="button" class="btn btn-sm preset-filled-error" onclick={reset_scanner}>
Try Again

View File

@@ -193,7 +193,7 @@
>
{#await ae_promises.upload__hosted_file_obj}
<div class="text-lg flex flex-row gap-1 items-center justify-center">
<Lucide.Loader2 class="animate-spin m-1" />
<Lucide.LoaderCircle class="animate-spin m-1" />
<span class="">
Uploading
{#if $ae_sess.api_upload_kv[task_id]}
@@ -279,7 +279,7 @@
$events_sess.files.status__file_list != 'ready'}
>
{#await ae_promises.upload__hosted_file_obj}
<Lucide.Loader2 class="animate-spin m-1" />
<Lucide.LoaderCircle class="animate-spin m-1" />
<span class="">
{#if $ae_sess.api_upload_kv[task_id]}
{$ae_sess.api_upload_kv[task_id].percent_completed}%