From 194938fc1df6257f97bf7f1da94615b8d6e561e0 Mon Sep 17 00:00:00 2001 From: Lennart Kloock Date: Sun, 29 Oct 2023 00:58:55 +0200 Subject: [PATCH] feat: new field component This is much better than before. Closes [Feature]: refactor auth dialog #132 --- .../src/components/auth/auth-dialog.svelte | 303 ++++----------- .../website/src/components/auth/field.svelte | 344 ------------------ .../auth/solve-two-fa-dialog.svelte | 63 ++-- .../website/src/components/form/field.svelte | 234 ++++++++++++ .../src/components/form/password-field.svelte | 38 ++ 5 files changed, 375 insertions(+), 607 deletions(-) delete mode 100644 platform/website/src/components/auth/field.svelte create mode 100644 platform/website/src/components/form/field.svelte create mode 100644 platform/website/src/components/form/password-field.svelte diff --git a/platform/website/src/components/auth/auth-dialog.svelte b/platform/website/src/components/auth/auth-dialog.svelte index ae213bb47..9d6b3e96b 100644 --- a/platform/website/src/components/auth/auth-dialog.svelte +++ b/platform/website/src/components/auth/auth-dialog.svelte @@ -1,14 +1,17 @@ - - - -
- - -
- - -
- - {#if field.type === "password"} - - {/if} - - - {#if field.touched} - {#if field.status === "loading"} -
- -
- {:else if field.status === "success"} -
- -
- {:else if field.status === "error"} -
- -
- {:else if field.status === "warning"} -
- -
- {/if} - {/if} -
-
- - {field.touched && (field.message || "hidden")} -
- - diff --git a/platform/website/src/components/auth/solve-two-fa-dialog.svelte b/platform/website/src/components/auth/solve-two-fa-dialog.svelte index 7eb4b9646..4ef3a02de 100644 --- a/platform/website/src/components/auth/solve-two-fa-dialog.svelte +++ b/platform/website/src/components/auth/solve-two-fa-dialog.svelte @@ -1,46 +1,31 @@ + + + +
+ +
+ + +
+ + {#if status.type === FieldStatusType.Loading} +
+ +
+ {:else if status.type === FieldStatusType.Success} +
+ +
+ {:else if status.type === FieldStatusType.Error} +
+ +
+ {:else if status.type === FieldStatusType.Warning} +
+ +
+ {/if} +
+
+ + {status.message} +
+ + diff --git a/platform/website/src/components/form/password-field.svelte b/platform/website/src/components/form/password-field.svelte new file mode 100644 index 000000000..3a632e817 --- /dev/null +++ b/platform/website/src/components/form/password-field.svelte @@ -0,0 +1,38 @@ + + + + + + +