assets and tier plans revamp

This commit is contained in:
rgrgogu
2026-08-01 17:44:12 +08:00
parent 4f738a691d
commit a34c6feb84
45 changed files with 2172 additions and 273 deletions
+2 -7
View File
@@ -9,6 +9,7 @@ import { ArrowLeft, UploadCloud, X, FileVideo, FileText, Image, RefreshCw } from
import { useAssets } from "@/contexts/AdminAssetsContext";
import { useAssetPreviewSrc } from "@/hooks/useAssetPreviewSrc";
import { formatFileSize } from "@/utils/format.util";
import { useAuth } from "@/contexts/AuthContext";
import { useUnsavedChangesGuard } from "@/hooks/useUnsavedChangesGuard";
import { Button } from "@/components/ui/button";
@@ -46,12 +47,6 @@ function FieldError({ message }) {
return <p className="text-xs text-destructive mt-1">{message}</p>;
}
function formatBytes(bytes) {
if (!bytes) return "—";
if (bytes < 1024) return `${bytes} B`;
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
return `${(bytes / (1024 * 1024)).toFixed(2)} MB`;
}
// ─── Thumbnail Drop Zone ──────────────────────────────────────────────────────
@@ -249,7 +244,7 @@ export default function EditAsset() {
<div className="flex items-center gap-2 flex-wrap">
<Badge variant="secondary" className="text-xs">{asset.file_type}</Badge>
<Badge variant="outline" className="text-xs">{asset.extension?.toUpperCase()}</Badge>
<span className="text-xs text-muted-foreground">{formatBytes(asset.file_size)}</span>
<span className="text-xs text-muted-foreground">{formatFileSize(asset.file_size) ?? "—"}</span>
{asset.resolution && (
<span className="text-xs text-muted-foreground">{asset.resolution}</span>
)}