diff --git a/src/routes/(public)/+layout.server.ts b/src/routes/(public)/+layout.server.ts new file mode 100644 index 0000000..3babdc5 --- /dev/null +++ b/src/routes/(public)/+layout.server.ts @@ -0,0 +1,16 @@ +import { db } from '$lib/server/db'; +import { sponsors } from '$lib/server/schema'; +import { eq, asc } from 'drizzle-orm'; +import type { LayoutServerLoad } from './$types'; + +export const load: LayoutServerLoad = async ({ parent }) => { + const parentData = await parent(); + + const allSponsors = await db + .select() + .from(sponsors) + .where(eq(sponsors.active, true)) + .orderBy(asc(sponsors.sortOrder)); + + return { ...parentData, sponsors: allSponsors }; +}; diff --git a/src/routes/(public)/+layout.svelte b/src/routes/(public)/+layout.svelte new file mode 100644 index 0000000..b49d936 --- /dev/null +++ b/src/routes/(public)/+layout.svelte @@ -0,0 +1,29 @@ + + + + + + + {@html ``} + + +
+
+
+ {@render children()} +
+
diff --git a/src/routes/+layout.server.ts b/src/routes/+layout.server.ts new file mode 100644 index 0000000..21de368 --- /dev/null +++ b/src/routes/+layout.server.ts @@ -0,0 +1,8 @@ +import type { LayoutServerLoad } from './$types'; + +export const load: LayoutServerLoad = async ({ locals }) => { + return { + user: locals.user, + orgConfig: locals.orgConfig + }; +}; diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 9cebde5..aa71a3c 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,11 +1,9 @@ - - - - {@render children()} +