yap #1
5 changed files with 92 additions and 61 deletions
|
@ -15,6 +15,8 @@ model User {
|
||||||
createdAt DateTime @default(now())
|
createdAt DateTime @default(now())
|
||||||
lastSeen DateTime @default(now())
|
lastSeen DateTime @default(now())
|
||||||
settings UserSettings?
|
settings UserSettings?
|
||||||
|
// STORED AS MEGABYTES !!
|
||||||
|
maxUpload Int @default(100)
|
||||||
uploads Upload[]
|
uploads Upload[]
|
||||||
sessions Session[]
|
sessions Session[]
|
||||||
}
|
}
|
||||||
|
@ -35,6 +37,11 @@ model UserSettings {
|
||||||
userId Int @unique
|
userId Int @unique
|
||||||
|
|
||||||
newPostsPublic Boolean @default(false)
|
newPostsPublic Boolean @default(false)
|
||||||
|
linkToRaw Boolean @default(false)
|
||||||
|
|
||||||
|
embedTitle String
|
||||||
|
embedDescription String
|
||||||
|
embedColor Int
|
||||||
}
|
}
|
||||||
|
|
||||||
model Upload {
|
model Upload {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<script>
|
<script>
|
||||||
import { fade } from 'svelte/transition';
|
|
||||||
import { Mail, SquareAsterisk, Undo, User, UserPlus } from 'lucide-svelte';
|
import { Mail, SquareAsterisk, Undo, User, UserPlus } from 'lucide-svelte';
|
||||||
import { toast } from 'svelte-sonner';
|
import { toast } from 'svelte-sonner';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
|
@ -10,10 +9,13 @@
|
||||||
import ButtonText from '$lib/components/Inputs/ButtonText.svelte';
|
import ButtonText from '$lib/components/Inputs/ButtonText.svelte';
|
||||||
import ButtonIcon from '$lib/components/Inputs/ButtonIcon.svelte';
|
import ButtonIcon from '$lib/components/Inputs/ButtonIcon.svelte';
|
||||||
|
|
||||||
export let callback;
|
export let callback = () => {};
|
||||||
|
|
||||||
let disabled = false;
|
let disabled = false;
|
||||||
let username, email, password, cpassword;
|
let username = '',
|
||||||
|
email = '',
|
||||||
|
password = '',
|
||||||
|
cpassword = '';
|
||||||
|
|
||||||
async function register() {
|
async function register() {
|
||||||
disabled = true;
|
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>
|
<script>
|
||||||
import { Upload } from 'lucide-svelte';
|
import { Upload } from 'lucide-svelte';
|
||||||
|
import { page } from '$app/stores';
|
||||||
|
|
||||||
import { user } from '$lib/stores';
|
import { user } from '$lib/stores';
|
||||||
|
|
||||||
|
@ -11,9 +12,16 @@
|
||||||
user.set(data?.user);
|
user.set(data?.user);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="w-96 h-[calc(100vh-4.5rem)] flex flex-col gap-2 mx-auto">
|
<div class="w-96 h-[calc(100vh-4.5rem)] flex mx-auto">
|
||||||
<div class="bg-crust w-full mx-auto mt-auto p-2 rounded-lg shadow-lg">
|
<div class="my-auto flex flex-col w-full gap-2">
|
||||||
<button class="w-full outline-2 outline-dotted outline-surface2 rounded-sm bg-mantle h-36 flex">
|
<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">
|
<div class="m-auto text-lg flex text-surface2">
|
||||||
<Upload></Upload>
|
<Upload></Upload>
|
||||||
</div>
|
</div>
|
||||||
|
@ -24,21 +32,18 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="font-bold">Registered Users</td>
|
<td class="font-bold">Registered Users</td>
|
||||||
<td class="text-right">100</td>
|
<td class="text-right">{data?.statistics?.users}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="font-bold">Files Hosted</td>
|
<td class="font-bold">Files Hosted</td>
|
||||||
<td class="text-right">100 Billion</td>
|
<td class="text-right">{data?.statistics?.files}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="font-bold">File Storage</td>
|
<td class="font-bold">File Storage</td>
|
||||||
<td class="text-right">1 TB</td>
|
<td class="text-right">{data?.statistics?.storage}</td>
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="font-bold">Max Upload Size</td>
|
|
||||||
<td class="text-right">100 MB</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</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