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

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"> <script lang="ts">
import type { Writable } from "svelte/store"; import type { Writable } from "svelte/store";
import { formatNetworkSpeed } from "$lib/modules/util"; import { formatNetworkSpeed } from "$lib/modules/util";
import type { FileDownloadStatus } from "$lib/stores"; import { isFileDownloading, type FileDownloadStatus } from "$lib/stores";
interface Props { interface Props {
status?: Writable<FileDownloadStatus>; status?: Writable<FileDownloadStatus>;
@@ -10,7 +10,7 @@
let { status }: Props = $props(); let { status }: Props = $props();
</script> </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"> <div class="flex w-full flex-col rounded-xl bg-gray-100 p-3">
<p class="font-medium"> <p class="font-medium">
{#if $status.status === "download-pending"} {#if $status.status === "download-pending"}
@@ -26,7 +26,7 @@
<p class="text-xs"> <p class="text-xs">
{#if $status.status === "downloading"} {#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} {/if}
</p> </p>
</div> </div>

View File

@@ -50,7 +50,8 @@
다운로드를 기다리는 중 다운로드를 기다리는 중
{:else if $status.status === "downloading"} {: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 === "decryption-pending"}
복호화를 기다리는 중 복호화를 기다리는 중
{:else if $status.status === "decrypting"} {:else if $status.status === "decrypting"}

View File

@@ -46,7 +46,7 @@
업로드를 기다리는 중 업로드를 기다리는 중
{:else if $status.status === "uploading"} {: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 === "uploaded"}
업로드 완료 업로드 완료
{:else if $status.status === "error"} {:else if $status.status === "error"}

View File

@@ -1,35 +1,36 @@
<script lang="ts"> <script lang="ts">
import type { Writable } from "svelte/store"; import type { Writable } from "svelte/store";
import { formatNetworkSpeed } from "$lib/modules/util"; 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"; import IconDraft from "~icons/material-symbols/draft";
interface Props { interface Props {
info: Writable<FileUploadStatus>; status: Writable<FileUploadStatus>;
} }
let { info }: Props = $props(); let { status }: Props = $props();
</script> </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 h-14 items-center gap-x-4 p-2">
<div class="flex-shrink-0 text-lg"> <div class="flex-shrink-0 text-lg">
<IconDraft class="text-gray-600" /> <IconDraft class="text-gray-600" />
</div> </div>
<div class="flex flex-grow flex-col overflow-hidden"> <div class="flex flex-grow flex-col overflow-hidden">
<p title={$info.name} class="truncate font-medium text-gray-800"> <p title={$status.name} class="truncate font-medium text-gray-800">
{$info.name} {$status.name}
</p> </p>
<p class="text-xs text-gray-800"> <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"} {:else if $status.status === "uploading"}
전송됨 {Math.floor(($info.progress ?? 0) * 100)}% · {formatNetworkSpeed($info.rate ?? 0)} 전송됨 {Math.floor(($status.progress ?? 0) * 100)}% ·
{formatNetworkSpeed(($status.rate ?? 0) * 8)}
{/if} {/if}
</p> </p>
</div> </div>