From 2b58ff029107b23617d8c4b246de77876b3bf053 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Wed, 28 Sep 2022 00:21:37 +0800 Subject: feat: Move frontend into layout group (main) This enables /book to load without the usual layout (app layout) --- apps/kit/src/routes/(app)/+layout.svelte | 215 --------------------- apps/kit/src/routes/(app)/home/+page.svelte | 1 - apps/kit/src/routes/(main)/(app)/+layout.svelte | 215 +++++++++++++++++++++ apps/kit/src/routes/(main)/(app)/home/+page.svelte | 1 + apps/kit/src/routes/(main)/(public)/+layout.svelte | 1 + .../src/routes/(main)/(public)/login/+page.svelte | 136 +++++++++++++ .../src/routes/(main)/(public)/reset/+page.svelte | 104 ++++++++++ .../src/routes/(main)/(public)/signup/+page.svelte | 38 ++++ apps/kit/src/routes/(main)/+layout.server.ts | 13 ++ apps/kit/src/routes/(main)/+layout.svelte | 41 ++++ apps/kit/src/routes/(main)/+layout.ts | 9 + apps/kit/src/routes/(main)/+page.svelte | 2 + apps/kit/src/routes/(public)/+layout.svelte | 3 - apps/kit/src/routes/(public)/login/+page.svelte | 136 ------------- apps/kit/src/routes/(public)/reset/+page.svelte | 104 ---------- apps/kit/src/routes/(public)/signup/+page.svelte | 38 ---- apps/kit/src/routes/+layout.server.ts | 13 -- apps/kit/src/routes/+layout.svelte | 41 ---- apps/kit/src/routes/+layout.ts | 9 - apps/kit/src/routes/+page.svelte | 2 - apps/kit/src/routes/book/+layout.svelte | 17 +- apps/kit/src/routes/book/alerts/+page.svelte | 4 +- apps/kit/src/routes/book/buttons/+page.svelte | 24 +++ 23 files changed, 600 insertions(+), 567 deletions(-) delete mode 100644 apps/kit/src/routes/(app)/+layout.svelte delete mode 100644 apps/kit/src/routes/(app)/home/+page.svelte create mode 100644 apps/kit/src/routes/(main)/(app)/+layout.svelte create mode 100644 apps/kit/src/routes/(main)/(app)/home/+page.svelte create mode 100644 apps/kit/src/routes/(main)/(public)/+layout.svelte create mode 100644 apps/kit/src/routes/(main)/(public)/login/+page.svelte create mode 100644 apps/kit/src/routes/(main)/(public)/reset/+page.svelte create mode 100644 apps/kit/src/routes/(main)/(public)/signup/+page.svelte create mode 100644 apps/kit/src/routes/(main)/+layout.server.ts create mode 100644 apps/kit/src/routes/(main)/+layout.svelte create mode 100644 apps/kit/src/routes/(main)/+layout.ts create mode 100644 apps/kit/src/routes/(main)/+page.svelte delete mode 100644 apps/kit/src/routes/(public)/+layout.svelte delete mode 100644 apps/kit/src/routes/(public)/login/+page.svelte delete mode 100644 apps/kit/src/routes/(public)/reset/+page.svelte delete mode 100644 apps/kit/src/routes/(public)/signup/+page.svelte delete mode 100644 apps/kit/src/routes/+layout.server.ts delete mode 100644 apps/kit/src/routes/+layout.svelte delete mode 100644 apps/kit/src/routes/+layout.ts delete mode 100644 apps/kit/src/routes/+page.svelte create mode 100644 apps/kit/src/routes/book/buttons/+page.svelte (limited to 'apps/kit/src/routes') diff --git a/apps/kit/src/routes/(app)/+layout.svelte b/apps/kit/src/routes/(app)/+layout.svelte deleted file mode 100644 index 3f60af3..0000000 --- a/apps/kit/src/routes/(app)/+layout.svelte +++ /dev/null @@ -1,215 +0,0 @@ - - - -{#if !online} -
-
-
- -
-
-

- You seem to be offline, please check your internet connection. -

-
-
-
-{/if} -
- - sidebarIsOpen = !sidebarIsOpen}> - -
-
- -
- - - -
- -
-
- - -
-
- -
-
-
- - - -
-
-
-
- -
-
-
-
-
- - -
- -
-
-
\ No newline at end of file diff --git a/apps/kit/src/routes/(app)/home/+page.svelte b/apps/kit/src/routes/(app)/home/+page.svelte deleted file mode 100644 index 247ee47..0000000 --- a/apps/kit/src/routes/(app)/home/+page.svelte +++ /dev/null @@ -1 +0,0 @@ -

Welcome Home

\ No newline at end of file diff --git a/apps/kit/src/routes/(main)/(app)/+layout.svelte b/apps/kit/src/routes/(main)/(app)/+layout.svelte new file mode 100644 index 0000000..3f60af3 --- /dev/null +++ b/apps/kit/src/routes/(main)/(app)/+layout.svelte @@ -0,0 +1,215 @@ + + + +{#if !online} +
+
+
+ +
+
+

+ You seem to be offline, please check your internet connection. +

+
+
+
+{/if} +
+ + sidebarIsOpen = !sidebarIsOpen}> + +
+
+ +
+ + + +
+ +
+
+ + +
+
+ +
+
+
+ + + +
+
+
+
+ +
+
+
+
+
+ + +
+ +
+
+
\ No newline at end of file diff --git a/apps/kit/src/routes/(main)/(app)/home/+page.svelte b/apps/kit/src/routes/(main)/(app)/home/+page.svelte new file mode 100644 index 0000000..247ee47 --- /dev/null +++ b/apps/kit/src/routes/(main)/(app)/home/+page.svelte @@ -0,0 +1 @@ +

Welcome Home

\ No newline at end of file diff --git a/apps/kit/src/routes/(main)/(public)/+layout.svelte b/apps/kit/src/routes/(main)/(public)/+layout.svelte new file mode 100644 index 0000000..49aeb95 --- /dev/null +++ b/apps/kit/src/routes/(main)/(public)/+layout.svelte @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/apps/kit/src/routes/(main)/(public)/login/+page.svelte b/apps/kit/src/routes/(main)/(public)/login/+page.svelte new file mode 100644 index 0000000..9e2f6e7 --- /dev/null +++ b/apps/kit/src/routes/(main)/(public)/login/+page.svelte @@ -0,0 +1,136 @@ + + +
+
+

+ {$LL.login.loginToYourAccount()} +

+

+ {$LL.common.or()} + {$LL.login.createANewAccount()} +

+
+
+
+ {#if error.text || error.title} +
+ {#if error.title} +

+ {error.title} +

+ {/if} + {#if error.text} +
+ {error.text} +
+ {/if} +
+ {/if} +
+
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+ + +
+ + +
+ +
+ +
+
+
+
+
diff --git a/apps/kit/src/routes/(main)/(public)/reset/+page.svelte b/apps/kit/src/routes/(main)/(public)/reset/+page.svelte new file mode 100644 index 0000000..5092b4b --- /dev/null +++ b/apps/kit/src/routes/(main)/(public)/reset/+page.svelte @@ -0,0 +1,104 @@ + + +
+
+

+ {$LL.reset.resetPassword()} +

+

+ {$LL.common.or()} + {$LL.reset.gotoLoginPage().toLowerCase()} +

+
+ +
+
+
+ + + +
+ +
+ +
+
+
+ +
+ +
+
+
diff --git a/apps/kit/src/routes/(main)/(public)/signup/+page.svelte b/apps/kit/src/routes/(main)/(public)/signup/+page.svelte new file mode 100644 index 0000000..d4a1bda --- /dev/null +++ b/apps/kit/src/routes/(main)/(public)/signup/+page.svelte @@ -0,0 +1,38 @@ +
+
+

Create your new account

+

+ Or + go to login page +

+
+ +
+
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+
+
+
+
diff --git a/apps/kit/src/routes/(main)/+layout.server.ts b/apps/kit/src/routes/(main)/+layout.server.ts new file mode 100644 index 0000000..01aae89 --- /dev/null +++ b/apps/kit/src/routes/(main)/+layout.server.ts @@ -0,0 +1,13 @@ +// import {is_active} from "$lib/session"; +// import {redirect} from "@sveltejs/kit"; +// import type {LayoutServerLoad} from "./$types"; +// +// export const load: LayoutServerLoad = async ({routeId}) => { +// const sessionIsValid = await is_active(); +// const isPublicRoute = routeId?.startsWith("(public)"); +// if (sessionIsValid && isPublicRoute) { +// throw redirect(302, "/home"); +// } else if (!sessionIsValid && !isPublicRoute) { +// throw redirect(302, "/login"); +// } +// }; \ No newline at end of file diff --git a/apps/kit/src/routes/(main)/+layout.svelte b/apps/kit/src/routes/(main)/+layout.svelte new file mode 100644 index 0000000..e5b177e --- /dev/null +++ b/apps/kit/src/routes/(main)/+layout.svelte @@ -0,0 +1,41 @@ + + + + diff --git a/apps/kit/src/routes/(main)/+layout.ts b/apps/kit/src/routes/(main)/+layout.ts new file mode 100644 index 0000000..de8a5c0 --- /dev/null +++ b/apps/kit/src/routes/(main)/+layout.ts @@ -0,0 +1,9 @@ +import type {Locales} from "$lib/i18n/i18n-types"; +import {loadLocaleAsync} from "$lib/i18n/i18n-util.async"; +import type {LayoutLoad} from "./$types"; + +export const load: LayoutLoad<{ locale: Locales }> = async ({url, params}) => { + let lang = "en" as Locales; + await loadLocaleAsync(lang); + return {locale: lang}; +}; \ No newline at end of file diff --git a/apps/kit/src/routes/(main)/+page.svelte b/apps/kit/src/routes/(main)/+page.svelte new file mode 100644 index 0000000..85a4d2d --- /dev/null +++ b/apps/kit/src/routes/(main)/+page.svelte @@ -0,0 +1,2 @@ + +

Hold on...

diff --git a/apps/kit/src/routes/(public)/+layout.svelte b/apps/kit/src/routes/(public)/+layout.svelte deleted file mode 100644 index 84cd442..0000000 --- a/apps/kit/src/routes/(public)/+layout.svelte +++ /dev/null @@ -1,3 +0,0 @@ - - \ No newline at end of file diff --git a/apps/kit/src/routes/(public)/login/+page.svelte b/apps/kit/src/routes/(public)/login/+page.svelte deleted file mode 100644 index 9e2f6e7..0000000 --- a/apps/kit/src/routes/(public)/login/+page.svelte +++ /dev/null @@ -1,136 +0,0 @@ - - -
-
-

- {$LL.login.loginToYourAccount()} -

-

- {$LL.common.or()} - {$LL.login.createANewAccount()} -

-
-
-
- {#if error.text || error.title} -
- {#if error.title} -

- {error.title} -

- {/if} - {#if error.text} -
- {error.text} -
- {/if} -
- {/if} -
-
- -
- -
-
- -
- -
- -
-
- -
-
- - -
- - -
- -
- -
-
-
-
-
diff --git a/apps/kit/src/routes/(public)/reset/+page.svelte b/apps/kit/src/routes/(public)/reset/+page.svelte deleted file mode 100644 index 5092b4b..0000000 --- a/apps/kit/src/routes/(public)/reset/+page.svelte +++ /dev/null @@ -1,104 +0,0 @@ - - -
-
-

- {$LL.reset.resetPassword()} -

-

- {$LL.common.or()} - {$LL.reset.gotoLoginPage().toLowerCase()} -

-
- -
-
-
- - - -
- -
- -
-
-
- -
- -
-
-
diff --git a/apps/kit/src/routes/(public)/signup/+page.svelte b/apps/kit/src/routes/(public)/signup/+page.svelte deleted file mode 100644 index d4a1bda..0000000 --- a/apps/kit/src/routes/(public)/signup/+page.svelte +++ /dev/null @@ -1,38 +0,0 @@ -
-
-

Create your new account

-

- Or - go to login page -

-
- -
-
-
-
- -
- -
-
- -
- -
- -
-
- -
- -
-
-
-
-
diff --git a/apps/kit/src/routes/+layout.server.ts b/apps/kit/src/routes/+layout.server.ts deleted file mode 100644 index 01aae89..0000000 --- a/apps/kit/src/routes/+layout.server.ts +++ /dev/null @@ -1,13 +0,0 @@ -// import {is_active} from "$lib/session"; -// import {redirect} from "@sveltejs/kit"; -// import type {LayoutServerLoad} from "./$types"; -// -// export const load: LayoutServerLoad = async ({routeId}) => { -// const sessionIsValid = await is_active(); -// const isPublicRoute = routeId?.startsWith("(public)"); -// if (sessionIsValid && isPublicRoute) { -// throw redirect(302, "/home"); -// } else if (!sessionIsValid && !isPublicRoute) { -// throw redirect(302, "/login"); -// } -// }; \ No newline at end of file diff --git a/apps/kit/src/routes/+layout.svelte b/apps/kit/src/routes/+layout.svelte deleted file mode 100644 index f8cdf83..0000000 --- a/apps/kit/src/routes/+layout.svelte +++ /dev/null @@ -1,41 +0,0 @@ - - - - diff --git a/apps/kit/src/routes/+layout.ts b/apps/kit/src/routes/+layout.ts deleted file mode 100644 index de8a5c0..0000000 --- a/apps/kit/src/routes/+layout.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type {Locales} from "$lib/i18n/i18n-types"; -import {loadLocaleAsync} from "$lib/i18n/i18n-util.async"; -import type {LayoutLoad} from "./$types"; - -export const load: LayoutLoad<{ locale: Locales }> = async ({url, params}) => { - let lang = "en" as Locales; - await loadLocaleAsync(lang); - return {locale: lang}; -}; \ No newline at end of file diff --git a/apps/kit/src/routes/+page.svelte b/apps/kit/src/routes/+page.svelte deleted file mode 100644 index 85a4d2d..0000000 --- a/apps/kit/src/routes/+page.svelte +++ /dev/null @@ -1,2 +0,0 @@ - -

Hold on...

diff --git a/apps/kit/src/routes/book/+layout.svelte b/apps/kit/src/routes/book/+layout.svelte index 0fcbd51..85ba907 100644 --- a/apps/kit/src/routes/book/+layout.svelte +++ b/apps/kit/src/routes/book/+layout.svelte @@ -1,9 +1,22 @@
-