"use client"; import { useQuery } from "@tanstack/react-query"; import { Card, CardContent, PageHeader, StatCard } from "@/components/ds"; import { useCurrentHub } from "@/modules/workspace/hooks/useCurrentHub"; import { workspaceApi } from "@/modules/workspace/services/workspace-api"; import { useTenantMembers } from "@/modules/workspace/hooks/useTenantMembers"; import { CONTENT_STATUS, labelOf, personLabel } from "@/modules/workspace/labels"; import { WorkspaceEmptyState, WorkspacePageError, WorkspacePageLoader } from "@/modules/workspace/pages/shared"; export const WorkspaceReports = function WorkspaceReportsPage() { const { tenantId, hubId, loading } = useCurrentHub(); const people = useTenantMembers(); const directory = Object.fromEntries((people.data ?? []).map((person) => [person.id, person.label])); const dash = useQuery({ queryKey: ["workspace", tenantId, "dashboard", hubId], queryFn: () => workspaceApi.hubs.dashboard(tenantId!, hubId!), enabled: !!tenantId && !!hubId, }); if (!tenantId || loading || dash.isLoading) return ; if (!hubId) return ; if (dash.error) return dash.refetch()} />; const data = dash.data!; return (

وضعیت تولید

{Object.entries(data.content).map(([status, count]) => (
{labelOf(CONTENT_STATUS, status)} {count}
))}

بار کاری

{data.workload.length === 0 ? (

تخصیصی ثبت نشده است.

) : ( data.workload.map((row) => (
{personLabel(row.user_id, directory)} {row.tasks} وظیفه / {row.content} محتوا
)) )}
); }; export default WorkspaceReports;