Section 1 & 2 - #Migration Run

This commit is contained in:
IGNY8 VPS (Salman)
2026-01-01 06:29:13 +00:00
parent dd63403e94
commit f81fffc9a6
17 changed files with 149 additions and 44 deletions

View File

@@ -139,7 +139,7 @@ const AutomationPage: React.FC = () => {
fetchContent({ page_size: 1, site_id: siteId }),
fetchContent({ page_size: 1, site_id: siteId, status: 'draft' }),
fetchContent({ page_size: 1, site_id: siteId, status: 'review' }),
fetchContent({ page_size: 1, site_id: siteId, status: 'published' }),
fetchContent({ page_size: 1, site_id: siteId, status__in: 'approved,published' }),
fetchImages({ page_size: 1 }),
fetchImages({ page_size: 1, status: 'pending' }),
]);
@@ -258,7 +258,7 @@ const AutomationPage: React.FC = () => {
fetchContent({ page_size: 1, site_id: siteId }),
fetchContent({ page_size: 1, site_id: siteId, status: 'draft' }),
fetchContent({ page_size: 1, site_id: siteId, status: 'review' }),
fetchContent({ page_size: 1, site_id: siteId, status: 'published' }),
fetchContent({ page_size: 1, site_id: siteId, status__in: 'approved,published' }),
fetchImages({ page_size: 1 }),
fetchImages({ page_size: 1, status: 'pending' }),
]);

View File

@@ -7,6 +7,8 @@ import React, { useState, useEffect } from 'react';
import { useParams, useNavigate } from 'react-router-dom';
import PageMeta from '../../components/common/PageMeta';
import PageHeader from '../../components/common/PageHeader';
import ComponentCard from '../../components/common/ComponentCard';
import { Card } from '../../components/ui/card';
import Button from '../../components/ui/button/Button';
import { useToast } from '../../components/ui/toast/ToastContainer';
import { fetchAPI, fetchSiteSectors } from '../../services/api';
@@ -23,6 +25,7 @@ import {
BoltIcon,
PageIcon,
ArrowRightIcon,
ArrowUpIcon,
} from '../../icons';
interface Site {
@@ -251,6 +254,7 @@ export default function SiteDashboard() {
<CreditAvailabilityWidget
availableCredits={balance?.credits_remaining ?? 0}
totalCredits={balance?.plan_credits_per_month ?? 0}
usedCredits={balance?.credits_used_this_month ?? 0}
loading={loading}
/>
</div>

View File

@@ -59,9 +59,9 @@ export default function Approved() {
// Load total metrics for footer widget and header metrics (not affected by pagination)
const loadTotalMetrics = useCallback(async () => {
try {
// Fetch all approved content to calculate totals
// Fetch all approved+published content to calculate totals
const data = await fetchContent({
status: 'published', // Backend uses 'published' for approved content
status__in: 'approved,published', // Both approved and published content
page_size: 1000, // Fetch enough to count
});
@@ -86,7 +86,7 @@ export default function Approved() {
loadTotalMetrics();
}, [loadTotalMetrics]);
// Load content - filtered for approved status (API still uses 'published' internally)
// Load content - filtered for approved+published status
const loadContent = useCallback(async () => {
setLoading(true);
setShowContent(false);
@@ -95,7 +95,7 @@ export default function Approved() {
const filters: ContentFilters = {
...(searchTerm && { search: searchTerm }),
status: 'published', // Backend uses 'published' for approved content
status__in: 'approved,published', // Both approved and published content
page: currentPage,
page_size: pageSize,
ordering,
@@ -221,8 +221,13 @@ export default function Approved() {
toast.warning('WordPress URL not available');
}
} else if (action === 'edit') {
// Navigate to content editor (if exists) or show edit modal
navigate(`/writer/content?id=${row.id}`);
// Navigate to content editor
if (row.site_id) {
navigate(`/sites/${row.site_id}/posts/${row.id}/edit`);
} else {
// Fallback if site_id not available
toast.warning('Unable to edit: Site information not available');
}
}
}, [toast, loadContent, navigate]);

View File

@@ -81,11 +81,11 @@ export default function Content() {
});
setTotalReview(reviewRes.count || 0);
// Get content with status='published'
// Get content with status='approved' or 'published' (ready for publishing or on site)
const publishedRes = await fetchContent({
page_size: 1,
...(activeSector?.id && { sector_id: activeSector.id }),
status: 'published',
status__in: 'approved,published',
});
setTotalPublished(publishedRes.count || 0);