widgets and other fixes

This commit is contained in:
IGNY8 VPS (Salman)
2026-01-11 15:24:52 +00:00
parent 747770ac58
commit e9369df151
16 changed files with 761 additions and 277 deletions

View File

@@ -146,6 +146,9 @@ export function useWorkflowStats(timeFilter: TimeFilter = 'all') {
return;
}
// Debug logging
console.log('[useWorkflowStats] Loading stats with timeFilter:', timeFilter, 'siteId:', activeSite.id);
setStats(prev => ({ ...prev, loading: true, error: null }));
try {
@@ -153,6 +156,8 @@ export function useWorkflowStats(timeFilter: TimeFilter = 'all') {
const dateFilter = getDateFilter(timeFilter);
const dateParam = dateFilter ? `&created_at__gte=${dateFilter.split('T')[0]}` : '';
console.log("[useWorkflowStats] Date filter:", { timeFilter, dateFilter, dateParam });
// IMPORTANT: Widget should always show site-wide stats for consistency
// Sector filtering removed to ensure widget shows same counts on all pages
const siteParam = `&site_id=${activeSite.id}`;
@@ -244,6 +249,7 @@ export function useWorkflowStats(timeFilter: TimeFilter = 'all') {
const plannerTotal = clusteringCredits + ideaCredits;
const writerTotal = contentCredits + imageCredits;
console.log("[useWorkflowStats] Results:", { keywordsCount: keywordsRes?.count, clustersCount: clustersRes?.count });
setStats({
planner: {
totalKeywords: keywordsRes?.count || 0,