diff --git a/src/routes/(authed)/tools/video-mainpage/+page.svelte b/src/routes/(authed)/tools/video-mainpage/+page.svelte index 846a9aa..4848f50 100644 --- a/src/routes/(authed)/tools/video-mainpage/+page.svelte +++ b/src/routes/(authed)/tools/video-mainpage/+page.svelte @@ -27,6 +27,7 @@ import * as adb from '$lib/core/adb/adb'; import { env } from '$env/dynamic/public'; import { AdbInstance } from '../../../state.svelte'; + import ScrcpyDialog from '$lib/components/scrcpy-dialog.svelte'; const CREATE_ENDPOINT = '/api/video-mainpage'; const LIST_ENDPOINT = '/api/video-mainpage/list'; @@ -121,6 +122,8 @@ let editBrewingTxtEnFile = $state(null); let editSaving = $state(false); + let showScreenMirror = $state(false); + const editBrewingPlaySeconds = $derived(Math.max(1, Math.round(editBrewingRaw) - DURATION_TRIM)); function toIso(d: string): string { @@ -203,7 +206,8 @@ const file = input.files?.[0]; input.value = ''; if (!file) return; - if (!file.name.toLowerCase().endsWith('.png')) return addNotification('WARN:Text overlay must be .png'); + if (!file.name.toLowerCase().endsWith('.png')) + return addNotification('WARN:Text overlay must be .png'); set(file, URL.createObjectURL(file)); } function pickBrewingTxt(e: Event) { @@ -286,7 +290,14 @@ const user = $auth; if (!user) return addNotification('ERR:Not logged in'); if (!AdbInstance.instance) return addNotification('ERR:Connect a machine first'); - if (!name.trim() || !startDate || !mainFile || !brewingFile || !brewingTxtFile || !brewingTxtEnFile) + if ( + !name.trim() || + !startDate || + !mainFile || + !brewingFile || + !brewingTxtFile || + !brewingTxtEnFile + ) return addNotification( 'ERR:Need a name, start date, both videos, and both brewing text overlays (TH + EN)' ); @@ -355,7 +366,9 @@ managed = data.managed ?? []; readonlyList = data.readonly ?? []; } catch (error) { - addNotification(`ERR:Load list failed: ${error instanceof Error ? error.message : 'unknown'}`); + addNotification( + `ERR:Load list failed: ${error instanceof Error ? error.message : 'unknown'}` + ); } finally { loadingList = false; } @@ -395,7 +408,8 @@ const file = input.files?.[0]; input.value = ''; if (!file) return; - if (!file.name.toLowerCase().endsWith('.png')) return addNotification('WARN:Text overlay must be .png'); + if (!file.name.toLowerCase().endsWith('.png')) + return addNotification('WARN:Text overlay must be .png'); if (en) editBrewingTxtEnFile = file; else editBrewingTxtFile = file; } @@ -418,7 +432,8 @@ fd.append('start', toIso(editStart)); fd.append('end', editEnd ? toIso(editEnd) : 'NONE'); if (editBrewingFile) fd.append('brewing_duration', String(editBrewingPlaySeconds)); - else if (target.brewing?.duration) fd.append('brewing_duration', String(target.brewing.duration)); + else if (target.brewing?.duration) + fd.append('brewing_duration', String(target.brewing.duration)); if (editMainFile) fd.append('video', editMainFile); if (editBrewingFile) fd.append('brewing_video', editBrewingFile); if (editBrewingTxtFile) fd.append('brewing_txt', editBrewingTxtFile); @@ -476,7 +491,9 @@

Advertisement Videos

-

Main-page & brewing-page videos, scheduled by date

+

+ Main-page & brewing-page videos, scheduled by date +

@@ -484,7 +501,13 @@ {#if !isAdbConnected} + {:else} + {/if}
@@ -502,7 +525,8 @@ Upload the same clip twice — the main-page version and the brewing-page _long version. Auto-named - brewing_adv<N> (next free 1–40, never overwrites a video in use). + brewing_adv<N> (next free 1–40, never overwrites a video + in use). @@ -518,20 +542,29 @@

- Writes to inter/{country}/video{country === 'tha' ? ' + flat video/' : ''}. + Writes to inter/{country}/video{country === 'tha' + ? ' + flat video/' + : ''}.

-

Used for the comment & the …VideoEnable variable.

+

+ Used for the comment & the …VideoEnable variable. +

- +
- + {#if !endDate}

Blank = open-ended

{/if}
@@ -543,17 +576,27 @@
Main-page video - brewing_adv<N>.mp4 + brewing_adv<N>.mp4
{#if mainFile}
- - + +
-

{mainFile.name} · {fmtMB(mainFile.size)}

+

+ {mainFile.name} · {fmtMB(mainFile.size)} +

{:else} -

{v.name}

-
+
brewing_adv{v.n} - {v.range_label} - {#if v.brewing?.duration}{v.brewing.duration}s{/if} - main - brewing + {v.range_label} + {#if v.brewing?.duration}{v.brewing.duration}s{/if} + main + brewing
{#if showReadonly}
{#each readonlyList as v (v.filename)}
- -

{v.filename}

+ +

+ {v.filename} +

{/each}
@@ -721,7 +845,8 @@ Edit video - {#if editTarget}brewing_adv{editTarget.n} · change dates, rename, or replace either clip{/if} + {#if editTarget}brewing_adv{editTarget.n} · change dates, rename, + or replace either clip{/if} @@ -743,37 +868,77 @@
-

Main-page

+

+ Main-page +

{#if editTarget?.main} - + {/if} -
-

Brewing-page

+

+ Brewing-page +

{#if editTarget?.brewing} - + {/if} -
@@ -782,16 +947,24 @@ {#if pushProgress.active}
-

Pushing {pushProgress.name} ({pushProgress.percent}%)

+

+ Pushing {pushProgress.name} ({pushProgress.percent}%) +

{/if}
- + + +