Project Refactoring

This commit is contained in:
Aleksi Lassila
2023-07-09 15:50:04 +03:00
parent 56ef4ee865
commit 494a3bf85a
83 changed files with 319 additions and 276 deletions

View File

@@ -0,0 +1,34 @@
<script lang="ts">
import { formatSize, log } from '$lib/utils.js';
import StatsPlaceholder from './StatsPlaceholder.svelte';
import StatsContainer from './StatsContainer.svelte';
import RadarrIcon from '../svgs/RadarrIcon.svelte';
export let large = false;
async function fetchStats() {
return fetch('/radarr/stats')
.then((res) => res.json())
.then(log)
.then((data) => ({
moviesAmount: data?.movies?.length
}));
}
</script>
{#await fetchStats()}
<StatsPlaceholder {large} />
{:then { moviesAmount }}
<StatsContainer
{large}
title="Radarr"
subtitle="Movies Provider"
stats={[
{ title: 'Movies', value: String(moviesAmount) },
{ title: 'Space Taken', value: formatSize(120_000_000_000) },
{ title: 'Space Left', value: formatSize(50_000_000_000) }
]}
>
<RadarrIcon slot="icon" class="absolute opacity-20 p-4 h-full inset-y-0 right-2" />
</StatsContainer>
{/await}