mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
@@ -8,6 +8,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { ArrowLeft, UploadCloud, X, FileVideo, FileText, Image, RefreshCw } from "lucide-react";
|
||||
|
||||
import { useAssets } from "@/contexts/AdminAssetsContext";
|
||||
import { useAssetPreviewSrc } from "@/hooks/useAssetPreviewSrc";
|
||||
import { useAuth } from "@/contexts/AuthContext";
|
||||
import { useUnsavedChangesGuard } from "@/hooks/useUnsavedChangesGuard";
|
||||
import { Button } from "@/components/ui/button";
|
||||
@@ -55,7 +56,6 @@ function formatBytes(bytes) {
|
||||
// ─── Thumbnail Drop Zone ──────────────────────────────────────────────────────
|
||||
|
||||
function ThumbnailDropZone({ currentUrl, newFile, onFile, onClear, error }) {
|
||||
console.log(currentUrl)
|
||||
const inputRef = useRef(null);
|
||||
|
||||
const preview = newFile
|
||||
@@ -178,6 +178,11 @@ export default function EditAsset() {
|
||||
const isVideo = asset?.file_type === "video";
|
||||
const hasThumbnailChange = !!thumbnailRef.current;
|
||||
|
||||
// asset.file_url is redacted to null for S3-stored assets (see
|
||||
// redactS3Url in assets.controller.js) — resolve the real preview src
|
||||
// the same way ViewImageAsset.jsx does instead of reading it raw.
|
||||
const { src: previewSrc } = useAssetPreviewSrc(asset, { scope: "admin" });
|
||||
|
||||
const { bypassOnce, dialog: unsavedChangesDialog } = useUnsavedChangesGuard(isDirty || hasThumbnailChange);
|
||||
|
||||
const onSubmit = async (data) => {
|
||||
@@ -265,7 +270,7 @@ export default function EditAsset() {
|
||||
</Label>
|
||||
<ThumbnailDropZone
|
||||
key={thumbKey}
|
||||
currentUrl={asset.file_type === "video" ? asset.thumbnail_url : asset.file_url}
|
||||
currentUrl={asset.file_type === "video" ? asset.thumbnail_url : previewSrc}
|
||||
newFile={thumbnailRef.current}
|
||||
onFile={(f) => {
|
||||
thumbnailRef.current = f;
|
||||
|
||||
Reference in New Issue
Block a user