From 7c48854e86f56e343cabf9bd7d801fc27d497a0c Mon Sep 17 00:00:00 2001
From: Desktop
- {step.count} {step.title.toLowerCase().includes('keyword') ? 'keywords' : - step.title.toLowerCase().includes('cluster') ? 'clusters' : - step.title.toLowerCase().includes('idea') ? 'ideas' : - step.title.toLowerCase().includes('task') ? 'tasks' : 'items'} + {step.count > 0 ? ( + <> + {step.count} {step.title.toLowerCase().includes('keyword') ? 'keywords' : + step.title.toLowerCase().includes('cluster') ? 'clusters' : + step.title.toLowerCase().includes('idea') ? 'ideas' : + step.title.toLowerCase().includes('task') ? 'tasks' : 'items'} + > + ) : ( + No items + )}
- {step.status === "pending" && ( + {step.status === "pending" && step.count === 0 && ( stats.keywords.byStatus[key] > 0), colors: ['#465FFF', '#10B981', '#F59E0B', '#EF4444', '#8B5CF6'], legend: { position: 'bottom', - fontFamily: 'Outfit' + fontFamily: 'Outfit', + show: true }, dataLabels: { enabled: false // Disable labels on pie slices }, + tooltip: { + enabled: true, + y: { + formatter: (val: number, { seriesIndex, w }: any) => { + const label = w.globals.labels[seriesIndex] || ''; + return `${label}: ${val}`; + } + } + }, plotOptions: { pie: { donut: { @@ -236,34 +246,21 @@ export default function PlannerDashboard() { labels: { show: true, name: { - show: true, - fontSize: '14px', - fontWeight: 600, - color: '#374151', - fontFamily: 'Outfit' + show: false // Hide "Total" label }, value: { show: true, - fontSize: '20px', + fontSize: '24px', fontWeight: 700, color: '#465FFF', fontFamily: 'Outfit', - formatter: (val: string) => { + formatter: () => { const total = Object.values(stats.keywords.byStatus).reduce((a, b) => a + b, 0); return total > 0 ? total.toString() : '0'; } }, total: { - show: true, - label: 'Total', - fontSize: '12px', - fontWeight: 500, - color: '#6B7280', - fontFamily: 'Outfit', - formatter: () => { - const total = Object.values(stats.keywords.byStatus).reduce((a, b) => a + b, 0); - return total.toString(); - } + show: false // Hide total label } } } @@ -271,7 +268,9 @@ export default function PlannerDashboard() { } }; - const series = Object.values(stats.keywords.byStatus); + const series = Object.keys(stats.keywords.byStatus) + .filter(key => stats.keywords.byStatus[key] > 0) + .map(key => stats.keywords.byStatus[key]); return { options, series }; }, [stats]); diff --git a/frontend/src/pages/Writer/Dashboard.tsx b/frontend/src/pages/Writer/Dashboard.tsx index 2ee04531..a704b6e0 100644 --- a/frontend/src/pages/Writer/Dashboard.tsx +++ b/frontend/src/pages/Writer/Dashboard.tsx @@ -246,15 +246,25 @@ export default function WriterDashboard() { fontFamily: 'Outfit, sans-serif', toolbar: { show: false } }, - labels: Object.keys(stats.tasks.byStatus), + labels: Object.keys(stats.tasks.byStatus).filter(key => stats.tasks.byStatus[key] > 0), colors: ['#465FFF', '#F59E0B', '#10B981', '#EF4444', '#8B5CF6'], legend: { position: 'bottom', - fontFamily: 'Outfit' + fontFamily: 'Outfit', + show: true }, dataLabels: { enabled: false // Disable labels on pie slices }, + tooltip: { + enabled: true, + y: { + formatter: (val: number, { seriesIndex, w }: any) => { + const label = w.globals.labels[seriesIndex] || ''; + return `${label}: ${val}`; + } + } + }, plotOptions: { pie: { donut: { @@ -262,34 +272,21 @@ export default function WriterDashboard() { labels: { show: true, name: { - show: true, - fontSize: '14px', - fontWeight: 600, - color: '#374151', - fontFamily: 'Outfit' + show: false // Hide "Total" label }, value: { show: true, - fontSize: '20px', + fontSize: '24px', fontWeight: 700, color: '#465FFF', fontFamily: 'Outfit', - formatter: (val: string) => { + formatter: () => { const total = Object.values(stats.tasks.byStatus).reduce((a, b) => a + b, 0); return total > 0 ? total.toString() : '0'; } }, total: { - show: true, - label: 'Total', - fontSize: '12px', - fontWeight: 500, - color: '#6B7280', - fontFamily: 'Outfit', - formatter: () => { - const total = Object.values(stats.tasks.byStatus).reduce((a, b) => a + b, 0); - return total.toString(); - } + show: false // Hide total label } } } @@ -297,7 +294,9 @@ export default function WriterDashboard() { } }; - const series = Object.values(stats.tasks.byStatus); + const series = Object.keys(stats.tasks.byStatus) + .filter(key => stats.tasks.byStatus[key] > 0) + .map(key => stats.tasks.byStatus[key]); return { options, series }; }, [stats]);