Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
2026-07-11 12:12:40 +08:00
parent 01a2c63b06
commit 71f758fe0b
66 changed files with 3055 additions and 939 deletions
@@ -9,6 +9,7 @@ import { ArrowLeft, UploadCloud, X, FileVideo, FileText, Image, RefreshCw } from
import { useAssets } from "@/contexts/AdminAssetsContext";
import { useAuth } from "@/contexts/AuthContext";
import { useUnsavedChangesGuard } from "@/hooks/useUnsavedChangesGuard";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
@@ -177,6 +178,8 @@ export default function EditAsset() {
const isVideo = asset?.file_type === "video";
const hasThumbnailChange = !!thumbnailRef.current;
const { bypassOnce, dialog: unsavedChangesDialog } = useUnsavedChangesGuard(isDirty || hasThumbnailChange);
const onSubmit = async (data) => {
const result = await updateAsset(
assetId,
@@ -191,6 +194,7 @@ export default function EditAsset() {
);
if (!result) return;
bypassOnce();
navigate(-1);
};
@@ -340,6 +344,8 @@ export default function EditAsset() {
</div>
</form>
{unsavedChangesDialog}
</div>
);
}