Browse Source

switch handle login to $effect

master
Silberengel 10 months ago
parent
commit
505da03c33
  1. 49
      src/routes/contact/+page.svelte

49
src/routes/contact/+page.svelte

@ -24,18 +24,18 @@
activeTab = 'write'; activeTab = 'write';
} }
let subject = ''; let subject = $state('');
let content = ''; let content = $state('');
let isSubmitting = false; let isSubmitting = $state(false);
let showLoginModal = false; let showLoginModal = $state(false);
let submissionSuccess = false; let submissionSuccess = $state(false);
let submissionError = ''; let submissionError = $state('');
let submittedEvent: NDKEvent | null = null; let submittedEvent = $state<NDKEvent | null>(null);
let issueLink = ''; let issueLink = $state('');
let successfulRelays: string[] = []; let successfulRelays = $state<string[]>([]);
let isExpanded = false; let isExpanded = $state(false);
let activeTab = 'write'; let activeTab = $state('write');
let showConfirmDialog = false; let showConfirmDialog = $state(false);
// Store form data when user needs to login // Store form data when user needs to login
let savedFormData = { let savedFormData = {
@ -256,16 +256,19 @@
} }
// Handle login completion // Handle login completion
$: if ($ndkSignedIn && showLoginModal) { $effect(() => {
showLoginModal = false; if ($ndkSignedIn && showLoginModal) {
showLoginModal = false;
// Restore saved form data
if (savedFormData.subject) subject = savedFormData.subject; // Restore saved form data
if (savedFormData.content) content = savedFormData.content; if (savedFormData.subject) subject = savedFormData.subject;
if (savedFormData.content) content = savedFormData.content;
// Submit the issue
submitIssue(); // Submit the issue
} submitIssue();
}
});
</script> </script>
<div class='w-full flex justify-center'> <div class='w-full flex justify-center'>
@ -286,7 +289,7 @@
If you are logged into the Alexandria web application (using the button at the top-right of the window), then you can use the form, below, to submit an issue, that will appear on our repo page. If you are logged into the Alexandria web application (using the button at the top-right of the window), then you can use the form, below, to submit an issue, that will appear on our repo page.
</P> </P>
<form class="space-y-4 mt-6" on:submit|preventDefault={handleSubmit}> <form class="space-y-4" on:submit={handleSubmit} autocomplete="off">
<div> <div>
<Label for="subject" class="mb-2">Subject</Label> <Label for="subject" class="mb-2">Subject</Label>
<Input id="subject" class="w-full bg-white dark:bg-gray-800" placeholder="Issue subject" bind:value={subject} required autofocus /> <Input id="subject" class="w-full bg-white dark:bg-gray-800" placeholder="Issue subject" bind:value={subject} required autofocus />

Loading…
Cancel
Save