This commit is contained in:
IGNY8 VPS (Salman)
2025-11-25 20:24:07 +00:00
parent ba842d8332
commit 67ba00d714
3 changed files with 210 additions and 10 deletions

View File

@@ -24,9 +24,7 @@ import {
fetchTasks,
fetchContent,
fetchContentImages,
// TODO: Stage 3/4 - Add when taxonomy and attribute endpoints are implemented
// fetchTaxonomies,
// fetchAttributes
fetchTaxonomies,
} from "../../services/api";
import { useSiteStore } from "../../store/siteStore";
import { useSectorStore } from "../../store/sectorStore";
@@ -85,11 +83,11 @@ export default function WriterDashboard() {
try {
setLoading(true);
// TODO: Stage 3/4 - Re-enable when taxonomy and attribute endpoints are implemented
const [tasksRes, contentRes, imagesRes] = await Promise.all([
const [tasksRes, contentRes, imagesRes, taxonomiesRes] = await Promise.all([
fetchTasks({ page_size: 1000, sector_id: activeSector?.id }),
fetchContent({ page_size: 1000, sector_id: activeSector?.id }),
fetchContentImages({ sector_id: activeSector?.id }),
fetchTaxonomies({ page_size: 1000, sector_id: activeSector?.id }),
]);
const tasks = tasksRes.results || [];
@@ -145,9 +143,10 @@ export default function WriterDashboard() {
const contentThisMonth = Math.floor(content.length * 0.7);
const publishRate = content.length > 0 ? Math.round((published / content.length) * 100) : 0;
// TODO: Stage 3/4 - Re-enable when taxonomy and attribute endpoints are implemented
const taxonomyCount = 0; // taxonomiesRes.results?.length || 0
const attributeCount = 0; // attributesRes.results?.length || 0
const taxonomies = taxonomiesRes.results || [];
const taxonomyCount = taxonomies.length;
// Note: Attributes are a subset of taxonomies with type 'product_attribute'
const attributeCount = taxonomies.filter(t => t.taxonomy_type === 'product_attribute').length;
setStats({
tasks: {