yap #1
5 changed files with 92 additions and 61 deletions
|
@ -15,6 +15,8 @@ model User {
|
|||
createdAt DateTime @default(now())
|
||||
lastSeen DateTime @default(now())
|
||||
settings UserSettings?
|
||||
// STORED AS MEGABYTES !!
|
||||
maxUpload Int @default(100)
|
||||
uploads Upload[]
|
||||
sessions Session[]
|
||||
}
|
||||
|
@ -35,6 +37,11 @@ model UserSettings {
|
|||
userId Int @unique
|
||||
|
||||
newPostsPublic Boolean @default(false)
|
||||
linkToRaw Boolean @default(false)
|
||||
|
||||
embedTitle String
|
||||
embedDescription String
|
||||
embedColor Int
|
||||
}
|
||||
|
||||
model Upload {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<script>
|
||||
import { fade } from 'svelte/transition';
|
||||
import { Mail, SquareAsterisk, Undo, User, UserPlus } from 'lucide-svelte';
|
||||
import { toast } from 'svelte-sonner';
|
||||
import { goto } from '$app/navigation';
|
||||
|
@ -10,10 +9,13 @@
|
|||
import ButtonText from '$lib/components/Inputs/ButtonText.svelte';
|
||||
import ButtonIcon from '$lib/components/Inputs/ButtonIcon.svelte';
|
||||
|
||||
export let callback;
|
||||
export let callback = () => {};
|
||||
|
||||
let disabled = false;
|
||||
let username, email, password, cpassword;
|
||||
let username = '',
|
||||
email = '',
|
||||
password = '',
|
||||
cpassword = '';
|
||||
|
||||
async function register() {
|
||||
disabled = true;
|
||||
|
|
7
src/routes/(app)/dashboard/+page.js
Normal file
7
src/routes/(app)/dashboard/+page.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
/** @type {import("@sveltejs/kit").Load } */
|
||||
export async function load({ fetch }) {
|
||||
const response = await fetch('/api/statistics');
|
||||
const statistics = await response.json();
|
||||
|
||||
return { statistics };
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
<script>
|
||||
import { Upload } from 'lucide-svelte';
|
||||
import { page } from '$app/stores';
|
||||
|
||||
import { user } from '$lib/stores';
|
||||
|
||||
|
@ -11,9 +12,16 @@
|
|||
user.set(data?.user);
|
||||
</script>
|
||||
|
||||
<div class="w-96 h-[calc(100vh-4.5rem)] flex flex-col gap-2 mx-auto">
|
||||
<div class="bg-crust w-full mx-auto mt-auto p-2 rounded-lg shadow-lg">
|
||||
<button class="w-full outline-2 outline-dotted outline-surface2 rounded-sm bg-mantle h-36 flex">
|
||||
<div class="w-96 h-[calc(100vh-4.5rem)] flex mx-auto">
|
||||
<div class="my-auto flex flex-col w-full gap-2">
|
||||
<div>
|
||||
<h1 class="text-2xl font-bold">Welcome, {$page.data.user.username}.</h1>
|
||||
<p class="text-overlay1">Your max upload size is <span class="font-bold">100 MB</span>.</p>
|
||||
</div>
|
||||
<div class="bg-crust w-full mx-auto p-2 rounded-lg shadow-lg">
|
||||
<button
|
||||
class="w-full outline-2 outline-dotted outline-surface2 rounded-sm bg-mantle h-36 flex"
|
||||
>
|
||||
<div class="m-auto text-lg flex text-surface2">
|
||||
<Upload></Upload>
|
||||
</div>
|
||||
|
@ -24,21 +32,18 @@
|
|||
<tbody>
|
||||
<tr>
|
||||
<td class="font-bold">Registered Users</td>
|
||||
<td class="text-right">100</td>
|
||||
<td class="text-right">{data?.statistics?.users}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font-bold">Files Hosted</td>
|
||||
<td class="text-right">100 Billion</td>
|
||||
<td class="text-right">{data?.statistics?.files}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font-bold">File Storage</td>
|
||||
<td class="text-right">1 TB</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font-bold">Max Upload Size</td>
|
||||
<td class="text-right">100 MB</td>
|
||||
<td class="text-right">{data?.statistics?.storage}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
10
src/routes/api/statistics/+server.js
Normal file
10
src/routes/api/statistics/+server.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
import { json } from '@sveltejs/kit';
|
||||
|
||||
/** @type {import("@sveltejs/kit").RequestHandler} */
|
||||
export async function GET() {
|
||||
return json({
|
||||
users: ':3',
|
||||
files: 'dick',
|
||||
storage: '100 gigafarts'
|
||||
});
|
||||
}
|
Loading…
Reference in a new issue