@@ -4,46 +4,45 @@ import { useQuery } from "@tanstack/react-query";
44import { orpc } from "@/lib/orpc" ;
55
66export type InsightType =
7- | "error_spike"
8- | "vitals_degraded"
9- | "custom_event_spike"
10- | "traffic_drop"
11- | "traffic_spike"
12- | "uptime_issue" ;
7+ | "error_spike"
8+ | "vitals_degraded"
9+ | "custom_event_spike"
10+ | "traffic_drop"
11+ | "traffic_spike"
12+ | "uptime_issue" ;
1313
1414export type InsightSeverity = "critical" | "warning" | "info" ;
1515
1616export interface Insight {
17- id : string ;
18- type : InsightType ;
19- severity : InsightSeverity ;
20- websiteId : string ;
21- websiteName : string | null ;
22- websiteDomain : string ;
23- title : string ;
24- description : string ;
25- metric ?: string ;
26- currentValue ?: number ;
27- previousValue ?: number ;
28- changePercent ?: number ;
29- link : string ;
17+ id : string ;
18+ type : InsightType ;
19+ severity : InsightSeverity ;
20+ websiteId : string ;
21+ websiteName : string | null ;
22+ websiteDomain : string ;
23+ title : string ;
24+ description : string ;
25+ metric ?: string ;
26+ currentValue ?: number ;
27+ previousValue ?: number ;
28+ changePercent ?: number ;
29+ link : string ;
3030}
3131
3232export function useSmartInsights ( ) {
33- const query = useQuery ( {
34- ...orpc . insights . getSmartInsights . queryOptions ( {
35- input : undefined ,
36- } ) ,
37- staleTime : 5 * 60 * 1000 ,
38- refetchInterval : 5 * 60 * 1000 ,
39- } ) ;
33+ const query = useQuery ( {
34+ ...orpc . insights . getSmartInsights . queryOptions ( {
35+ input : undefined ,
36+ } ) ,
37+ staleTime : 5 * 60 * 1000 ,
38+ refetchInterval : 5 * 60 * 1000 ,
39+ } ) ;
4040
41- return {
42- insights : ( query . data ?. insights ?? [ ] ) as Insight [ ] ,
43- isLoading : query . isLoading ,
44- isFetching : query . isFetching ,
45- isError : query . isError ,
46- refetch : query . refetch ,
47- } ;
41+ return {
42+ insights : ( query . data ?. insights ?? [ ] ) as Insight [ ] ,
43+ isLoading : query . isLoading ,
44+ isFetching : query . isFetching ,
45+ isError : query . isError ,
46+ refetch : query . refetch ,
47+ } ;
4848}
49-
0 commit comments