loading on stats
This commit is contained in:
parent
046521f116
commit
4ccbd13e0b
3 changed files with 40 additions and 32 deletions
|
@ -8,23 +8,24 @@ generator client {
|
|||
}
|
||||
|
||||
model User {
|
||||
id Int @id @default(autoincrement())
|
||||
username String @unique
|
||||
email String @unique
|
||||
password String
|
||||
createdAt DateTime @default(now())
|
||||
lastSeen DateTime @default(now())
|
||||
settings UserSettings?
|
||||
id Int @id @default(autoincrement())
|
||||
username String @unique
|
||||
email String @unique
|
||||
password String
|
||||
createdAt DateTime @default(now())
|
||||
lastSeen DateTime @default(now())
|
||||
settings UserSettings?
|
||||
// STORED AS MEGABYTES !!
|
||||
maxUpload Int @default(100)
|
||||
uploads Upload[]
|
||||
sessions Session[]
|
||||
maxUploadMB Int @default(100)
|
||||
uploads Upload[]
|
||||
sessions Session[]
|
||||
}
|
||||
|
||||
model Session {
|
||||
id String @id @unique
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
userId Int
|
||||
id String @id @unique
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
userId Int
|
||||
|
||||
authorized Boolean
|
||||
createdAt DateTime @default(now())
|
||||
expiresAt DateTime
|
||||
|
@ -45,9 +46,8 @@ model UserSettings {
|
|||
}
|
||||
|
||||
model Upload {
|
||||
id String @id
|
||||
|
||||
uploader User @relation(fields: [uploaderId], references: [id])
|
||||
id String @id
|
||||
uploader User @relation(fields: [uploaderId], references: [id])
|
||||
uploaderId Int
|
||||
|
||||
fileName String @unique
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
/** @type {import("@sveltejs/kit").Load } */
|
||||
export async function load({ fetch }) {
|
||||
const response = await fetch('/api/statistics');
|
||||
const statistics = await response.json();
|
||||
export function load({ fetch }) {
|
||||
const statistics = fetch('/api/statistics').then((response) => response.json());
|
||||
|
||||
return { statistics };
|
||||
return {
|
||||
streamed: {
|
||||
statistics
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
import Button from '$lib/components/Inputs/Button.svelte';
|
||||
import ButtonText from '$lib/components/Inputs/ButtonText.svelte';
|
||||
import { fade } from 'svelte/transition';
|
||||
|
||||
export let data;
|
||||
|
||||
|
@ -30,18 +31,22 @@
|
|||
<div class="bg-crust w-full mx-auto mb-auto p-2 rounded-lg shadow-lg">
|
||||
<table class="table-auto w-full mx-auto text-sm">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="font-bold">Registered Users</td>
|
||||
<td class="text-right">{data?.statistics?.users}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font-bold">Files Hosted</td>
|
||||
<td class="text-right">{data?.statistics?.files}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font-bold">File Storage</td>
|
||||
<td class="text-right">{data?.statistics?.storage}</td>
|
||||
</tr>
|
||||
{#await data?.streamed?.statistics}
|
||||
<div class="h-[66px]"></div>
|
||||
{:then statistics}
|
||||
<tr in:fade={{ delay: 60 * 1 }}>
|
||||
<td class="font-bold">Registered Users</td>
|
||||
<td class="text-right">{statistics?.users}</td>
|
||||
</tr>
|
||||
<tr in:fade={{ delay: 60 * 2 }}>
|
||||
<td class="font-bold">Files Hosted</td>
|
||||
<td class="text-right">{statistics?.files}</td>
|
||||
</tr>
|
||||
<tr in:fade={{ delay: 60 * 3 }}>
|
||||
<td class="font-bold">File Storage</td>
|
||||
<td class="text-right">{statistics?.storage}</td>
|
||||
</tr>
|
||||
{/await}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue