Skip to content

Commit 8dd8565

Browse files
committed
ui: improve login and register
1 parent df40c53 commit 8dd8565

5 files changed

Lines changed: 25 additions & 13 deletions

File tree

new-deepnotes/apps/web/src/App.vue

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<script setup lang="ts">
2-
import { onMounted } from "vue";
2+
import { computed, onMounted } from "vue";
33
import { RouterView, useRoute } from "vue-router";
44
5+
import AuthLayout from "@/layouts/AuthLayout.vue";
56
import DefaultLayout from "@/layouts/DefaultLayout.vue";
67
78
import { useSession } from "./features/auth/useSession";
@@ -14,21 +15,26 @@ const { bootstrap, user, bootstrapped } = useSession();
1415
useRealtimeUserChannel(user);
1516
const route = useRoute();
1617
18+
const layout = computed(() => {
19+
if (route.meta.layout === "auth") return AuthLayout;
20+
return DefaultLayout;
21+
});
22+
1723
onMounted(() => {
1824
void bootstrap();
1925
});
2026
</script>
2127

2228
<template>
23-
<DefaultLayout data-testid="app-shell">
29+
<component :is="layout" data-testid="app-shell">
2430
<div
2531
v-if="!bootstrapped"
2632
class="text-muted-foreground flex min-h-[40vh] items-center justify-center text-sm"
2733
>
2834
Loading session…
2935
</div>
3036
<RouterView v-else :key="route.path" />
31-
</DefaultLayout>
37+
</component>
3238
<div
3339
v-if="realtimeToastMessage"
3440
class="bg-card fixed bottom-4 left-1/2 z-50 max-w-md -translate-x-1/2 rounded-md border px-4 py-2 text-sm shadow-lg"

new-deepnotes/apps/web/src/features/auth/LoginView.vue

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,8 @@ async function onSubmit() {
8383
</script>
8484

8585
<template>
86-
<div class="flex flex-1 flex-col items-center justify-center px-4 py-12">
87-
<div class="w-full max-w-sm">
88-
<Card>
86+
<div class="w-full max-w-sm">
87+
<Card>
8988
<CardHeader class="pb-4">
9089
<CardTitle class="text-lg">Sign in</CardTitle>
9190
<CardDescription>
@@ -257,5 +256,4 @@ async function onSubmit() {
257256
</CardFooter>
258257
</Card>
259258
</div>
260-
</div>
261259
</template>

new-deepnotes/apps/web/src/features/auth/RegisterView.vue

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,8 @@ async function onSubmit() {
7777
</script>
7878

7979
<template>
80-
<div class="flex flex-1 flex-col items-center justify-center px-4 py-12">
81-
<div class="w-full max-w-sm">
82-
<Card>
80+
<div class="w-full max-w-sm">
81+
<Card>
8382
<CardHeader class="pb-4">
8483
<CardTitle class="text-lg">Register</CardTitle>
8584
<CardDescription>
@@ -232,5 +231,4 @@ async function onSubmit() {
232231
</CardFooter>
233232
</Card>
234233
</div>
235-
</div>
236234
</template>

new-deepnotes/apps/web/src/features/auth/auth-routes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ export const authRoutes: RouteRecordRaw[] = [
55
path: "/login",
66
name: "login",
77
component: () => import("./LoginView.vue"),
8-
meta: { public: true },
8+
meta: { public: true, layout: "auth" },
99
},
1010
{
1111
path: "/register",
1212
name: "register",
1313
component: () => import("./RegisterView.vue"),
14-
meta: { public: true },
14+
meta: { public: true, layout: "auth" },
1515
},
1616
];
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<script setup lang="ts">
2+
</script>
3+
4+
<template>
5+
<div
6+
class="bg-background text-foreground flex min-h-svh items-center justify-center px-4 py-12"
7+
>
8+
<slot />
9+
</div>
10+
</template>

0 commit comments

Comments
 (0)