From ced66c5807575cd29f6aa5632e8ad02b38c8448a Mon Sep 17 00:00:00 2001 From: ivar Date: Sun, 28 Apr 2024 22:37:30 +0200 Subject: WIP new frontend --- .../routes/(main)/(public)/sign-in/+page.svelte | 155 +++++++++++++++++++++ .../src/routes/(main)/(public)/sign-in/+page.ts | 11 ++ .../routes/(main)/(public)/sign-in/index.spec.js | 12 ++ .../src/routes/(main)/(public)/sign-in/index.ts | 20 +++ 4 files changed, 198 insertions(+) create mode 100644 code/frontend/src/routes/(main)/(public)/sign-in/+page.svelte create mode 100644 code/frontend/src/routes/(main)/(public)/sign-in/+page.ts create mode 100644 code/frontend/src/routes/(main)/(public)/sign-in/index.spec.js create mode 100644 code/frontend/src/routes/(main)/(public)/sign-in/index.ts (limited to 'code/frontend/src/routes/(main)/(public)/sign-in') diff --git a/code/frontend/src/routes/(main)/(public)/sign-in/+page.svelte b/code/frontend/src/routes/(main)/(public)/sign-in/+page.svelte new file mode 100644 index 0000000..66d4575 --- /dev/null +++ b/code/frontend/src/routes/(main)/(public)/sign-in/+page.svelte @@ -0,0 +1,155 @@ + + +
+ {#if messageType} +
+ {#if messageType === "after-password-reset"} + + {:else if messageType === "user-disabled"} + + {:else if messageType === "user-inactivity"} + + {/if} +
+ {/if} +
+

+ {$LL.signInPage.signIn()} +

+

+ {$LL.or().toLowerCase()} + + {$LL.createANewAccount().toLowerCase()} + +

+
+
+
+ {#if form.showError} + + {/if} +
form.submit_async()}> + + + + + + +
+
+
diff --git a/code/frontend/src/routes/(main)/(public)/sign-in/+page.ts b/code/frontend/src/routes/(main)/(public)/sign-in/+page.ts new file mode 100644 index 0000000..bebc459 --- /dev/null +++ b/code/frontend/src/routes/(main)/(public)/sign-in/+page.ts @@ -0,0 +1,11 @@ +import LL from '$i18n/i18n-svelte'; +import { get } from 'svelte/store'; +import type { PageLoad } from './$types'; + +const l = get(LL); + +export const load: PageLoad = async () => { + return { + title: l.signInPage.title(), + }; +}; \ No newline at end of file diff --git a/code/frontend/src/routes/(main)/(public)/sign-in/index.spec.js b/code/frontend/src/routes/(main)/(public)/sign-in/index.spec.js new file mode 100644 index 0000000..3bccf72 --- /dev/null +++ b/code/frontend/src/routes/(main)/(public)/sign-in/index.spec.js @@ -0,0 +1,12 @@ +import { test, expect } from "@playwright/test"; +import { signInPageTestKeys } from "./index.js"; +import { get_test_context } from "$configuration/test"; +import { get_pw_key_selector } from "$utils/testing-helpers"; + +const context = get_test_context(); + +test("form loads", async ({ page }) => { + page.goto("/sign-in"); + const form = page.locator(get_pw_key_selector(signInPageTestKeys.signInForm)); + expect(form.isVisible()).toBeTruthy(); +}); diff --git a/code/frontend/src/routes/(main)/(public)/sign-in/index.ts b/code/frontend/src/routes/(main)/(public)/sign-in/index.ts new file mode 100644 index 0000000..c1a1929 --- /dev/null +++ b/code/frontend/src/routes/(main)/(public)/sign-in/index.ts @@ -0,0 +1,20 @@ +export enum SignInPageMessage { + AFTER_PASSWORD_RESET = "after-password-reset", + USER_INACTIVITY = "user-inactivity", + USER_DISABLED = "user-disabled", + LOGGED_OUT = "logged-out" +} + +export const signInPageMessageQueryKey = "m"; +export const signInPageTestKeys = { + passwordInput: "password-input", + usernameInput: "username-input", + rememberMeCheckbox: "remember-me-checkbox", + signInForm: "sign-in-form", + userInactivityAlert: SignInPageMessage.USER_INACTIVITY + "-alert", + userDisabledAlert: SignInPageMessage.USER_DISABLED + "-alert", + afterPasswordResetAlert: SignInPageMessage.AFTER_PASSWORD_RESET + "-alert", + formErrorAlert: "form-error-alert", + resetPasswordAnchor: "reset-password-anchor", + signUpAnchor: "sign-up-anchor", +}; \ No newline at end of file -- cgit v1.3