TorbatYar/frontend/modules/communication/features/monitoring.tsx
Mortezakoohjani 10c3c43a75 feat(communication): add SMS MVP frontend with governance artifacts.
Ship the full Communication portal (real SMS API, feature-locked future channels), BFF proxy, docs, snapshot, and phase handover.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 11:11:25 +03:30

49 lines
2.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use client";
import { useQuery } from "@tanstack/react-query";
import { communicationApi } from "@/modules/communication/services/communication-api";
import { useTenantId } from "@/hooks/useTenantId";
import { CommunicationPageLoader, CommunicationPageError } from "@/modules/communication/pages/shared";
import { PageHeader, Card, CardContent } from "@/components/ds";
import { CommunicationBreadcrumbs } from "@/modules/communication/components/CommunicationBreadcrumbs";
export function MonitoringPage() {
const { tenantId } = useTenantId();
const q = useQuery({
queryKey: ["communication", tenantId, "monitoring"],
queryFn: () => communicationApi.monitoring.stats(tenantId!),
enabled: !!tenantId,
});
if (!tenantId || q.isLoading) return <CommunicationPageLoader />;
if (q.error) return <CommunicationPageError error={q.error} onRetry={() => q.refetch()} />;
return (
<div className="space-y-6">
<CommunicationBreadcrumbs current=انیتoring" />
<PageHeader title=انیتoring" description="آمار real-time از backend" />
<Card><CardContent className="overflow-x-auto p-4"><pre className="text-xs">{JSON.stringify(q.data, null, 2)}</pre></CardContent></Card>
</div>
);
}
export const AnalyticsPage = function Analytics() {
const { tenantId } = useTenantId();
const q = useQuery({
queryKey: ["communication", tenantId, "metrics"],
queryFn: () => communicationApi.monitoring.metrics(tenantId!),
enabled: !!tenantId,
});
if (!tenantId || q.isLoading) return <CommunicationPageLoader />;
if (q.error) return <CommunicationPageError error={q.error} onRetry={() => q.refetch()} />;
return (
<div className="space-y-6">
<CommunicationBreadcrumbs current="آنالیتیکس" />
<PageHeader title="آنالیتیکس" description="Latency، failure rate، provider metrics" />
<Card><CardContent className="overflow-x-auto p-4"><pre className="text-xs">{JSON.stringify(q.data, null, 2)}</pre></CardContent></Card>
</div>
);
};
export const ReportsPage = MonitoringPage;
export default MonitoringPage;