fixed app stuff in frontend
This commit is contained in:
@@ -120,9 +120,9 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<main class="bg-background text-foreground min-h-screen">
|
||||
<main class="bg-background text-foreground min-h-dvh">
|
||||
{#if state === "loading"}
|
||||
<section class="flex min-h-screen items-center justify-center px-6">
|
||||
<section class="flex min-h-dvh items-center justify-center px-6">
|
||||
<div
|
||||
class="w-full max-w-sm rounded-xl border border-border bg-card p-6 text-center"
|
||||
>
|
||||
@@ -133,16 +133,20 @@
|
||||
</div>
|
||||
</section>
|
||||
{:else}
|
||||
<section class="flex min-h-screen flex-col">
|
||||
<div class="flex items-center justify-center border-b border-border px-3 py-2">
|
||||
<p class="text-xs text-muted-foreground">{statusText}</p>
|
||||
<section class="bg-black relative h-dvh min-h-dvh overflow-hidden">
|
||||
<div
|
||||
class="pointer-events-none absolute inset-x-0 top-0 z-10 flex justify-center px-3 pt-2"
|
||||
>
|
||||
<div class="rounded-full bg-black/55 px-3 py-1 text-xs text-white/90">
|
||||
{statusText}
|
||||
</div>
|
||||
</div>
|
||||
<div class="bg-black flex-1">
|
||||
<div class="h-full w-full">
|
||||
{#if streamUrl}
|
||||
<iframe
|
||||
src={streamUrl}
|
||||
title="Android session"
|
||||
class="h-full w-full border-0"
|
||||
class="block h-full w-full border-0 bg-black"
|
||||
allow="autoplay; fullscreen"
|
||||
referrerpolicy="no-referrer"
|
||||
></iframe>
|
||||
|
||||
@@ -39,6 +39,7 @@ class DeviceDetailsViewModel {
|
||||
device = $state<DeviceForUI | null>(null);
|
||||
loading = $state(false);
|
||||
currentId = $state<number | null>(null);
|
||||
private _deviceQuery: ReturnType<typeof getDeviceByIdSQ> | null = null;
|
||||
|
||||
get streamUrl(): string | null {
|
||||
if (!this.device) return null;
|
||||
@@ -50,7 +51,15 @@ class DeviceDetailsViewModel {
|
||||
this.currentId = id;
|
||||
|
||||
try {
|
||||
const result = await getDeviceByIdSQ({ id });
|
||||
const query = getDeviceByIdSQ({ id });
|
||||
|
||||
if (query.ready) {
|
||||
await query.refresh();
|
||||
}
|
||||
|
||||
const result = query.ready ? query.current : await query;
|
||||
this._deviceQuery = query;
|
||||
|
||||
if (result?.error || !result?.data) {
|
||||
this.device = null;
|
||||
toast.error(result?.error?.message || "Failed to fetch device", {
|
||||
|
||||
Reference in New Issue
Block a user