This commit is contained in:
Your Name committed 2026-10-06 06:13:41 +07:00
1 parent ebc8f2ffeb
commit 7fd3c40ae2
2 files changed
+240 -27

No files matched your search

@@ -42,6 +42,9 @@ export default function BackupCatalogPage() {
categoriesCount: number
attributesCount: number
brandsCount: number
detailSectionsCount: number
productAttributesCount: number
categorySectionsCount: number
rawPayload: any
} | null>(null)
const [restoreLoading, setRestoreLoading] = useState(false)
@@ -108,11 +111,26 @@ export default function BackupCatalogPage() {
? payload
: []
let detailSectionsCount = 0
let productAttributesCount = 0
for (const p of products) {
if (Array.isArray(p.detailSections)) detailSectionsCount += p.detailSections.length
if (Array.isArray(p.attributes)) productAttributesCount += p.attributes.length
}
let categorySectionsCount = 0
for (const c of categories) {
if (Array.isArray(c.sections)) categorySectionsCount += c.sections.length
}
setRestorePreview({
categoriesCount: categories.length,
attributesCount: attributes.length,
brandsCount: brands.length,
productsCount: products.length,
detailSectionsCount,
productAttributesCount,
categorySectionsCount,
rawPayload: payload,
})
} catch {
@@ -390,6 +408,32 @@ export default function BackupCatalogPage() {
</div>
</div>
{/* Extended Preview Metadata */}
{(restorePreview.detailSectionsCount > 0 ||
restorePreview.productAttributesCount > 0 ||
restorePreview.categorySectionsCount > 0) && (
<div className="flex flex-wrap gap-2 pt-1 text-[11px] text-slate-400">
{restorePreview.productAttributesCount > 0 && (
<span className="bg-white/5 border border-white/10 px-2 py-0.5 rounded-md flex items-center gap-1">
<Sliders className="w-3 h-3 text-violet-400" />
Product Attribute Values: <b className="text-white">{restorePreview.productAttributesCount}</b>
</span>
)}
{restorePreview.detailSectionsCount > 0 && (
<span className="bg-white/5 border border-white/10 px-2 py-0.5 rounded-md flex items-center gap-1">
<Package className="w-3 h-3 text-cyan-400" />
Product Detail Sections: <b className="text-white">{restorePreview.detailSectionsCount}</b>
</span>
)}
{restorePreview.categorySectionsCount > 0 && (
<span className="bg-white/5 border border-white/10 px-2 py-0.5 rounded-md flex items-center gap-1">
<FolderTree className="w-3 h-3 text-amber-400" />
Category CMS Sections: <b className="text-white">{restorePreview.categorySectionsCount}</b>
</span>
)}
</div>
)}
{/* Confirmation Checkbox */}
<div className="p-3 bg-amber-500/10 rounded-lg border border-amber-500/20 flex items-start gap-2.5">
<AlertTriangle className="w-4 h-4 text-amber-400 shrink-0 mt-0.5" />
@@ -441,8 +485,9 @@ export default function BackupCatalogPage() {
{restoreResult.summary && (
<div className="text-xs text-slate-400 pl-6 space-y-0.5">
<p>• Products: {restoreResult.summary.products} (Variants: {restoreResult.summary.variants})</p>
<p>• Categories: {restoreResult.summary.categories}</p>
<p>• Attributes: {restoreResult.summary.attributes}</p>
<p>• Categories: {restoreResult.summary.categories} {restoreResult.summary.categorySections > 0 ? `(Sections: ${restoreResult.summary.categorySections})` : ''}</p>
<p>• Attribute Definitions: {restoreResult.summary.attributes} {restoreResult.summary.productAttributes > 0 ? `(Product Values: ${restoreResult.summary.productAttributes})` : ''}</p>
<p>• Product Detail Sections: {restoreResult.summary.detailSections || 0}</p>
<p>• Brands: {restoreResult.summary.brands}</p>
</div>
)}