Files
fnx_web/svelte/src/user_home/HotlinkProgressBar.svelte

82 lines
1.9 KiB
Svelte
Raw Normal View History

2025-10-13 16:05:50 +02:00
<script lang="ts">
import ProgressBar from "util/ProgressBar.svelte";
import { formatDataVolume } from "util/Formatting"
2025-10-13 16:05:50 +02:00
import { user } from "lib/UserStore";
2021-10-31 17:38:05 +01:00
2025-10-13 16:05:50 +02:00
let { total = 0, used = 0 }: {
total?: number;
used?: number;
} = $props();
2021-10-31 17:38:05 +01:00
2025-10-13 16:05:50 +02:00
let frac = $derived(used / total)
2021-10-31 17:38:05 +01:00
</script>
2022-01-11 13:28:22 +01:00
<ProgressBar total={total} used={used}></ProgressBar>
<div class="gauge_labels">
<div>
{formatDataVolume(used, 3)}
</div>
<div>
{#if total <= 0}
No limit
{:else}
{formatDataVolume(total, 3)}
{/if}
</div>
</div>
2021-10-31 17:38:05 +01:00
{#if frac > 1}
2022-04-19 13:02:31 +02:00
<div class="highlight_yellow">
<p>
You have used all of your data cap. People can still download your
files, but premium features are disabled. This means that the
2026-06-10 23:53:03 +02:00
download page shows Nova branding, people who download your
files have a daily download limit and hotlinking is disabled.
</p>
2025-10-13 16:05:50 +02:00
{#if $user.monthly_transfer_cap > 0}
<p>
You have a billshock limit configured. <a
href="/user/sharing/bandwidth">increase or disable the limit</a> to
continue sharing files.
</p>
{/if}
<a class="button button_highlight" href="/#pro">
<i class="icon">bolt</i> Upgrade options
2022-01-11 13:28:22 +01:00
</a>
</div>
{:else if frac > 0.8}
2022-04-19 13:02:31 +02:00
<div class="highlight_blue">
<p>
You have used {(frac*100).toFixed(0)}% of your data cap. If your
data runs out the premium features related to downloading will be
2026-06-10 23:53:03 +02:00
disabled. This means that the download page shows Nova
branding, people who download your files have a daily download limit
and hotlinking is disabled.
</p>
2025-10-13 16:05:50 +02:00
{#if $user.monthly_transfer_cap > 0}
<p>
You have a billshock limit configured. <a
href="/user/sharing/bandwidth">increase or disable the limit</a> to
continue sharing files.
</p>
{/if}
<a class="button button_highlight" href="/#pro">
<i class="icon">bolt</i> Upgrade options
2022-01-11 13:28:22 +01:00
</a>
</div>
{/if}
<style>
.gauge_labels {
display: flex;
justify-content: space-between;
}
.gauge_labels > div {
flex: 0 0 auto;
}
</style>