From 0991ab04639129c601cf17cf7c5e60ec5718867b Mon Sep 17 00:00:00 2001 From: Benjamin Strasser Date: Wed, 29 May 2024 14:53:03 +0200 Subject: [PATCH 01/10] Added basic auth layout Signed-off-by: Benjamin Strasser --- src/routes/(auth)/+layout.svelte | 40 ++++++++++++++++++++++++++++++++ src/routes/+layout.svelte | 26 +++++++++++---------- 2 files changed, 54 insertions(+), 12 deletions(-) create mode 100644 src/routes/(auth)/+layout.svelte diff --git a/src/routes/(auth)/+layout.svelte b/src/routes/(auth)/+layout.svelte new file mode 100644 index 00000000..118e9f31 --- /dev/null +++ b/src/routes/(auth)/+layout.svelte @@ -0,0 +1,40 @@ + + +
+
+ +
+
+ ⌘ Tiny-TMS +
+
+ + +
+
+ + Efficiently translate your content +
+
+ + Open source and self hosting +
+
+ + Seamless AI-Autocompletion integrations +
+
+ + +
+
+

A Translation Management System to cover the needs of most people.

+

Not for everyone, but for most.

+
+
+
+ +
+
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 9c841128..11f64ea3 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -11,18 +11,20 @@ import { Toaster } from '$components/ui/sonner' - +
+ - + - + - + +
From d1255df663c0a0ec2a05ddbb6a061d89f57b436c Mon Sep 17 00:00:00 2001 From: Benjamin Strasser Date: Thu, 30 May 2024 18:33:07 +0200 Subject: [PATCH 02/10] Updated design of Login page Added placeholder pages Signed-off-by: Benjamin Strasser --- src/components/ui/checkbox/checkbox.svelte | 35 +++++++++++ src/components/ui/checkbox/index.ts | 7 +++ src/routes/(auth)/+layout.svelte | 4 +- .../(auth)/forgot-password/+page.svelte | 1 + src/routes/(auth)/login/login-form.svelte | 59 ++++++++++++------- .../code-of-conduct/+page.svelte | 1 + .../privacy-policy/+page.svelte | 1 + 7 files changed, 86 insertions(+), 22 deletions(-) create mode 100644 src/components/ui/checkbox/checkbox.svelte create mode 100644 src/components/ui/checkbox/index.ts create mode 100644 src/routes/(auth)/forgot-password/+page.svelte create mode 100644 src/routes/(terms-policy)/code-of-conduct/+page.svelte create mode 100644 src/routes/(terms-policy)/privacy-policy/+page.svelte diff --git a/src/components/ui/checkbox/checkbox.svelte b/src/components/ui/checkbox/checkbox.svelte new file mode 100644 index 00000000..44d37e7a --- /dev/null +++ b/src/components/ui/checkbox/checkbox.svelte @@ -0,0 +1,35 @@ + + + + + {#if isChecked} + + {:else if isIndeterminate} + + {/if} + + diff --git a/src/components/ui/checkbox/index.ts b/src/components/ui/checkbox/index.ts new file mode 100644 index 00000000..f4a32f2b --- /dev/null +++ b/src/components/ui/checkbox/index.ts @@ -0,0 +1,7 @@ +import Root from './checkbox.svelte' + +export { + Root, + // + Root as Checkbox +} diff --git a/src/routes/(auth)/+layout.svelte b/src/routes/(auth)/+layout.svelte index 118e9f31..aba67413 100644 --- a/src/routes/(auth)/+layout.svelte +++ b/src/routes/(auth)/+layout.svelte @@ -12,7 +12,9 @@ -
+
Efficiently translate your content diff --git a/src/routes/(auth)/forgot-password/+page.svelte b/src/routes/(auth)/forgot-password/+page.svelte new file mode 100644 index 00000000..71950a7a --- /dev/null +++ b/src/routes/(auth)/forgot-password/+page.svelte @@ -0,0 +1 @@ +Forgot Password diff --git a/src/routes/(auth)/login/login-form.svelte b/src/routes/(auth)/login/login-form.svelte index 4292331e..c6ab5caf 100644 --- a/src/routes/(auth)/login/login-form.svelte +++ b/src/routes/(auth)/login/login-form.svelte @@ -1,7 +1,8 @@ -
- - - Log In - Log In to tiny-tms and start doing you translations - - +
+
+
+

Sign in to your account

+

+ Or sign up for a new account +

+
+ - E-Mail - + Email + - This is your e-mail. Password - + - This is your password - - - Log In - - - +
+
+ + +
+ +
+ Log In + +
+ Check out our Code of Conduct + and + Privacy Policy + page. +
+
+
diff --git a/src/routes/(terms-policy)/code-of-conduct/+page.svelte b/src/routes/(terms-policy)/code-of-conduct/+page.svelte new file mode 100644 index 00000000..9163e902 --- /dev/null +++ b/src/routes/(terms-policy)/code-of-conduct/+page.svelte @@ -0,0 +1 @@ +Code of Conduct diff --git a/src/routes/(terms-policy)/privacy-policy/+page.svelte b/src/routes/(terms-policy)/privacy-policy/+page.svelte new file mode 100644 index 00000000..9e4e7d65 --- /dev/null +++ b/src/routes/(terms-policy)/privacy-policy/+page.svelte @@ -0,0 +1 @@ +Privacy Policy From d1dfe57c0b472d0557cbb0f15483403a08f8ce71 Mon Sep 17 00:00:00 2001 From: Benjamin Strasser Date: Thu, 30 May 2024 19:28:34 +0200 Subject: [PATCH 03/10] Redesigned Register page Added terms of service placeholder page Signed-off-by: Benjamin Strasser --- src/hooks.server.ts | 10 ++- src/routes/(auth)/signup/schema.ts | 3 +- src/routes/(auth)/signup/signup-form.svelte | 71 ++++++++++++------- .../terms-of-service/+page.svelte | 1 + 4 files changed, 59 insertions(+), 26 deletions(-) create mode 100644 src/routes/(terms-policy)/terms-of-service/+page.svelte diff --git a/src/hooks.server.ts b/src/hooks.server.ts index e62952f2..a9c22e09 100644 --- a/src/hooks.server.ts +++ b/src/hooks.server.ts @@ -4,7 +4,15 @@ import { TOKEN_NAME, parseTokenToJwt } from 'services/auth/token' import type { UserAuthCredentials } from 'services/user/user' import { getUserAuthCredentials } from 'services/user/user-auth-service' -const PUBLIC_ROUTES = ['/', '/login', '/signup'] +const PUBLIC_ROUTES = [ + '/', + '/login', + '/signup', + '/forgot-password', + 'code-of-conduct', + 'privacy-policy', + 'terms-of-service' +] export const handle: Handle = async ({ event, resolve }) => { const { locals, cookies, url } = event diff --git a/src/routes/(auth)/signup/schema.ts b/src/routes/(auth)/signup/schema.ts index a0c4eadc..98e3992d 100644 --- a/src/routes/(auth)/signup/schema.ts +++ b/src/routes/(auth)/signup/schema.ts @@ -9,7 +9,8 @@ export const signupSchema = z .string({ required_error: 'Password is required' }) .min(8, { message: 'Password must be at least 8 characters' }) .trim(), - confirmPassword: z.string().trim() + confirmPassword: z.string().trim(), + termsOfService: z.literal(true, { required_error: 'You must agree to the terms of service' }) }) .refine((data) => data.password === data.confirmPassword, { message: "Passwords don't match", diff --git a/src/routes/(auth)/signup/signup-form.svelte b/src/routes/(auth)/signup/signup-form.svelte index e359a620..0275e3db 100644 --- a/src/routes/(auth)/signup/signup-form.svelte +++ b/src/routes/(auth)/signup/signup-form.svelte @@ -1,7 +1,7 @@ -
- - - Sign Up to tiny-tms - Register to tiny-tms and start doing you translations - - +
+
+
+

Register

+

+ Enter you informationto create an user account for this Tiny-TMS instance +

+

+ or sign in to an existing account +

+
+ - E-Mail - + Email + - This is your e-mail. Password - + - This is your password Confirm Password - + - This is your password - - - Sign Up - - - + +
+ + +
+ + + I agree with the + Terms of Service + + +
+
+
+
+ + Sign Up + +
+
diff --git a/src/routes/(terms-policy)/terms-of-service/+page.svelte b/src/routes/(terms-policy)/terms-of-service/+page.svelte new file mode 100644 index 00000000..4a87d0b0 --- /dev/null +++ b/src/routes/(terms-policy)/terms-of-service/+page.svelte @@ -0,0 +1 @@ +Terms of Service From 402812d5d78b9ba2aef0ee8966b407c740245d09 Mon Sep 17 00:00:00 2001 From: Benjamin Strasser Date: Thu, 30 May 2024 19:33:25 +0200 Subject: [PATCH 04/10] Fixed error inside autogenerated checkbox component Signed-off-by: Benjamin Strasser --- src/components/ui/checkbox/checkbox.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ui/checkbox/checkbox.svelte b/src/components/ui/checkbox/checkbox.svelte index 44d37e7a..a1c7c639 100644 --- a/src/components/ui/checkbox/checkbox.svelte +++ b/src/components/ui/checkbox/checkbox.svelte @@ -8,7 +8,7 @@ type $$Events = CheckboxPrimitive.Events let className: $$Props['class'] = undefined - export let checked: $$Props['checked'] = false + export let checked: NonNullable<$$Props['checked']> = false export { className as class } From d388fa9c794c33d58b19a65e92171e071fa9cb9a Mon Sep 17 00:00:00 2001 From: Benjamin Strasser Date: Thu, 30 May 2024 20:11:18 +0200 Subject: [PATCH 05/10] Fixed bug regarding checkbox in signup page Signed-off-by: Benjamin Strasser --- src/routes/(auth)/signup/signup-form.svelte | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/routes/(auth)/signup/signup-form.svelte b/src/routes/(auth)/signup/signup-form.svelte index 0275e3db..722b6db4 100644 --- a/src/routes/(auth)/signup/signup-form.svelte +++ b/src/routes/(auth)/signup/signup-form.svelte @@ -72,20 +72,21 @@ -
- - + + +
- - + + I agree with the Terms of Service +
- - -
+
+ + Sign Up From ae53aff93e9ef15e4887b76dcdfb9006cb2a8dea Mon Sep 17 00:00:00 2001 From: Benjamin Strasser Date: Thu, 30 May 2024 21:23:37 +0200 Subject: [PATCH 06/10] Improved design Signed-off-by: Benjamin Strasser --- src/components/ui/theme-selector/index.ts | 1 + .../ui/theme-selector/theme-selector.svelte | 79 +++++++++++++++++++ src/routes/(auth)/+layout.svelte | 13 ++- src/routes/+layout.svelte | 20 ----- 4 files changed, 89 insertions(+), 24 deletions(-) create mode 100644 src/components/ui/theme-selector/index.ts create mode 100644 src/components/ui/theme-selector/theme-selector.svelte diff --git a/src/components/ui/theme-selector/index.ts b/src/components/ui/theme-selector/index.ts new file mode 100644 index 00000000..489d16ea --- /dev/null +++ b/src/components/ui/theme-selector/index.ts @@ -0,0 +1 @@ +export { default as ThemeSelector } from './theme-selector.svelte' diff --git a/src/components/ui/theme-selector/theme-selector.svelte b/src/components/ui/theme-selector/theme-selector.svelte new file mode 100644 index 00000000..c1ca7c5e --- /dev/null +++ b/src/components/ui/theme-selector/theme-selector.svelte @@ -0,0 +1,79 @@ + + + + +
+ + + + + + + + +
+ + + diff --git a/src/routes/(auth)/+layout.svelte b/src/routes/(auth)/+layout.svelte index aba67413..878da3d5 100644 --- a/src/routes/(auth)/+layout.svelte +++ b/src/routes/(auth)/+layout.svelte @@ -1,5 +1,7 @@
@@ -13,18 +15,18 @@
- + Efficiently translate your content
- + Open source and self hosting
- + Seamless AI-Autocompletion integrations
@@ -36,6 +38,9 @@

Not for everyone, but for most.

+
+ +
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 11f64ea3..443f5841 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,29 +1,9 @@
- - - - From b9b76feb932d541bdb86bb3d67f628ded1b0433b Mon Sep 17 00:00:00 2001 From: Benjamin Strasser Date: Fri, 31 May 2024 10:43:27 +0200 Subject: [PATCH 07/10] Finally managed to get basic checked css to work Signed-off-by: Benjamin Strasser --- .../ui/theme-selector/theme-selector.svelte | 31 +++---------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/src/components/ui/theme-selector/theme-selector.svelte b/src/components/ui/theme-selector/theme-selector.svelte index c1ca7c5e..0e79ce85 100644 --- a/src/components/ui/theme-selector/theme-selector.svelte +++ b/src/components/ui/theme-selector/theme-selector.svelte @@ -2,8 +2,8 @@ import Sun from 'lucide-svelte/icons/sun' import Moon from 'lucide-svelte/icons/moon' import Computer from 'lucide-svelte/icons/computer' - import { ModeWatcher, mode, setMode } from 'mode-watcher' + let currentMode: 'dark' | 'light' | 'system' = $mode || 'system' $: { @@ -22,13 +22,7 @@ value={'system'} bind:group={currentMode} /> -
- From 3a194bc3d068dc7d15e4d3ffbc3ea8f81d96cd02 Mon Sep 17 00:00:00 2001 From: Benjamin Strasser Date: Fri, 31 May 2024 12:15:29 +0200 Subject: [PATCH 08/10] Improved design of checks inside auth layout Signed-off-by: Benjamin Strasser --- src/routes/(auth)/+layout.svelte | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/routes/(auth)/+layout.svelte b/src/routes/(auth)/+layout.svelte index 878da3d5..2bbc9357 100644 --- a/src/routes/(auth)/+layout.svelte +++ b/src/routes/(auth)/+layout.svelte @@ -18,15 +18,21 @@ class="flex flex-grow flex-col items-start justify-center space-y-4 p-6 text-2xl font-semibold" >
- + + + Efficiently translate your content
- + + + Open source and self hosting
- + + + Seamless AI-Autocompletion integrations
From b75700371de555dfcc59147a39d389cfae1dce26 Mon Sep 17 00:00:00 2001 From: Benjamin Strasser Date: Fri, 31 May 2024 18:10:45 +0200 Subject: [PATCH 09/10] Cleaned up public routes Signed-off-by: Benjamin Strasser --- src/hooks.server.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hooks.server.ts b/src/hooks.server.ts index a9c22e09..a4613863 100644 --- a/src/hooks.server.ts +++ b/src/hooks.server.ts @@ -9,9 +9,9 @@ const PUBLIC_ROUTES = [ '/login', '/signup', '/forgot-password', - 'code-of-conduct', - 'privacy-policy', - 'terms-of-service' + '/code-of-conduct', + '/privacy-policy', + '/terms-of-service' ] export const handle: Handle = async ({ event, resolve }) => { From 651da26c22536399e6a21ac73230169051bedf7f Mon Sep 17 00:00:00 2001 From: Benjamin Strasser Date: Sun, 2 Jun 2024 17:47:22 +0200 Subject: [PATCH 10/10] minor changes from review Signed-off-by: Benjamin Strasser --- src/routes/(auth)/+layout.svelte | 1 - src/routes/(auth)/signup/schema.ts | 5 ++--- src/routes/(auth)/signup/signup-form.svelte | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/routes/(auth)/+layout.svelte b/src/routes/(auth)/+layout.svelte index 2bbc9357..27927f05 100644 --- a/src/routes/(auth)/+layout.svelte +++ b/src/routes/(auth)/+layout.svelte @@ -1,6 +1,5 @@ diff --git a/src/routes/(auth)/signup/schema.ts b/src/routes/(auth)/signup/schema.ts index 98e3992d..a5b18801 100644 --- a/src/routes/(auth)/signup/schema.ts +++ b/src/routes/(auth)/signup/schema.ts @@ -7,9 +7,8 @@ export const signupSchema = z .email({ message: 'Please enter a valid email address' }), password: z .string({ required_error: 'Password is required' }) - .min(8, { message: 'Password must be at least 8 characters' }) - .trim(), - confirmPassword: z.string().trim(), + .min(8, { message: 'Password must be at least 8 characters' }), + confirmPassword: z.string(), termsOfService: z.literal(true, { required_error: 'You must agree to the terms of service' }) }) .refine((data) => data.password === data.confirmPassword, { diff --git a/src/routes/(auth)/signup/signup-form.svelte b/src/routes/(auth)/signup/signup-form.svelte index 722b6db4..3306b079 100644 --- a/src/routes/(auth)/signup/signup-form.svelte +++ b/src/routes/(auth)/signup/signup-form.svelte @@ -33,7 +33,7 @@

Register

- Enter you informationto create an user account for this Tiny-TMS instance + Enter you information to create an user account for this Tiny-TMS instance

or sign in to an existing account