@@ -5,15 +5,14 @@ import { Link } from "@/shared/components/ui/link";
55import { Spinner } from "@/shared/components/ui/spinner" ;
66import { useParams } from "react-router" ;
77import { useEvents } from "../api/get-events.query" ;
8- import { INFRAHUB_EVENT } from "../utils/constants" ;
9- import { Event , EventType } from "./event" ;
8+ import { Event } from "./event" ;
109
1110const MAX_EVENTS = 5 ;
1211
1312export const NodeEvents = ( ) => {
1413 const { objectid } = useParams ( ) ;
1514
16- const { isLoading, data, error } = useEvents ( { ids : [ objectid ] , limit : MAX_EVENTS } ) ;
15+ const { isLoading, data, count , error } = useEvents ( { ids : [ objectid ] , limit : MAX_EVENTS } ) ;
1716
1817 if ( isLoading ) {
1918 return (
@@ -27,21 +26,17 @@ export const NodeEvents = () => {
2726 return < ErrorFallback error = { error } /> ;
2827 }
2928
30- const activities : EventType [ ] = data ?. data ?. [ INFRAHUB_EVENT ] ?. edges ?. map ( ( edge ) => {
31- return edge . node ;
32- } ) ;
33-
34- if ( ! activities ?. length ) {
29+ if ( ! data ?. length ) {
3530 return < NoDataFound message = "No activity found for this object." /> ;
3631 }
3732
3833 return (
3934 < div className = "flex flex-col gap-2 p-2" >
40- { activities ?. map ( ( activity ) => (
35+ { data ?. map ( ( activity ) => (
4136 < Event key = { activity . id } { ...activity } />
4237 ) ) }
4338
44- { data ?. data ?. [ INFRAHUB_EVENT ] ?. count > MAX_EVENTS && (
39+ { count > MAX_EVENTS && (
4540 < div className = "flex items-center justify-center" >
4641 < Link to = { constructPath ( "/activities" ) } className = "p-1 text-sm text-gray-400 text-center" >
4742 More events...
0 commit comments