Styling fixes and progressbar class
This commit is contained in:
@@ -197,16 +197,16 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="feat_label">
|
<div class="feat_label">
|
||||||
Hotlinking
|
Transfer limit
|
||||||
</div>
|
</div>
|
||||||
<div class="feat_normal">
|
<div class="feat_normal">
|
||||||
Rate limiting mode will be enabled when a file has 3
|
Rate limiting mode will be enabled when a file has 3
|
||||||
times more downloads than views
|
times more downloads than views
|
||||||
</div>
|
</div>
|
||||||
<div class="feat_pro">
|
<div class="feat_pro">
|
||||||
<span class="text_highlight">1 terabyte</span> of
|
Transfer limit of <span class="text_highlight">1
|
||||||
direct downloads per 30 days. Never have to enter a
|
terabyte</span>. If the transfer limit is exceeded files
|
||||||
CAPTCHA while logged in
|
will show ads again and rate limiting is enabled
|
||||||
<br/>
|
<br/>
|
||||||
<button class="round" onclick="return explainDirectLinking()">
|
<button class="round" onclick="return explainDirectLinking()">
|
||||||
<i class="icon">info</i>
|
<i class="icon">info</i>
|
||||||
@@ -297,7 +297,7 @@
|
|||||||
<div class="feat_pro features_cell round_tr">
|
<div class="feat_pro features_cell round_tr">
|
||||||
<div><span class="text_highlight">20 GB</span> max file size (18.63 GiB)<br/></div>
|
<div><span class="text_highlight">20 GB</span> max file size (18.63 GiB)<br/></div>
|
||||||
<div><span class="text_highlight">120 days</span> file expiry</div>
|
<div><span class="text_highlight">120 days</span> file expiry</div>
|
||||||
<div><span class="text_highlight">2 TB</span> hotlink bandwidth<br/></div>
|
<div><span class="text_highlight">2 TB</span> transfer limit<br/></div>
|
||||||
<div><span class="text_highlight">2 TB</span> storage space<br/></div>
|
<div><span class="text_highlight">2 TB</span> storage space<br/></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -314,7 +314,7 @@
|
|||||||
<div class="feat_pro features_cell">
|
<div class="feat_pro features_cell">
|
||||||
<div><span class="text_highlight">20 GB</span> max file size<br/></div>
|
<div><span class="text_highlight">20 GB</span> max file size<br/></div>
|
||||||
<div><span class="text_highlight">240 days</span> file expiry</div>
|
<div><span class="text_highlight">240 days</span> file expiry</div>
|
||||||
<div><span class="text_highlight">4 TB</span> hotlink bandwidth<br/></div>
|
<div><span class="text_highlight">4 TB</span> transfer limit<br/></div>
|
||||||
<div><span class="text_highlight">4 TB</span> storage space<br/></div>
|
<div><span class="text_highlight">4 TB</span> storage space<br/></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -331,7 +331,7 @@
|
|||||||
<div class="feat_pro features_cell">
|
<div class="feat_pro features_cell">
|
||||||
<div><span class="text_highlight">20 GB</span> max file size<br/></div>
|
<div><span class="text_highlight">20 GB</span> max file size<br/></div>
|
||||||
<div><span class="text_highlight">480 days</span> file expiry</div>
|
<div><span class="text_highlight">480 days</span> file expiry</div>
|
||||||
<div><span class="text_highlight">8 TB</span> hotlink bandwidth<br/></div>
|
<div><span class="text_highlight">8 TB</span> transfer limit<br/></div>
|
||||||
<div><span class="text_highlight">8 TB</span> storage space<br/></div>
|
<div><span class="text_highlight">8 TB</span> storage space<br/></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -348,7 +348,7 @@
|
|||||||
<div class="feat_pro features_cell">
|
<div class="feat_pro features_cell">
|
||||||
<div><span class="text_highlight">20 GB</span> max file size<br/></div>
|
<div><span class="text_highlight">20 GB</span> max file size<br/></div>
|
||||||
<div><span class="text_highlight">Files never expire</span></div>
|
<div><span class="text_highlight">Files never expire</span></div>
|
||||||
<div><span class="text_highlight">16 TB</span> hotlink bandwidth<br/></div>
|
<div><span class="text_highlight">16 TB</span> transfer limit<br/></div>
|
||||||
<div><span class="text_highlight">16 TB</span> storage space<br/></div>
|
<div><span class="text_highlight">16 TB</span> storage space<br/></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -365,7 +365,7 @@
|
|||||||
<div class="feat_pro features_cell">
|
<div class="feat_pro features_cell">
|
||||||
<div><span class="text_highlight">20 GB</span> max file size<br/></div>
|
<div><span class="text_highlight">20 GB</span> max file size<br/></div>
|
||||||
<div><span class="text_highlight">Files never expire</span></div>
|
<div><span class="text_highlight">Files never expire</span></div>
|
||||||
<div><span class="text_highlight">32 TB</span> hotlink bandwidth<br/></div>
|
<div><span class="text_highlight">32 TB</span> transfer limit<br/></div>
|
||||||
<div><span class="text_highlight">32 TB</span> storage space<br/></div>
|
<div><span class="text_highlight">32 TB</span> storage space<br/></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -384,7 +384,7 @@
|
|||||||
<div class="feat_pro features_cell">
|
<div class="feat_pro features_cell">
|
||||||
<div><span class="text_highlight">20 GB</span> max file size<br/></div>
|
<div><span class="text_highlight">20 GB</span> max file size<br/></div>
|
||||||
<div><span class="text_highlight">Files never expire</span></div>
|
<div><span class="text_highlight">Files never expire</span></div>
|
||||||
<div><span class="text_highlight">48 TB</span> hotlink bandwidth<br/></div>
|
<div><span class="text_highlight">48 TB</span> transfer limit<br/></div>
|
||||||
<div><span class="text_highlight">48 TB</span> storage space<br/></div>
|
<div><span class="text_highlight">48 TB</span> storage space<br/></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -403,7 +403,7 @@
|
|||||||
<div class="feat_pro features_cell">
|
<div class="feat_pro features_cell">
|
||||||
<div><span class="text_highlight">20 GB</span> max file size<br/></div>
|
<div><span class="text_highlight">20 GB</span> max file size<br/></div>
|
||||||
<div><span class="text_highlight">Files never expire</span></div>
|
<div><span class="text_highlight">Files never expire</span></div>
|
||||||
<div><span class="text_highlight">64 TB</span> hotlink bandwidth<br/></div>
|
<div><span class="text_highlight">64 TB</span> transfer limit<br/></div>
|
||||||
<div><span class="text_highlight">64 TB</span> storage space<br/></div>
|
<div><span class="text_highlight">64 TB</span> storage space<br/></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -422,7 +422,7 @@
|
|||||||
<div class="feat_pro features_cell">
|
<div class="feat_pro features_cell">
|
||||||
<div><span class="text_highlight">20 GB</span> max file size<br/></div>
|
<div><span class="text_highlight">20 GB</span> max file size<br/></div>
|
||||||
<div><span class="text_highlight">Files never expire</span></div>
|
<div><span class="text_highlight">Files never expire</span></div>
|
||||||
<div><span class="text_highlight">96 TB</span> hotlink bandwidth<br/></div>
|
<div><span class="text_highlight">96 TB</span> transfer limit<br/></div>
|
||||||
<div><span class="text_highlight">96 TB</span> storage space<br/></div>
|
<div><span class="text_highlight">96 TB</span> storage space<br/></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -441,7 +441,7 @@
|
|||||||
<div class="feat_pro features_cell round_br">
|
<div class="feat_pro features_cell round_br">
|
||||||
<div><span class="text_highlight">20 GB</span> max file size<br/></div>
|
<div><span class="text_highlight">20 GB</span> max file size<br/></div>
|
||||||
<div><span class="text_highlight">Files never expire</span></div>
|
<div><span class="text_highlight">Files never expire</span></div>
|
||||||
<div><span class="text_highlight">128 TB</span> hotlink bandwidth<br/></div>
|
<div><span class="text_highlight">128 TB</span> transfer limit<br/></div>
|
||||||
<div><span class="text_highlight">128 TB</span> storage space<br/></div>
|
<div><span class="text_highlight">128 TB</span> storage space<br/></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -127,7 +127,7 @@ onDestroy(() => {
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div class="limit_width">
|
<div class="limit_width">
|
||||||
<h3>Bandwidth, hotlinking and views</h3>
|
<h3>Bandwidth, paid transfers and views</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="highlight_dark" style="margin-bottom: 6px;">
|
<div class="highlight_dark" style="margin-bottom: 6px;">
|
||||||
<button on:click={() => { loadGraph(1440, 1, true) }}>Day</button>
|
<button on:click={() => { loadGraph(1440, 1, true) }}>Day</button>
|
||||||
|
@@ -105,10 +105,10 @@ let load_direct_bw = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
if (window.user.subscription.monthly_transfer_cap > 0) {
|
if (window.user.monthly_transfer_cap > 0) {
|
||||||
transfer_cap = window.user.subscription.monthly_transfer_cap
|
|
||||||
} else if (window.user.monthly_transfer_cap > 0) {
|
|
||||||
transfer_cap = window.user.monthly_transfer_cap
|
transfer_cap = window.user.monthly_transfer_cap
|
||||||
|
} else if (window.user.subscription.monthly_transfer_cap > 0) {
|
||||||
|
transfer_cap = window.user.subscription.monthly_transfer_cap
|
||||||
} else {
|
} else {
|
||||||
transfer_cap = -1
|
transfer_cap = -1
|
||||||
}
|
}
|
||||||
@@ -151,6 +151,7 @@ onDestroy(() => {
|
|||||||
{/if}
|
{/if}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<div class="indent">
|
||||||
{#if window.user.subscription.storage_space === -1}
|
{#if window.user.subscription.storage_space === -1}
|
||||||
Storage space used: {formatDataVolume(storage_space_used, 3)}<br/>
|
Storage space used: {formatDataVolume(storage_space_used, 3)}<br/>
|
||||||
{:else}
|
{:else}
|
||||||
@@ -160,8 +161,14 @@ onDestroy(() => {
|
|||||||
{#if transfer_cap === -1}
|
{#if transfer_cap === -1}
|
||||||
Paid transfers in the last 30 days: {formatDataVolume(transfer_used, 3)}<br/>
|
Paid transfers in the last 30 days: {formatDataVolume(transfer_used, 3)}<br/>
|
||||||
{:else}
|
{:else}
|
||||||
|
Paid transfers:
|
||||||
|
{formatDataVolume(transfer_used, 3)}
|
||||||
|
out of
|
||||||
|
{formatDataVolume(transfer_cap, 3)}
|
||||||
|
(<a href="/user/subscription">Set your transfer limit on the subscription page</a>)
|
||||||
<HotlinkProgressBar used={transfer_used} total={transfer_cap}></HotlinkProgressBar>
|
<HotlinkProgressBar used={transfer_used} total={transfer_cap}></HotlinkProgressBar>
|
||||||
{/if}
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
<h3>Exports</h3>
|
<h3>Exports</h3>
|
||||||
<div style="text-align: center;">
|
<div style="text-align: center;">
|
||||||
@@ -233,7 +240,8 @@ onDestroy(() => {
|
|||||||
A paid transfer is when a file is downloaded using the data cap on
|
A paid transfer is when a file is downloaded using the data cap on
|
||||||
your subscription plan. These can be files you downloaded from other
|
your subscription plan. These can be files you downloaded from other
|
||||||
people, or other people downloading your files if you have bandwidth
|
people, or other people downloading your files if you have bandwidth
|
||||||
sharing enabled.
|
sharing enabled. Bandwidth sharing can be changed on
|
||||||
|
<a href="/user/subscription">the subscription page</a>.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<Chart bind:this={graph_transfer_paid} dataType="bytes" label="Paid transfers" />
|
<Chart bind:this={graph_transfer_paid} dataType="bytes" label="Paid transfers" />
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import { formatDataVolume } from "../util/Formatting.svelte"
|
import { formatDataVolume } from "../util/Formatting.svelte"
|
||||||
|
import ProgressBar from "../util/ProgressBar.svelte";
|
||||||
|
|
||||||
export let total = 0
|
export let total = 0
|
||||||
export let used = 0
|
export let used = 0
|
||||||
@@ -8,15 +9,7 @@ $: frac = used / total
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
Paid transfers:
|
<ProgressBar total={total} used={used}></ProgressBar>
|
||||||
{formatDataVolume(used, 3)}
|
|
||||||
out of
|
|
||||||
{formatDataVolume(total, 3)}
|
|
||||||
(<a href="/#hotlinking">More information about hotlinking</a>)
|
|
||||||
<br/>
|
|
||||||
<div class="progress_bar_outer">
|
|
||||||
<div class="progress_bar_inner" style="width: {frac*100}%;"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{#if frac > 0.99}
|
{#if frac > 0.99}
|
||||||
<div class="highlight_red">
|
<div class="highlight_red">
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
<script>
|
<script>
|
||||||
import { formatDataVolume } from "../util/Formatting.svelte"
|
import { formatDataVolume } from "../util/Formatting.svelte"
|
||||||
|
import ProgressBar from "../util/ProgressBar.svelte";
|
||||||
|
|
||||||
export let total = 0
|
export let total = 0
|
||||||
export let used = 0
|
export let used = 0
|
||||||
|
|
||||||
$: frac = used / total
|
$: frac = used / total
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -13,9 +13,7 @@ $: frac = used / total
|
|||||||
out of
|
out of
|
||||||
{formatDataVolume(total, 3)}
|
{formatDataVolume(total, 3)}
|
||||||
<br/>
|
<br/>
|
||||||
<div class="progress_bar_outer">
|
<ProgressBar total={total} used={used}></ProgressBar>
|
||||||
<div class="progress_bar_inner" style="width: {frac*100}%;"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{#if frac > 2.0}
|
{#if frac > 2.0}
|
||||||
<div class="highlight_red">
|
<div class="highlight_red">
|
||||||
@@ -65,17 +63,4 @@ $: frac = used / total
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 1.5em;
|
font-size: 1.5em;
|
||||||
}
|
}
|
||||||
.progress_bar_outer {
|
|
||||||
display: block;
|
|
||||||
background-color: var(--layer_1_color);
|
|
||||||
width: 100%;
|
|
||||||
height: 3px;
|
|
||||||
margin: 6px 0 12px 0;
|
|
||||||
}
|
|
||||||
.progress_bar_inner {
|
|
||||||
background-color: var(--highlight_color);
|
|
||||||
height: 100%;
|
|
||||||
width: 0;
|
|
||||||
transition: width 1s;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
@@ -1,22 +1,34 @@
|
|||||||
<script>
|
<script>
|
||||||
import Spinner from "../util/Spinner.svelte";
|
import Spinner from "../util/Spinner.svelte";
|
||||||
import Euro from "../util/Euro.svelte"
|
import Euro from "../util/Euro.svelte"
|
||||||
|
import ProgressBar from "../util/ProgressBar.svelte";
|
||||||
|
import { onMount } from "svelte";
|
||||||
|
import { formatDataVolume } from "../util/Formatting.svelte";
|
||||||
|
|
||||||
let loading = false
|
let loading = false
|
||||||
let subscription = window.user.subscription.id
|
let subscription = window.user.subscription.id
|
||||||
let hotlinking = window.user.hotlinking_enabled
|
let hotlinking = window.user.hotlinking_enabled
|
||||||
let transfer_cap = window.user.monthly_transfer_cap / 1e12
|
let transfer_cap = window.user.monthly_transfer_cap / 1e9
|
||||||
|
|
||||||
let result = ""
|
let result = ""
|
||||||
let result_success = false
|
let result_success = false
|
||||||
|
|
||||||
const update_subscription = async () => {
|
const update = async (update_field) => {
|
||||||
loading = true
|
loading = true
|
||||||
|
|
||||||
const form = new FormData()
|
const form = new FormData()
|
||||||
|
if (update_field === "subscription") {
|
||||||
|
form.append("update", "subscription")
|
||||||
form.append("subscription", subscription)
|
form.append("subscription", subscription)
|
||||||
|
} else if (update_field === "limits") {
|
||||||
|
form.append("update", "limits")
|
||||||
form.append("hotlinking_enabled", hotlinking)
|
form.append("hotlinking_enabled", hotlinking)
|
||||||
form.append("transfer_cap", transfer_cap*1e12)
|
form.append("transfer_cap", transfer_cap*1e9)
|
||||||
|
} else {
|
||||||
|
console.error("Invalid update type", update_field)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const resp = await fetch(
|
const resp = await fetch(
|
||||||
window.api_endpoint+"/user/subscription",
|
window.api_endpoint+"/user/subscription",
|
||||||
@@ -38,6 +50,28 @@ const update_subscription = async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let transfer_used = 0
|
||||||
|
let load_tranfer_used = () => {
|
||||||
|
let today = new Date()
|
||||||
|
let start = new Date()
|
||||||
|
start.setDate(start.getDate() - 30)
|
||||||
|
|
||||||
|
fetch(
|
||||||
|
window.api_endpoint + "/user/time_series/transfer_paid" +
|
||||||
|
"?start=" + start.toISOString() +
|
||||||
|
"&end=" + today.toISOString() +
|
||||||
|
"&interval=60"
|
||||||
|
).then(resp => {
|
||||||
|
if (!resp.ok) { return Promise.reject("Error: " + resp.status); }
|
||||||
|
return resp.json();
|
||||||
|
}).then(resp => {
|
||||||
|
transfer_used = resp.amounts.reduce((acc, cur) => { return acc + cur }, 0)
|
||||||
|
}).catch(e => {
|
||||||
|
console.error("Error requesting time series: " + e);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
onMount(load_tranfer_used)
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
@@ -84,7 +118,7 @@ const update_subscription = async () => {
|
|||||||
{#if subscription === "prepaid"}
|
{#if subscription === "prepaid"}
|
||||||
Currently active
|
Currently active
|
||||||
{:else}
|
{:else}
|
||||||
<button on:click={() => {subscription = "prepaid"; update_subscription()}}>
|
<button on:click={() => {subscription = "prepaid"; update("subscription")}}>
|
||||||
<i class="icon">attach_money</i>
|
<i class="icon">attach_money</i>
|
||||||
Activate
|
Activate
|
||||||
</button>
|
</button>
|
||||||
@@ -105,7 +139,7 @@ const update_subscription = async () => {
|
|||||||
{#if subscription === "prepaid_temp_storage_120d"}
|
{#if subscription === "prepaid_temp_storage_120d"}
|
||||||
Currently active
|
Currently active
|
||||||
{:else}
|
{:else}
|
||||||
<button on:click={() => {subscription = "prepaid_temp_storage_120d"; update_subscription()}}>
|
<button on:click={() => {subscription = "prepaid_temp_storage_120d"; update("subscription")}}>
|
||||||
<i class="icon">attach_money</i>
|
<i class="icon">attach_money</i>
|
||||||
Activate
|
Activate
|
||||||
</button>
|
</button>
|
||||||
@@ -126,7 +160,7 @@ const update_subscription = async () => {
|
|||||||
{#if subscription === "prepaid_temp_storage_60d"}
|
{#if subscription === "prepaid_temp_storage_60d"}
|
||||||
Currently active
|
Currently active
|
||||||
{:else}
|
{:else}
|
||||||
<button on:click={() => {subscription = "prepaid_temp_storage_60d"; update_subscription()}}>
|
<button on:click={() => {subscription = "prepaid_temp_storage_60d"; update("subscription")}}>
|
||||||
<i class="icon">attach_money</i>
|
<i class="icon">attach_money</i>
|
||||||
Activate
|
Activate
|
||||||
</button>
|
</button>
|
||||||
@@ -147,7 +181,7 @@ const update_subscription = async () => {
|
|||||||
{#if subscription === ""}
|
{#if subscription === ""}
|
||||||
Currently active
|
Currently active
|
||||||
{:else}
|
{:else}
|
||||||
<button on:click={() => {subscription = ""; update_subscription()}}>
|
<button on:click={() => {subscription = ""; update("subscription")}}>
|
||||||
<i class="icon">money_off</i>
|
<i class="icon">money_off</i>
|
||||||
Activate
|
Activate
|
||||||
</button>
|
</button>
|
||||||
@@ -163,16 +197,17 @@ const update_subscription = async () => {
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<h3>Bandwidth sharing</h3>
|
<h3>Bandwidth sharing</h3>
|
||||||
|
<div class="indent">
|
||||||
{#if hotlinking}
|
{#if hotlinking}
|
||||||
<button on:click={() => { hotlinking = false; update_subscription() }}>
|
<button on:click={() => { hotlinking = false; update("limits") }}>
|
||||||
<i class="icon green">check</i> ON (click to turn off)
|
<i class="icon green">check</i> ON (click to turn off)
|
||||||
</button>
|
</button>
|
||||||
{:else}
|
{:else}
|
||||||
<button on:click={() => { hotlinking = true; update_subscription() }}>
|
<button on:click={() => { hotlinking = true; update("limits") }}>
|
||||||
<i class="icon red">close</i> OFF (click to turn on)
|
<i class="icon red">close</i> OFF (click to turn on)
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
</div>
|
||||||
<p>
|
<p>
|
||||||
When bandwidth sharing is enabled all the bandwidth that your files
|
When bandwidth sharing is enabled all the bandwidth that your files
|
||||||
use will be subtracted from your data cap. Advertisements will be
|
use will be subtracted from your data cap. Advertisements will be
|
||||||
@@ -184,11 +219,21 @@ const update_subscription = async () => {
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h3>Bill shock limit</h3>
|
<h3>Bill shock limit</h3>
|
||||||
Billshock limit in terabytes per month. Set to 0 to disable<br/>
|
<div class="indent">
|
||||||
<input type="number" bind:value={transfer_cap}/> TB
|
Billshock limit in gigabytes per month (1 TB = 1000 GB). Set to 0 to disable.
|
||||||
<button on:click={update_subscription}>
|
<br/>
|
||||||
|
<form on:submit|preventDefault={() => {update("limits")}} class="billshock_container">
|
||||||
|
<input type="number" bind:value={transfer_cap} step="100" min="0"/>
|
||||||
|
<div style="margin: 0.5em;">GB</div>
|
||||||
|
<button type="submit">
|
||||||
<i class="icon">save</i> Save
|
<i class="icon">save</i> Save
|
||||||
</button>
|
</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
Bandwidth used in the last 30 days: {formatDataVolume(transfer_used, 3)},
|
||||||
|
new limit: {formatDataVolume(transfer_cap*1e9, 3)}
|
||||||
|
<ProgressBar used={transfer_used} total={transfer_cap*1e9}></ProgressBar>
|
||||||
|
</div>
|
||||||
<p>
|
<p>
|
||||||
The billshock limit limits how much bandwidth your account can use
|
The billshock limit limits how much bandwidth your account can use
|
||||||
in a 30 day window. When this limit is reached files will show ads
|
in a 30 day window. When this limit is reached files will show ads
|
||||||
@@ -253,5 +298,10 @@ const update_subscription = async () => {
|
|||||||
.red {
|
.red {
|
||||||
color: var(--danger_color);
|
color: var(--danger_color);
|
||||||
}
|
}
|
||||||
|
.billshock_container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
38
svelte/src/util/ProgressBar.svelte
Normal file
38
svelte/src/util/ProgressBar.svelte
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<script>
|
||||||
|
export let total = 0
|
||||||
|
export let used = 0
|
||||||
|
let percent = 0
|
||||||
|
$: {
|
||||||
|
// Avoid division by 0
|
||||||
|
if (total === 0) {
|
||||||
|
total = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't allow more than 100% progress
|
||||||
|
if (used / total > 1) {
|
||||||
|
percent = 100
|
||||||
|
} else {
|
||||||
|
percent = (used / total) * 100
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="progress_bar_outer">
|
||||||
|
<div class="progress_bar_inner" style="width: {percent}%;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.progress_bar_outer {
|
||||||
|
display: block;
|
||||||
|
background-color: var(--layer_1_color);
|
||||||
|
width: 100%;
|
||||||
|
height: 3px;
|
||||||
|
margin: 6px 0 12px 0;
|
||||||
|
}
|
||||||
|
.progress_bar_inner {
|
||||||
|
background-color: var(--highlight_color);
|
||||||
|
height: 100%;
|
||||||
|
width: 0;
|
||||||
|
transition: width 1s;
|
||||||
|
}
|
||||||
|
</style>
|
Reference in New Issue
Block a user