Files
web-app-launcher/src/routes/+layout.server.ts
T
alexei.dolgolyov 0bd30c5e17 feat(mvp): phase 7 - UI polish & ambient backgrounds
Add layout system (sidebar, header, main layout), dark/light/system theme
with HSL customization, 3 ambient backgrounds (mesh gradient, particle field,
aurora), Cmd/Ctrl+K search dialog, page transitions, card hover effects,
status pulse animations, skeleton loaders, and responsive design. Polish
all existing pages with consistent theming.
2026-03-24 21:37:16 +03:00

41 lines
1.2 KiB
TypeScript

import type { LayoutServerLoad } from './$types.js';
import { prisma } from '$lib/server/prisma.js';
export const load: LayoutServerLoad = async ({ locals }) => {
// Fetch sidebar boards for the layout
let boards: Array<{ id: string; name: string; icon: string | null }> = [];
try {
if (locals.user) {
// Authenticated user: fetch boards they can access
if (locals.user.role === 'admin') {
boards = await prisma.board.findMany({
select: { id: true, name: true, icon: true },
orderBy: [{ isDefault: 'desc' }, { name: 'asc' }]
});
} else {
// Regular users: fetch all boards (permission filtering done at page level)
boards = await prisma.board.findMany({
select: { id: true, name: true, icon: true },
orderBy: [{ isDefault: 'desc' }, { name: 'asc' }]
});
}
} else {
// Guest: only guest-accessible boards
boards = await prisma.board.findMany({
where: { isGuestAccessible: true },
select: { id: true, name: true, icon: true },
orderBy: [{ isDefault: 'desc' }, { name: 'asc' }]
});
}
} catch {
// Fail gracefully — sidebar will just be empty
boards = [];
}
return {
user: locals.user,
sidebarBoards: boards
};
};