UX improvements #8

Merged
erman merged 8 commits from supabase into main 2025-06-24 19:15:46 +02:00
Showing only changes of commit c24a845999 - Show all commits

View File

@@ -5,6 +5,7 @@ import { goto } from '$app/navigation';
let to = ''; let to = '';
let subject = ''; let subject = '';
let body = ''; let body = '';
let qrcode_b64 = '';
let loading = false; let loading = false;
let error = ''; let error = '';
let success = ''; let success = '';
@@ -43,12 +44,13 @@ async function sendTestEmail() {
to, to,
subject, subject,
text: body, text: body,
qr_code: qrcode_b64,
refreshToken refreshToken
}) })
}); });
if (r.ok) { if (r.ok) {
success = 'Email sent!'; success = 'Email sent!';
to = subject = body = ''; to = subject = body = qrcode_b64 = '';
} else { } else {
error = await r.text(); error = await r.text();
} }
@@ -82,6 +84,10 @@ async function sendTestEmail() {
<span class="text-gray-700">Body</span> <span class="text-gray-700">Body</span>
<textarea class="mt-1 block w-full border border-gray-300 rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-200 resize-none" rows="6" bind:value={body} required></textarea> <textarea class="mt-1 block w-full border border-gray-300 rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-200 resize-none" rows="6" bind:value={body} required></textarea>
</label> </label>
<label class="block">
<span class="text-gray-700">QR Code (base64, data:image/png;base64,...)</span>
<input type="text" class="mt-1 block w-full border border-gray-300 rounded px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-200 font-mono text-xs" bind:value={qrcode_b64} placeholder="Paste base64 image string here" required />
</label>
<button type="submit" class="w-full py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition" disabled={loading}> <button type="submit" class="w-full py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition" disabled={loading}>
{#if loading} {#if loading}
<svg class="animate-spin h-5 w-5 mr-2 inline-block text-white" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"> <svg class="animate-spin h-5 w-5 mr-2 inline-block text-white" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">