Skip to content

Commit 247dd0d

Browse files
authored
Merge pull request #4 from amcelroy/home
Home
2 parents 70197e0 + a1f928c commit 247dd0d

File tree

10 files changed

+115
-74
lines changed

10 files changed

+115
-74
lines changed

.github/workflows/main.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
name: Sveltekit / Postgres CI/CD
2-
on: [push]
2+
on:
3+
push:
4+
branches:
5+
- "*"
6+
pull_request:
7+
branches:
8+
[main]
39
jobs:
410
Unit-Test-Actions:
511
runs-on: ubuntu-latest

src/lib/components/Page.svelte

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<script lang="ts">
2+
import * as Breadcrumb from "$lib/components/ui/breadcrumb/index.js";
3+
4+
export let name;
5+
6+
export let path: any[] = [];
7+
8+
export let menu: any[] = [];
9+
</script>
10+
11+
<div class="p-4 top-0 border-b w-full">
12+
<Breadcrumb.Root>
13+
<Breadcrumb.List>
14+
{#each path as item, i}
15+
<Breadcrumb.Item>
16+
<Breadcrumb.Link href={item.href}>{item.name}</Breadcrumb.Link>
17+
</Breadcrumb.Item>
18+
<Breadcrumb.Separator />
19+
{/each}
20+
{#each menu as item, i}
21+
<Breadcrumb.Item>
22+
<Breadcrumb.Link href={item.href}>{item.name}</Breadcrumb.Link>
23+
</Breadcrumb.Item>
24+
<Breadcrumb.Separator />
25+
{/each}
26+
<Breadcrumb.Item>
27+
<Breadcrumb.Page>{name}</Breadcrumb.Page>
28+
</Breadcrumb.Item>
29+
</Breadcrumb.List>
30+
</Breadcrumb.Root>
31+
</div>
32+
<div class="p-4 m-4">
33+
<slot></slot>
34+
</div>

src/routes/+page.server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const load: PageServerLoad = (async (event) => {
1717
// Check if the session is valid
1818
const session_valid = await lucia.validateSession(auth_token);
1919
if(session_valid){
20-
redirect(302, "/dashboard");
20+
redirect(302, "/home");
2121
}
2222
}
2323

@@ -66,6 +66,6 @@ export const actions: Actions = {
6666
...sessionCookie.attributes
6767
});
6868

69-
redirect(302, "/dashboard");
69+
redirect(302, "/home");
7070
}
7171
};

src/routes/dashboard/+page.svelte

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/routes/dashboard/profile/+page.svelte

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
<script lang="ts">
2-
import { icons } from "lucide-svelte";
3-
import "../../app.css";
2+
import "../../app.css";
43
import Icon from '@iconify/svelte';
5-
64
</script>
75

86
<div class="flex flex-row">
97
<aside style="fixed top-0 left-0 flex-shrink" aria-label="Sidenav">
108
<div class="group flex flex-col justify-between py-5 px-1 bg-white border-r border-gray-200 dark:bg-gray-800 dark:border-gray-700 h-screen">
119
<div class="">
12-
<a class="flex items-center p-2 text-base font-normal text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700 group" href="/dashboard">
13-
<Icon icon="hugeicons:dashboard-browsing" style="font-size: 24px"/>
14-
<span class="ml-3 hidden group-hover:block md:block">Dashboard</span>
10+
<a class="flex items-center p-2 text-base font-normal text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700 group" href="/home">
11+
<Icon icon="hugeicons:house-01" style="font-size: 24px"/>
12+
<span class="ml-3 hidden group-hover:block md:block">Home</span>
1513
</a>
1614

17-
<a class="flex items-center p-2 text-base font-normal text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700 group" href="/dashboard/profile">
15+
<a class="flex items-center p-2 text-base font-normal text-gray-900 rounded-lg dark:text-white hover:bg-gray-100 dark:hover:bg-gray-700 group" href="/home/profile">
1816
<Icon icon="hugeicons:profile-02" style="font-size: 24px"/>
1917
<span class="ml-3 hidden group-hover:block md:block">Profile</span>
2018
</a>
@@ -30,7 +28,7 @@ import "../../app.css";
3028
</div>
3129
</div>
3230
</aside>
33-
<div class="p-4 top-0">
31+
<div class="grow">
3432
<slot></slot>
35-
</div>
33+
</div>
3634
</div>

src/routes/dashboard/+page.server.ts renamed to src/routes/home/+page.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ export const load: PageServerLoad = (async (event) => {
1616
if(profile?.profileComplete) {
1717
return { profile }
1818
}else{
19-
redirect(302, "/dashboard/profile");
19+
redirect(302, "/home/profile");
2020
}
2121
})

src/routes/home/+page.svelte

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<script lang="ts">
2+
import { onMount } from 'svelte';
3+
import Page from '$lib/components/Page.svelte';
4+
5+
export let data;
6+
7+
onMount(() => {
8+
9+
});
10+
</script>
11+
12+
<Page name="Home">
13+
14+
</Page>
15+
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<script lang="ts">
2+
import { onMount } from 'svelte';
3+
import SuperDebug, { type SuperValidated, superForm, type Infer } from 'sveltekit-superforms';
4+
import { zodClient } from 'sveltekit-superforms/adapters';
5+
import { schemaProfile, type SchemaProfile } from '$lib/validationSchemas.js';
6+
import * as Drawer from '$lib/components/ui/drawer';
7+
import { Button } from '$lib/components/ui/button';
8+
import ProfileForm from '$lib/components/forms/ProfileForm.svelte';
9+
import Page from '$lib/components/Page.svelte';
10+
11+
export let data: any;
12+
13+
var profileComplete = (data.profileComplete as boolean);
14+
15+
onMount(() => {
16+
console.log('Profile page mounted');
17+
});
18+
19+
</script>
20+
21+
<Page name="Profile" path={
22+
[
23+
{name: 'Home', href: '/home'},
24+
]
25+
}>
26+
{#if !profileComplete}
27+
<Drawer.Root open={!profileComplete} onOutsideClick={(event) => {event.preventDefault();}} dismissible={false}>
28+
<!-- <Drawer.Trigger asChild let:builder> -->
29+
<!-- <Button builders={[builder]} variant="outline">Open Drawer</Button> -->
30+
<!-- </Drawer.Trigger> -->
31+
<Drawer.Content>
32+
<div class="w-2/12 sm:w-2/12 md:w-4/12 lg:w-8/12 flex justify-center mx-auto mt-auto">
33+
<div class="">
34+
<div class="p-1">
35+
<p>We noticed you haven't completed your profile. Please fill out the form below.</p>
36+
</div>
37+
<ProfileForm {data} />
38+
</div>
39+
</div>
40+
</Drawer.Content>
41+
</Drawer.Root>
42+
{:else}
43+
<h1 class="text-3xl mb-4">
44+
Profile
45+
</h1>
46+
<ProfileForm {data} />
47+
{/if}
48+
</Page>
49+
<!-- <SuperDebug data={$formData} /> -->

0 commit comments

Comments
 (0)