Tweak various progress bars

Fixes #5
This commit is contained in:
2022-05-13 17:43:10 +02:00
parent f1896972a1
commit 2561ef4ab2
6 changed files with 21 additions and 48 deletions

View File

@@ -394,11 +394,6 @@ pre {
background: var(--input_hover_background); background: var(--input_hover_background);
} }
.file_button_selected {
box-shadow: 0 0 2px 2px var(--highlight_color);
text-decoration: none;
}
.file_button>img { .file_button>img {
max-height: 100%; max-height: 100%;
max-width: 25%; max-width: 25%;

View File

@@ -82,7 +82,7 @@ export const set_item = idx => {
href="#item={index}" href="#item={index}"
title="Open {file.name}" title="Open {file.name}"
class="list_item file_button" class="list_item file_button"
class:file_button_selected={file.selected}> class:file_selected={file.selected}>
<img src={file.icon_href+"?width=48&height=48"} alt={file.name} class="list_item_thumbnail" loading="lazy"/> <img src={file.icon_href+"?width=48&height=48"} alt={file.name} class="list_item_thumbnail" loading="lazy"/>
{file.name} {file.name}
</a> </a>
@@ -119,4 +119,9 @@ export const set_item = idx => {
overflow-y: hidden; overflow-y: hidden;
white-space: nowrap; white-space: nowrap;
} }
.file_selected {
box-shadow: 0 0 2px 2px var(--highlight_color);
text-decoration: none;
}
</style> </style>

View File

@@ -288,7 +288,7 @@ export const start = () => {
} }
.progress { .progress {
flex: 0 0 auto; flex: 0 0 auto;
height: 2px; height: 3px;
} }
.progress_bar { .progress_bar {
background: var(--highlight_background); background: var(--highlight_background);

View File

@@ -9,6 +9,7 @@ import Tumblr from "../icons/Tumblr.svelte"
import { formatDataVolume, formatDuration } from "../util/Formatting.svelte"; import { formatDataVolume, formatDuration } from "../util/Formatting.svelte";
import StorageProgressBar from "../user_home/StorageProgressBar.svelte" import StorageProgressBar from "../user_home/StorageProgressBar.svelte"
import Konami from "../util/Konami.svelte" import Konami from "../util/Konami.svelte"
import ProgressBar from "../util/ProgressBar.svelte"
// === UPLOAD LOGIC === // === UPLOAD LOGIC ===
@@ -113,7 +114,6 @@ const finish_upload = (file) => {
let stats_interval = null let stats_interval = null
let stats_interval_ms = 500 let stats_interval_ms = 500
let progress_bar_inner
let start_time = 0 let start_time = 0
let total_progress = 0 let total_progress = 0
let total_size = 0 let total_size = 0
@@ -147,7 +147,6 @@ const stats_update = () => {
) )
last_total_loaded = total_loaded last_total_loaded = total_loaded
progress_bar_inner.style.width = (total_progress * 100) + "%"
document.title = (total_progress*100).toFixed(0) + "% ~ " + document.title = (total_progress*100).toFixed(0) + "% ~ " +
formatDuration(remaining_time, 0) + formatDuration(remaining_time, 0) +
" ~ uploading to pixeldrain" " ~ uploading to pixeldrain"
@@ -156,7 +155,6 @@ const stats_finished = () => {
start_time = 0 start_time = 0
total_loaded = total_size total_loaded = total_size
total_progress = 1 total_progress = 1
progress_bar_inner.style.width = "100%"
total_rate = 0 total_rate = 0
document.title = "Finished! ~ pixeldrain" document.title = "Finished! ~ pixeldrain"
@@ -435,10 +433,9 @@ const keydown = (e) => {
<div>ETA {formatDuration(remaining_time, 0)}</div> <div>ETA {formatDuration(remaining_time, 0)}</div>
<div>Rate {formatDataVolume(total_rate, 3)}/s</div> <div>Rate {formatDataVolume(total_rate, 3)}/s</div>
</div> </div>
<ProgressBar total={total_size} used={total_loaded} animation="linear" speed={stats_interval_ms}/>
</section> </section>
<div class="progress_bar_outer">
<div bind:this={progress_bar_inner} class="progress_bar_inner"></div>
</div>
<div id="file_drop_highlight" class="highlight_green" class:hide={!dragging}> <div id="file_drop_highlight" class="highlight_green" class:hide={!dragging}>
Gimme gimme gimme!<br/> Gimme gimme gimme!<br/>
@@ -572,7 +569,6 @@ const keydown = (e) => {
} }
.instruction { .instruction {
border-top: 1px solid var(--separator); border-top: 1px solid var(--separator);
border-bottom: 1px solid var(--separator);
margin: 1.5em 0; margin: 1.5em 0;
padding: 5px; padding: 5px;
} }
@@ -609,17 +605,6 @@ const keydown = (e) => {
grid-template-columns: 50% 50%; grid-template-columns: 50% 50%;
} }
} }
.progress_bar_outer {
width: 100%;
height: 3px;
}
.progress_bar_inner {
background: var(--highlight_background);
height: 100%;
width: 0;
transition: width 0.5s;
transition-timing-function: linear;
}
.album_name_form { .album_name_form {
display: inline-flex; display: inline-flex;

View File

@@ -1,6 +1,7 @@
<script> <script>
import { onMount } from "svelte"; import { onMount } from "svelte";
import FilePicker from "../file_viewer/FilePicker.svelte"; import FilePicker from "../file_viewer/FilePicker.svelte";
import CustomBanner from "../file_viewer/CustomBanner.svelte";
import LoadingIndicator from "../util/LoadingIndicator.svelte"; import LoadingIndicator from "../util/LoadingIndicator.svelte";
import SuccessMessage from "../util/SuccessMessage.svelte"; import SuccessMessage from "../util/SuccessMessage.svelte";
import ThemePicker from "../util/ThemePicker.svelte"; import ThemePicker from "../util/ThemePicker.svelte";
@@ -181,13 +182,7 @@ onMount(() => {
{#if header_image} {#if header_image}
<div class="highlight_shaded"> <div class="highlight_shaded">
{#if header_link} <CustomBanner src={"/api/file/"+header_image} link={header_link}></CustomBanner>
<a href={header_link} target="_blank">
<img class="banner_preview" src="/api/file/{header_image}" alt="Custom file viewer header"/>
</a>
{:else}
<img class="banner_preview" src="/api/file/{header_image}" alt="Custom file viewer header"/>
{/if}
</div> </div>
{/if} {/if}
@@ -233,13 +228,7 @@ onMount(() => {
</form> </form>
{#if footer_image} {#if footer_image}
<div class="highlight_shaded"> <div class="highlight_shaded">
{#if footer_link} <CustomBanner src={"/api/file/"+footer_image} link={footer_link}></CustomBanner>
<a href={footer_link} target="_blank">
<img class="banner_preview" src="/api/file/{footer_image}" alt="Custom file viewer footer"/>
</a>
{:else}
<img class="banner_preview" src="/api/file/{footer_image}" alt="Custom file viewer footer"/>
{/if}
</div> </div>
{/if} {/if}
<br/> <br/>
@@ -268,12 +257,6 @@ onMount(() => {
/> />
<style> <style>
.banner_preview {
max-height: 90px;
max-width: 100%;
display: block;
margin: auto;
}
.background_preview { .background_preview {
max-height: 200px; max-height: 200px;
max-width: 100%; max-width: 100%;

View File

@@ -1,6 +1,8 @@
<script> <script>
export let total = 0 export let total = 0
export let used = 0 export let used = 0
export let animation = "ease"
export let speed = 1000
let percent = 0 let percent = 0
$: { $: {
// Avoid division by 0 // Avoid division by 0
@@ -18,7 +20,7 @@ $: {
</script> </script>
<div class="progress_bar_outer"> <div class="progress_bar_outer">
<div class="progress_bar_inner" style="width: {percent}%;"></div> <div class="progress_bar_inner" style="width: {percent}%; transition-timing-function: {animation}; transition-duration: {speed}ms;"></div>
</div> </div>
<style> <style>
@@ -26,13 +28,16 @@ $: {
display: block; display: block;
background: var(--background_color); background: var(--background_color);
width: 100%; width: 100%;
height: 3px; height: 6px;
border-radius: 6px;
overflow: hidden;
margin: 6px 0 12px 0; margin: 6px 0 12px 0;
} }
.progress_bar_inner { .progress_bar_inner {
background: var(--highlight_background); background: var(--highlight_background);
height: 100%; height: 100%;
width: 0; width: 0;
transition: width 1s; border-radius: 6px;
transition-property: width;
} }
</style> </style>