feat(canvas): 画布能力 - 完善 LibTV 导入与资源预览
This commit is contained in:
1 parent
4b9d510129
commit
d2a089f1ec
36 files changed
+1722
-68
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
import { CachedResourceImage } from "@/components/cached-resource-image";
|
||||
import type { Asset } from "@/stores/use-asset-store";
|
||||
|
||||
type AssetMediaPreviewProps = {
|
||||
@@ -32,7 +33,8 @@ export function AssetMediaPreview({ asset, alt, className = "", fallback = null
|
||||
);
|
||||
}
|
||||
|
||||
const storageKey = asset.kind === "image" ? asset.data.storageKey : undefined;
|
||||
const imageUrl = asset.coverUrl || (asset.kind === "image" ? asset.data.dataUrl : "");
|
||||
if (!imageUrl) return fallback;
|
||||
return <img src={imageUrl} alt={alt} loading="lazy" decoding="async" className={className} />;
|
||||
if (!imageUrl && !storageKey) return fallback;
|
||||
return <CachedResourceImage storageKey={storageKey} src={imageUrl} alt={alt} loading="lazy" decoding="async" className={className} fallback={fallback} />;
|
||||
}
|
||||
Reference in new issue
Block a user