diff --git a/src/routes/(app)/+layout.svelte b/src/routes/(app)/+layout.svelte
new file mode 100644
index 00000000..4bfb97ef
--- /dev/null
+++ b/src/routes/(app)/+layout.svelte
@@ -0,0 +1,287 @@
+
+
+{#if dev}
+
Visit svelte.dev/docs/kit to read the documentation
diff --git a/src/routes/(app)/[username]/+page.server.ts b/src/routes/(app)/[username]/+page.server.ts new file mode 100644 index 00000000..e4216f1c --- /dev/null +++ b/src/routes/(app)/[username]/+page.server.ts @@ -0,0 +1,35 @@ +import type { PageServerLoad } from './$types' +import { error } from '@sveltejs/kit' +import { userAdapter } from '$lib/api/adapters/user.adapter' +import { parseParty } from '$lib/api/schemas/party' + +export const load: PageServerLoad = async ({ params, url, depends, locals }) => { + depends('app:profile') + const username = params.username + const pageParam = url.searchParams.get('page') + const page = pageParam ? Math.max(1, parseInt(pageParam, 10) || 1) : 1 + const tab = url.searchParams.get('tab') === 'favorites' ? 'favorites' : 'teams' + const isOwner = locals.session?.account?.username === username + + try { + if (tab === 'favorites' && isOwner) { + const fav = await userAdapter.getFavorites({ page }) + return { + user: { username } as any, + items: fav.items, + page: fav.page, + total: fav.total, + totalPages: fav.totalPages, + perPage: fav.perPage, + tab, + isOwner + } + } + + const { user, items, total, totalPages, perPage } = await userAdapter.getProfile(username, page) + const parties = items.map((p) => parseParty(p)) + return { user, items: parties, page, total, totalPages, perPage, tab, isOwner } + } catch (e: any) { + throw error(e?.status || 502, e?.message || 'Failed to load profile') + } +} diff --git a/src/routes/(app)/[username]/+page.svelte b/src/routes/(app)/[username]/+page.svelte new file mode 100644 index 00000000..4174c130 --- /dev/null +++ b/src/routes/(app)/[username]/+page.svelte @@ -0,0 +1,263 @@ + + +Loading {tab}...
+Failed to load {tab}: {partiesQuery.error?.message || 'Unknown error'}
+ +{tab === 'favorites' ? 'No favorite teams yet' : 'No teams found'}
+You've seen all {tab === 'favorites' ? 'favorites' : 'teams'}!
+{JSON.stringify(data, null, 2)}
diff --git a/src/routes/(app)/about/+page.ts b/src/routes/(app)/about/+page.ts
new file mode 100644
index 00000000..662ce0ad
--- /dev/null
+++ b/src/routes/(app)/about/+page.ts
@@ -0,0 +1,8 @@
+import { PUBLIC_SIERO_API_URL } from '$env/static/public'
+
+export const load = async ({ fetch }) => {
+ const apiBase = PUBLIC_SIERO_API_URL || 'http://localhost:3000'
+ const response = await fetch(`${apiBase}/api/v1/version`)
+ const status = await response.json()
+ return { status }
+}
diff --git a/src/routes/(app)/api/settings/+server.ts b/src/routes/(app)/api/settings/+server.ts
new file mode 100644
index 00000000..4c9f745c
--- /dev/null
+++ b/src/routes/(app)/api/settings/+server.ts
@@ -0,0 +1,25 @@
+import { json } from '@sveltejs/kit'
+import type { RequestHandler } from './$types'
+import { setUserCookie } from '$lib/auth/cookies'
+import type { UserCookie } from '$lib/types/UserCookie'
+
+export const POST: RequestHandler = async ({ cookies, request }) => {
+ try {
+ const userCookie = await request.json() as UserCookie
+
+ // Calculate expiry date (60 days from now)
+ const expires = new Date()
+ expires.setDate(expires.getDate() + 60)
+
+ // Set the user cookie with the updated data
+ setUserCookie(cookies, userCookie, {
+ secure: true,
+ expires
+ })
+
+ return json({ success: true })
+ } catch (error) {
+ console.error('Failed to update settings cookie:', error)
+ return json({ error: 'Failed to update settings' }, { status: 500 })
+ }
+}
\ No newline at end of file
diff --git a/src/routes/(app)/collection/+page.svelte b/src/routes/(app)/collection/+page.svelte
new file mode 100644
index 00000000..6a629bc0
--- /dev/null
+++ b/src/routes/(app)/collection/+page.svelte
@@ -0,0 +1,31 @@
+Your collection in Granblue Fantasy
+ +The character you're looking for could not be found.
+ ++ {summon.callDescription || 'No description available'} +
+No call effect information available
+ {/if} ++ {summon.auraDescription || 'No description available'} +
+No aura effect information available
+ {/if} ++ {summon.subAuraDescription || 'No description available'} +
+The summon you're looking for could not be found.
+ +{skill.description || 'No description available'}
+No skills available
+ {/if} +The weapon you're looking for could not be found.
+ +Guides and resources for Granblue Fantasy players.
+ +@{account.username}
+ + +No party data available for this code.
+Loading teams...
+Failed to load teams: {partiesQuery.error?.message || 'Unknown error'}
+ +No teams found
+You've reached the end of all teams!
+Search and click items to add them to your grid
+Details:
++ Test both interaction methods: +
+
+ {/snippet}
+
+ {#snippet contextMenu()}
+ {imageUrl}
+ Note: Image will show error state if file doesn't exist
+