From 6561771c435f9d9bed1589b5ed13d17aee0b7873 Mon Sep 17 00:00:00 2001
From: ivarlovlie <git@ivarlovlie.no>
Date: Sun, 11 Dec 2022 20:46:58 +0100
Subject: feat: Add frontpage

---
 .../routes/(main)/(public)/sign-in/+page.svelte    | 86 +++++++++++-----------
 1 file changed, 42 insertions(+), 44 deletions(-)

(limited to 'code/app/src/routes/(main)/(public)/sign-in/+page.svelte')

diff --git a/code/app/src/routes/(main)/(public)/sign-in/+page.svelte b/code/app/src/routes/(main)/(public)/sign-in/+page.svelte
index e862050..c4ecb1a 100644
--- a/code/app/src/routes/(main)/(public)/sign-in/+page.svelte
+++ b/code/app/src/routes/(main)/(public)/sign-in/+page.svelte
@@ -1,13 +1,13 @@
 <script lang="ts">
-    import {goto} from "$app/navigation";
-    import {Button, Checkbox, Input, Alert} from "$components";
+    import { goto } from "$app/navigation";
+    import { Button, Checkbox, Input, Alert } from "$components";
     import LL from "$i18n/i18n-svelte";
     import pwKey from "$actions/pwKey";
-    import {onMount} from "svelte";
-    import {signInPageMessageQueryKey, signInPageTestKeys, type SignInPageMessage} from ".";
-    import {AccountService} from "$services/account-service";
-    import type {LoginPayload} from "$services/abstractions/IAccountService";
-    import {FormError} from "$models/internal/FormError";
+    import { onMount } from "svelte";
+    import { signInPageMessageQueryKey, signInPageTestKeys, type SignInPageMessage } from ".";
+    import { AccountService } from "$services/account-service";
+    import type { LoginPayload } from "$services/abstractions/IAccountService";
+    import { FormError } from "$models/internal/FormError";
 
     let loading = false;
     let showErrorAlert = false;
@@ -71,24 +71,24 @@
         <div class="sm:max-w-md sm:mx-auto sm:w-full">
             {#if messageType === "after-password-reset"}
                 <Alert
-                        title={$LL.signInPage.yourNewPasswordIsApplied()}
-                        _pwKey={signInPageTestKeys.afterPasswordResetAlert}
-                        message={$LL.signInPage.signInBelow()}
-                        closeable
+                    title={$LL.signInPage.yourNewPasswordIsApplied()}
+                    _pwKey={signInPageTestKeys.afterPasswordResetAlert}
+                    message={$LL.signInPage.signInBelow()}
+                    closeable
                 />
             {:else if messageType === "user-disabled"}
                 <Alert
-                        title={$LL.signInPage.yourAccountIsDisabled()}
-                        _pwKey={signInPageTestKeys.userDisabledAlert}
-                        message={$LL.signInPage.contactYourAdminIfDisabled()}
-                        closeable
+                    title={$LL.signInPage.yourAccountIsDisabled()}
+                    _pwKey={signInPageTestKeys.userDisabledAlert}
+                    message={$LL.signInPage.contactYourAdminIfDisabled()}
+                    closeable
                 />
             {:else if messageType === "user-inactivity"}
                 <Alert
-                        title={$LL.signInPage.youHaveReachedInactivityLimit()}
-                        _pwKey={signInPageTestKeys.userInactivityAlert}
-                        message={$LL.signInPage.feelFreeToSignInAgain()}
-                        closeable
+                    title={$LL.signInPage.youHaveReachedInactivityLimit()}
+                    _pwKey={signInPageTestKeys.userInactivityAlert}
+                    message={$LL.signInPage.feelFreeToSignInAgain()}
+                    closeable
                 />
             {/if}
         </div>
@@ -107,39 +107,37 @@
     <div class="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
         <div class="bg-white py-8 px-4 shadow sm:rounded-lg sm:px-10">
             {#if showErrorAlert}
-                <Alert title={formError.title} message={formError.subtitle} type="error"
-                       _pwKey={signInPageTestKeys.formErrorAlert}/>
+                <Alert title={formError.title} message={formError.subtitle} type="error" _pwKey={signInPageTestKeys.formErrorAlert} />
             {/if}
-            <form class="space-y-6 mt-2" use:pwKey={signInPageTestKeys.signInForm}
-                  on:submit|preventDefault={submit_form_async}>
+            <form class="space-y-6 mt-2" use:pwKey={signInPageTestKeys.signInForm} on:submit|preventDefault={submit_form_async}>
                 <Input
-                        id="username"
-                        _pwKey={signInPageTestKeys.usernameInput}
-                        name="username"
-                        type="email"
-                        label={$LL.emailAddress()}
-                        required
-                        bind:value={formData.username.value}
+                    id="username"
+                    _pwKey={signInPageTestKeys.usernameInput}
+                    name="username"
+                    type="email"
+                    label={$LL.emailAddress()}
+                    required
+                    bind:value={formData.username.value}
                 />
 
                 <Input
-                        id="password"
-                        name="password"
-                        type="password"
-                        label={$LL.password()}
-                        _pwKey={signInPageTestKeys.passwordInput}
-                        autocomplete="current-password"
-                        required
-                        bind:value={formData.password.value}
+                    id="password"
+                    name="password"
+                    type="password"
+                    label={$LL.password()}
+                    _pwKey={signInPageTestKeys.passwordInput}
+                    autocomplete="current-password"
+                    required
+                    bind:value={formData.password.value}
                 />
 
                 <div class="flex items-center justify-between">
                     <Checkbox
-                            id="remember-me"
-                            _pwKey={signInPageTestKeys.rememberMeCheckbox}
-                            name="remember-me"
-                            bind:checked={formData.persist.value}
-                            label={$LL.signInPage.notMyComputer()}
+                        id="remember-me"
+                        _pwKey={signInPageTestKeys.rememberMeCheckbox}
+                        name="remember-me"
+                        bind:checked={formData.persist.value}
+                        label={$LL.signInPage.notMyComputer()}
                     />
                     <div class="text-sm">
                         <a href="/reset-password" class="link" use:pwKey={signInPageTestKeys.resetPasswordAnchor}>
@@ -148,7 +146,7 @@
                     </div>
                 </div>
 
-                <Button text={$LL.submit()} fullWidth type="submit" {loading}/>
+                <Button text={$LL.submit()} fullWidth type="submit" {loading} />
             </form>
         </div>
     </div>
-- 
cgit v1.3

