Skip to content

Commit eb0cd60

Browse files
committed
Make it email check
1 parent a65ecf0 commit eb0cd60

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/lib/components/input/EmailInput.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import type { FullAutoFill } from 'svelte/elements';
88
99
interface Props {
10-
label: string;
10+
label?: string;
1111
placeholder?: string;
1212
autocomplete?: FullAutoFill;
1313
value: string;

src/routes/(authenticated)/admin/blacklists/+page.svelte

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import { Separator } from '$lib/components/ui/separator';
1515
import { handleApiError } from '$lib/errorhandling/apiErrorHandling';
1616
import type { TimeoutHandle } from '$lib/types/WAPI';
17+
import EmailInput from '$lib/components/input/EmailInput.svelte';
1718
1819
// --- state ---
1920
let usernameEntry = $state<string>('');
@@ -22,6 +23,7 @@
2223
let isLoadingUsernames = $state(false);
2324
2425
let emailEntry = $state<string>('');
26+
let emailEntryValid = $state(false);
2527
let emailBlacklist = $state<EmailProviderBlacklistDto[]>([]);
2628
let isLoadingEmails = $state(false);
2729
@@ -142,6 +144,8 @@
142144
loadEmails('');
143145
return;
144146
}
147+
148+
if (!emailEntryValid) return;
145149
146150
emailDebounce = setTimeout(() => loadEmails(emailEntry), 400);
147151
});
@@ -199,14 +203,14 @@
199203
<Card>
200204
<CardHeader>
201205
<CardTitle>Email-Provider Blacklist</CardTitle>
202-
<TextInput placeholder="e.g. gmail.com" bind:value={emailEntry}>
206+
<EmailInput placeholder="e.g. gmail.com" bind:value={emailEntry} bind:valid={emailEntryValid}>
203207
{#snippet after()}
204208
<Button onclick={addEmailEntry} disabled={isLoadingEmails}>Add</Button>
205209
<Button onclick={addEmailsBatch} disabled={isLoadingEmails}
206210
>Batch Upload From Clipboard</Button
207211
>
208212
{/snippet}
209-
</TextInput>
213+
</EmailInput>
210214
</CardHeader>
211215
<CardContent>
212216
<ScrollArea class="max-h-64">

0 commit comments

Comments
 (0)