tbaels fitlers and plnaner writer other fixes

This commit is contained in:
IGNY8 VPS (Salman)
2026-01-19 12:27:10 +00:00
parent cbb32b1c9d
commit 6c7395262f
16 changed files with 169 additions and 95 deletions

View File

@@ -52,6 +52,7 @@ export default function Approved() {
const [totalApproved, setTotalApproved] = useState(0);
const [totalPublished, setTotalPublished] = useState(0);
const [totalImagesCount, setTotalImagesCount] = useState(0);
const [generatedImagesCount, setGeneratedImagesCount] = useState(0);
// Dynamic filter options (loaded from backend)
const [statusOptions, setStatusOptions] = useState<Array<{value: string; label: string}> | undefined>(undefined);
@@ -144,13 +145,14 @@ export default function Approved() {
const loadTotalMetrics = useCallback(async () => {
try {
// Fetch counts in parallel for performance
const [allRes, draftRes, reviewRes, approvedRes, publishedRes, imagesRes] = await Promise.all([
const [allRes, draftRes, reviewRes, approvedRes, publishedRes, imagesRes, generatedImagesRes] = await Promise.all([
fetchContent({ page_size: 1, site_id: activeSite?.id }),
fetchContent({ page_size: 1, status: 'draft', site_id: activeSite?.id }),
fetchContent({ page_size: 1, status: 'review', site_id: activeSite?.id }),
fetchContent({ page_size: 1, status: 'approved', site_id: activeSite?.id }),
fetchContent({ page_size: 1, status: 'published', site_id: activeSite?.id }),
fetchImages({ page_size: 1, site_id: activeSite?.id }),
fetchImages({ page_size: 1, site_id: activeSite?.id, status: 'generated' }),
]);
setTotalContent(allRes.count || 0);
@@ -159,6 +161,7 @@ export default function Approved() {
setTotalApproved(approvedRes.count || 0);
setTotalPublished(publishedRes.count || 0);
setTotalImagesCount(imagesRes.count || 0);
setGeneratedImagesCount(generatedImagesRes.count || 0);
} catch (error) {
console.error('Error loading total metrics:', error);
}
@@ -706,9 +709,15 @@ export default function Approved() {
case 'Published':
value = totalPublished;
break;
case 'Total Images':
case 'Images':
value = totalImagesCount;
break;
return {
label: metric.label,
displayValue: `${generatedImagesCount}/${totalImagesCount}`,
value,
accentColor: metric.accentColor,
tooltip: (metric as any).tooltip,
};
default:
value = metric.calculate({ content, totalCount });
}
@@ -720,7 +729,7 @@ export default function Approved() {
tooltip: (metric as any).tooltip,
};
});
}, [pageConfig?.headerMetrics, content, totalCount, totalContent, totalDraft, totalReview, totalApproved, totalPublished, totalImagesCount]);
}, [pageConfig?.headerMetrics, content, totalCount, totalContent, totalDraft, totalReview, totalApproved, totalPublished, totalImagesCount, generatedImagesCount]);
return (
<>