다운로드 및 업로드 속도가 잘못 표기되던 버그 수정

This commit is contained in:
static
2025-01-18 11:23:22 +09:00
parent 811713cd03
commit d0d4afd2c3
4 changed files with 18 additions and 16 deletions

View File

@@ -1,7 +1,7 @@
<script lang="ts">
import type { Writable } from "svelte/store";
import { formatNetworkSpeed } from "$lib/modules/util";
import type { FileDownloadStatus } from "$lib/stores";
import { isFileDownloading, type FileDownloadStatus } from "$lib/stores";
interface Props {
status?: Writable<FileDownloadStatus>;
@@ -10,7 +10,7 @@
let { status }: Props = $props();
</script>
{#if $status && $status.status !== "decrypted" && $status.status !== "canceled" && $status.status !== "error"}
{#if $status && isFileDownloading($status.status)}
<div class="flex w-full flex-col rounded-xl bg-gray-100 p-3">
<p class="font-medium">
{#if $status.status === "download-pending"}
@@ -26,7 +26,7 @@
<p class="text-xs">
{#if $status.status === "downloading"}
전송됨
{Math.floor(($status.progress ?? 0) * 100)}% · {formatNetworkSpeed($status.rate ?? 0)}
{Math.floor(($status.progress ?? 0) * 100)}% · {formatNetworkSpeed(($status.rate ?? 0) * 8)}
{/if}
</p>
</div>

View File

@@ -50,7 +50,8 @@
다운로드를 기다리는 중
{:else if $status.status === "downloading"}
전송됨
{Math.floor(($status.progress ?? 0) * 100)}% · {formatNetworkSpeed($status.rate ?? 0)}
{Math.floor(($status.progress ?? 0) * 100)}% ·
{formatNetworkSpeed(($status.rate ?? 0) * 8)}
{:else if $status.status === "decryption-pending"}
복호화를 기다리는 중
{:else if $status.status === "decrypting"}

View File

@@ -46,7 +46,7 @@
업로드를 기다리는 중
{:else if $status.status === "uploading"}
전송됨
{Math.floor(($status.progress ?? 0) * 100)}% · {formatNetworkSpeed($status.rate ?? 0)}
{Math.floor(($status.progress ?? 0) * 100)}% · {formatNetworkSpeed(($status.rate ?? 0) * 8)}
{:else if $status.status === "uploaded"}
업로드 완료
{:else if $status.status === "error"}

View File

@@ -1,35 +1,36 @@
<script lang="ts">
import type { Writable } from "svelte/store";
import { formatNetworkSpeed } from "$lib/modules/util";
import type { FileUploadStatus } from "$lib/stores";
import { isFileUploading, type FileUploadStatus } from "$lib/stores";
import IconDraft from "~icons/material-symbols/draft";
interface Props {
info: Writable<FileUploadStatus>;
status: Writable<FileUploadStatus>;
}
let { info }: Props = $props();
let { status }: Props = $props();
</script>
{#if $info.status !== "uploaded" && $info.status !== "canceled" && $info.status !== "error"}
{#if isFileUploading($status.status)}
<div class="flex h-14 items-center gap-x-4 p-2">
<div class="flex-shrink-0 text-lg">
<IconDraft class="text-gray-600" />
</div>
<div class="flex flex-grow flex-col overflow-hidden">
<p title={$info.name} class="truncate font-medium text-gray-800">
{$info.name}
<p title={$status.name} class="truncate font-medium text-gray-800">
{$status.name}
</p>
<p class="text-xs text-gray-800">
{#if $info.status === "encryption-pending"}
{#if $status.status === "encryption-pending"}
준비 중
{:else if $info.status === "encrypting"}
{:else if $status.status === "encrypting"}
암호화하는 중
{:else if $info.status === "upload-pending"}
{:else if $status.status === "upload-pending"}
업로드를 기다리는 중
{:else if $info.status === "uploading"}
전송됨 {Math.floor(($info.progress ?? 0) * 100)}% · {formatNetworkSpeed($info.rate ?? 0)}
{:else if $status.status === "uploading"}
전송됨 {Math.floor(($status.progress ?? 0) * 100)}% ·
{formatNetworkSpeed(($status.rate ?? 0) * 8)}
{/if}
</p>
</div>