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