123
This commit is contained in:
@@ -20,7 +20,6 @@ import { useSectorStore } from '../../store/sectorStore';
|
||||
import { usePageSizeStore } from '../../store/pageSizeStore';
|
||||
import ProgressModal from '../../components/common/ProgressModal';
|
||||
import { useProgressModal } from '../../hooks/useProgressModal';
|
||||
import ContentViewerModal from '../../components/common/ContentViewerModal';
|
||||
import PageHeader from '../../components/common/PageHeader';
|
||||
import ModuleNavigationTabs from '../../components/navigation/ModuleNavigationTabs';
|
||||
import ModuleMetricsFooter, { MetricItem, ProgressMetric } from '../../components/dashboard/ModuleMetricsFooter';
|
||||
@@ -50,10 +49,6 @@ export default function Content() {
|
||||
const [sortDirection, setSortDirection] = useState<'asc' | 'desc'>('desc');
|
||||
const [showContent, setShowContent] = useState(false);
|
||||
|
||||
// Content viewer modal state
|
||||
const [isViewerModalOpen, setIsViewerModalOpen] = useState(false);
|
||||
const [viewerContent, setViewerContent] = useState<ContentType | null>(null);
|
||||
|
||||
// Progress modal for AI functions
|
||||
const progressModal = useProgressModal();
|
||||
const hasReloadedRef = useRef(false);
|
||||
@@ -138,11 +133,12 @@ export default function Content() {
|
||||
setCurrentPage(1);
|
||||
};
|
||||
|
||||
// Handle view content
|
||||
const handleViewContent = useCallback((row: ContentType) => {
|
||||
setViewerContent(row);
|
||||
setIsViewerModalOpen(true);
|
||||
}, []);
|
||||
const navigate = useNavigate();
|
||||
|
||||
// Handle row click - navigate to content view
|
||||
const handleRowClick = useCallback((row: ContentType) => {
|
||||
navigate(`/writer/content/${row.id}`);
|
||||
}, [navigate]);
|
||||
|
||||
// Create page config
|
||||
const pageConfig = useMemo(() => {
|
||||
@@ -153,13 +149,13 @@ export default function Content() {
|
||||
statusFilter,
|
||||
setStatusFilter,
|
||||
setCurrentPage,
|
||||
onViewContent: handleViewContent,
|
||||
onRowClick: handleRowClick,
|
||||
});
|
||||
}, [
|
||||
activeSector,
|
||||
searchTerm,
|
||||
statusFilter,
|
||||
handleViewContent,
|
||||
handleRowClick,
|
||||
]);
|
||||
|
||||
// Calculate header metrics
|
||||
@@ -172,8 +168,6 @@ export default function Content() {
|
||||
}));
|
||||
}, [pageConfig?.headerMetrics, content, totalCount]);
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const handleRowAction = useCallback(async (action: string, row: ContentType) => {
|
||||
if (action === 'view_on_wordpress') {
|
||||
if (row.external_url) {
|
||||
@@ -194,7 +188,7 @@ export default function Content() {
|
||||
);
|
||||
} else {
|
||||
// Synchronous completion
|
||||
toast.success(`Image prompts generated: ${result.prompts_created || 0} prompt${(result.prompts_created || 0) === 1 ? '' : 's'} created`);
|
||||
toast.success(`Image prompts generation task started. Task ID: ${result.task_id || 'N/A'}`);
|
||||
loadContent(); // Reload to show new prompts
|
||||
}
|
||||
} else {
|
||||
@@ -300,17 +294,6 @@ export default function Content() {
|
||||
}}
|
||||
/>
|
||||
|
||||
{/* Content Viewer Modal */}
|
||||
<ContentViewerModal
|
||||
isOpen={isViewerModalOpen}
|
||||
onClose={() => {
|
||||
setIsViewerModalOpen(false);
|
||||
setViewerContent(null);
|
||||
}}
|
||||
title={viewerContent?.title || 'Content'}
|
||||
contentHtml={viewerContent?.content_html || ''}
|
||||
/>
|
||||
|
||||
{/* Progress Modal for AI Functions */}
|
||||
<ProgressModal
|
||||
isOpen={progressModal.isOpen}
|
||||
|
||||
@@ -109,6 +109,11 @@ export default function Review() {
|
||||
setCurrentPage(1);
|
||||
}, [sortBy]);
|
||||
|
||||
// Handle row click - navigate to content view
|
||||
const handleRowClick = useCallback((row: Content) => {
|
||||
navigate(`/writer/content/${row.id}`);
|
||||
}, [navigate]);
|
||||
|
||||
// Build page config
|
||||
const pageConfig = useMemo(() =>
|
||||
createReviewPageConfig({
|
||||
@@ -118,8 +123,9 @@ export default function Review() {
|
||||
statusFilter,
|
||||
setStatusFilter,
|
||||
setCurrentPage,
|
||||
onRowClick: handleRowClick,
|
||||
}),
|
||||
[activeSector, searchTerm, statusFilter]
|
||||
[activeSector, searchTerm, statusFilter, handleRowClick]
|
||||
);
|
||||
|
||||
// Header metrics (calculated from loaded data)
|
||||
|
||||
Reference in New Issue
Block a user