Commit e033a1d9 authored by wycers's avatar wycers
Browse files

problem page

parent 8156b854
Loading
Loading
Loading
Loading
+18 −0
+1189 −10

File changed.

Preview size limit exceeded, changes collapsed.

+16 −1
Original line number Diff line number Diff line
<script>
	import { ClassSwitcher, DashboardMainNav, Search, UserNav } from '$lib/components/dashboard';
	import '../app.pcss';
</script>

<div class="hidden flex-col md:flex">
	<div class="border-b">
		<div class="flex h-16 items-center px-4">
			<ClassSwitcher />
			<DashboardMainNav class="mx-6" />
			<div class="ml-auto flex items-center space-x-4">
				<Search />
				<UserNav />
			</div>
		</div>
	</div>
	<div class="flex-1 space-y-4 p-8 pt-6">
		<slot />
	</div>
</div>
+114 −9
Original line number Diff line number Diff line
<script>
	import Tiptap from '$lib/Tiptap.svelte';
<script lang="ts">
	import Activity from 'lucide-svelte/icons/activity';
	import CreditCard from 'lucide-svelte/icons/credit-card';
	import DollarSign from 'lucide-svelte/icons/dollar-sign';
	import Download from 'lucide-svelte/icons/download';
	import Users from 'lucide-svelte/icons/users';
	import { Button } from '$lib/components/ui/button';
	import * as Card from '$lib/components/ui/card';
	import * as Tabs from '$lib/components/ui/tabs';
	import {
		DashboardMainNav,
		Overview,
		RecentSales,
		Search,
		UserNav,
		ClassSwitcher
	} from '$lib/components/dashboard';
	// import DatePickerWithRange from "@/registry/new-york/example/date-picker-with-range.svelte";
</script>

<h1>Welcome to SvelteKit</h1>
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>

<Tiptap />
<Button>Click me</Button>

<!-- <div class="md:hidden">
	<img
		src="/examples/dashboard-light.png"
		width={1280}
		height={866}
		alt="Dashboard"
		class="block dark:hidden"
	/>
	<img
		src="/examples/dashboard-dark.png"
		width={1280}
		height={866}
		alt="Dashboard"
		class="hidden dark:block"
	/>
</div> -->
<div class="flex items-center justify-between space-y-2">
	<h2 class="text-3xl font-bold tracking-tight">Dashboard</h2>
	<div class="flex items-center space-x-2">
		<!-- <DatePickerWithRange /> -->
		<Button size="sm">
			<Download class="mr-2 h-4 w-4" />
			Download
		</Button>
	</div>
</div>
<Tabs.Root value="overview" class="space-y-4">
	<Tabs.List>
		<Tabs.Trigger value="overview">Overview</Tabs.Trigger>
		<Tabs.Trigger value="analytics" disabled>Analytics</Tabs.Trigger>
		<Tabs.Trigger value="reports" disabled>Reports</Tabs.Trigger>
		<Tabs.Trigger value="notifications" disabled>Notifications</Tabs.Trigger>
	</Tabs.List>
	<Tabs.Content value="overview" class="space-y-4">
		<div class="grid gap-4 md:grid-cols-2 lg:grid-cols-4">
			<Card.Root>
				<Card.Header class="flex flex-row items-center justify-between space-y-0 pb-2">
					<Card.Title class="text-sm font-medium">Total Revenue</Card.Title>
					<DollarSign class="h-4 w-4 text-muted-foreground" />
				</Card.Header>
				<Card.Content>
					<div class="text-2xl font-bold">$45,231.89</div>
					<p class="text-xs text-muted-foreground">+20.1% from last month</p>
				</Card.Content>
			</Card.Root>
			<Card.Root>
				<Card.Header class="flex flex-row items-center justify-between space-y-0 pb-2">
					<Card.Title class="text-sm font-medium">Subscriptions</Card.Title>
					<Users class="h-4 w-4 text-muted-foreground" />
				</Card.Header>
				<Card.Content>
					<div class="text-2xl font-bold">+2350</div>
					<p class="text-xs text-muted-foreground">+180.1% from last month</p>
				</Card.Content>
			</Card.Root>
			<Card.Root>
				<Card.Header class="flex flex-row items-center justify-between space-y-0 pb-2">
					<Card.Title class="text-sm font-medium">Sales</Card.Title>
					<CreditCard class="h-4 w-4 text-muted-foreground" />
				</Card.Header>
				<Card.Content>
					<div class="text-2xl font-bold">+12,234</div>
					<p class="text-xs text-muted-foreground">+19% from last month</p>
				</Card.Content>
			</Card.Root>
			<Card.Root>
				<Card.Header class="flex flex-row items-center justify-between space-y-0 pb-2">
					<Card.Title class="text-sm font-medium">Active Now</Card.Title>
					<Activity class="h-4 w-4 text-muted-foreground" />
				</Card.Header>
				<Card.Content>
					<div class="text-2xl font-bold">+573</div>
					<p class="text-xs text-muted-foreground">+201 since last hour</p>
				</Card.Content>
			</Card.Root>
		</div>
		<div class="grid gap-4 md:grid-cols-2 lg:grid-cols-7">
			<Card.Root class="col-span-4">
				<Card.Header>
					<Card.Title>Overview</Card.Title>
				</Card.Header>
				<Card.Content>
					<Overview />
				</Card.Content>
			</Card.Root>
			<Card.Root class="col-span-3">
				<Card.Header>
					<Card.Title>Recent Sales</Card.Title>
					<Card.Description>You made 265 sales this month.</Card.Description>
				</Card.Header>
				<Card.Content>
					<RecentSales />
				</Card.Content>
			</Card.Root>
		</div>
	</Tabs.Content>
</Tabs.Root>
+21 −0
Original line number Diff line number Diff line
import { db } from '$lib/db/db.server';
import { problem } from '$lib/drizzle/schema';
import { error, redirect, type ServerLoad } from '@sveltejs/kit';
import { eq } from 'drizzle-orm';
import _ from 'lodash';

export const load: ServerLoad = async ({ params }) => {
	const id = _.toNumber(params.id);
	const p = await db.query.problem.findFirst({ where: eq(problem.id, id) });
	console.log(p);

	if (_.isNil(p)) {
		error(404, {
			message: 'Not found'
		});
	}

	return {
		data: p.description
	};
};
Loading