Show on-device HTML UI mocks as firmware card previews.
Prefer media/preview.html over raster covers so catalog cards mirror each LVGL screen. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import type { FirmwareInfo } from "@/lib/firmware";
|
||||
import { formatBytes } from "@/lib/utils";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { EspWebInstall } from "@/components/esp-web-install";
|
||||
import { FirmwarePreview } from "@/components/firmware-preview";
|
||||
|
||||
export function FirmwareDetail({
|
||||
fw,
|
||||
@@ -24,8 +25,6 @@ export function FirmwareDetail({
|
||||
);
|
||||
}
|
||||
|
||||
const preview = fw.media.video || fw.media.animation || fw.media.cover;
|
||||
|
||||
return (
|
||||
<aside className="sticky top-4 flex flex-col overflow-hidden rounded-[14px] border border-[var(--line)] bg-[color-mix(in_srgb,var(--bg-elev)_92%,transparent)] backdrop-blur-sm">
|
||||
<div className="border-b border-[var(--line)] px-4 py-3">
|
||||
@@ -37,32 +36,26 @@ export function FirmwareDetail({
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div className="aspect-video w-full border-b border-[var(--line)] bg-black/40">
|
||||
{fw.media.video ? (
|
||||
<div className="aspect-[4/3] w-full border-b border-[var(--line)] bg-black/40">
|
||||
{fw.media.preview ? (
|
||||
<FirmwarePreview fw={fw} />
|
||||
) : fw.media.video ? (
|
||||
<video
|
||||
key={fw.media.video}
|
||||
className="h-full w-full object-cover"
|
||||
controls
|
||||
playsInline
|
||||
preload="metadata"
|
||||
poster={fw.media.cover || undefined}
|
||||
>
|
||||
<source src={fw.media.video} />
|
||||
</video>
|
||||
) : preview ? (
|
||||
// eslint-disable-next-line @next/next/no-img-element
|
||||
<img
|
||||
src={preview}
|
||||
alt=""
|
||||
className="h-full w-full object-cover"
|
||||
/>
|
||||
) : (
|
||||
<div className="flex h-full flex-col items-center justify-center gap-1 px-4 text-center">
|
||||
<p className="m-0 text-sm text-[var(--muted)]">
|
||||
{t("firmware.mediaPlaceholder")}
|
||||
</p>
|
||||
<p className="m-0 text-xs text-[var(--muted)] opacity-70">
|
||||
meta.json → media.cover / animation / video
|
||||
media/preview.html
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user