2026-09-21 11:00:46 -04:00
|
|
|
<script lang="ts">
|
|
|
|
|
import { session } from '$lib/stores/videoSession.svelte';
|
|
|
|
|
|
|
|
|
|
let progressPercent = $derived(Math.round(session.downloadProgress * 100));
|
|
|
|
|
let isDownloading = $derived(
|
|
|
|
|
session.status === 'ready' &&
|
|
|
|
|
session.downloadStatus === 'downloading' &&
|
|
|
|
|
session.downloadProgress > 0 &&
|
|
|
|
|
session.downloadProgress < 1
|
|
|
|
|
);
|
|
|
|
|
let isDownloaded = $derived(
|
|
|
|
|
session.localFilePath !== null &&
|
|
|
|
|
(session.downloadStatus === 'complete' || session.downloadProgress >= 1)
|
|
|
|
|
);
|
|
|
|
|
</script>
|
|
|
|
|
|
2026-09-21 10:45:53 -04:00
|
|
|
<div class="status-bar">
|
2026-09-21 11:00:46 -04:00
|
|
|
{#if isDownloading}
|
|
|
|
|
<div class="progress-bar">
|
|
|
|
|
<div class="progress-fill" style="width: {progressPercent}%"></div>
|
|
|
|
|
</div>
|
|
|
|
|
<span class="status-text">Downloading: {progressPercent}%</span>
|
|
|
|
|
{:else if isDownloaded}
|
|
|
|
|
<span class="status-text success">✓ Downloaded: {session.title}</span>
|
|
|
|
|
{:else if session.status === 'resolving'}
|
|
|
|
|
<span class="status-text">Resolving URL…</span>
|
|
|
|
|
{:else if session.status === 'ready' && session.downloadStatus === 'downloading'}
|
|
|
|
|
<span class="status-text">Starting download…</span>
|
|
|
|
|
{:else if session.downloadStatus === 'failed'}
|
|
|
|
|
<span class="status-text">Download failed</span>
|
|
|
|
|
{:else}
|
|
|
|
|
<span class="status-text">Ready</span>
|
|
|
|
|
{/if}
|
2026-09-21 10:45:53 -04:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
.status-bar {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
padding: 4px 12px;
|
|
|
|
|
background: var(--bg-tertiary);
|
|
|
|
|
border-top: 1px solid var(--border);
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
color: var(--text-secondary);
|
|
|
|
|
min-height: 24px;
|
2026-09-21 11:00:46 -04:00
|
|
|
gap: 8px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.progress-bar {
|
|
|
|
|
flex: 1;
|
|
|
|
|
height: 4px;
|
|
|
|
|
background: var(--bg-primary);
|
|
|
|
|
border-radius: 2px;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
max-width: 200px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.progress-fill {
|
|
|
|
|
height: 100%;
|
|
|
|
|
background: var(--accent);
|
|
|
|
|
transition: width 0.3s ease;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.success {
|
|
|
|
|
color: var(--success);
|
2026-09-21 10:45:53 -04:00
|
|
|
}
|
|
|
|
|
</style>
|