This commit is contained in:
alorig
2025-11-22 05:50:07 +05:00
parent c1ce8de9fb
commit 554c1667b3
3 changed files with 144 additions and 4 deletions

View File

@@ -23,7 +23,9 @@ import {
import {
fetchTasks,
fetchContent,
fetchContentImages
fetchContentImages,
fetchTaxonomies,
fetchAttributes
} from "../../services/api";
import { useSiteStore } from "../../store/siteStore";
import { useSectorStore } from "../../store/sectorStore";
@@ -66,6 +68,8 @@ interface WriterStats {
avgGenerationTime: number;
publishRate: number;
};
taxonomies: number;
attributes: number;
}
export default function WriterDashboard() {
@@ -81,10 +85,12 @@ export default function WriterDashboard() {
try {
setLoading(true);
const [tasksRes, contentRes, imagesRes] = await Promise.all([
const [tasksRes, contentRes, imagesRes, taxonomiesRes, attributesRes] = await Promise.all([
fetchTasks({ page_size: 1000, sector_id: activeSector?.id }),
fetchContent({ page_size: 1000, sector_id: activeSector?.id }),
fetchContentImages({ sector_id: activeSector?.id })
fetchContentImages({ sector_id: activeSector?.id }),
fetchTaxonomies({ sector_id: activeSector?.id }),
fetchAttributes({ sector_id: activeSector?.id }),
]);
const tasks = tasksRes.results || [];
@@ -143,6 +149,12 @@ export default function WriterDashboard() {
const contentThisMonth = Math.floor(content.length * 0.7);
const publishRate = content.length > 0 ? Math.round((published / content.length) * 100) : 0;
const taxonomies = taxonomiesRes.results || [];
const attributes = attributesRes.results || [];
const taxonomyCount = taxonomies.length;
const attributeCount = attributes.length;
setStats({
tasks: {
total: tasks.length,
@@ -180,7 +192,9 @@ export default function WriterDashboard() {
contentThisMonth,
avgGenerationTime: 0,
publishRate
}
},
taxonomies: taxonomyCount,
attributes: attributeCount,
});
setLastUpdated(new Date());
@@ -239,6 +253,24 @@ export default function WriterDashboard() {
count: stats?.content.published || 0,
metric: "View all published",
},
{
title: "Taxonomies",
description: "Manage content taxonomies",
icon: BoltIcon,
color: "from-[var(--color-info)] to-[var(--color-info-dark)]",
path: "/writer/taxonomies",
count: stats?.taxonomies || 0,
metric: `${stats?.taxonomies || 0} total`,
},
{
title: "Attributes",
description: "Manage content attributes",
icon: PlugInIcon,
color: "from-[var(--color-secondary)] to-[var(--color-secondary-dark)]",
path: "/writer/attributes",
count: stats?.attributes || 0,
metric: `${stats?.attributes || 0} total`,
},
];
const recentActivity = [