diff --git a/frontend/src/app/satellites/page.tsx b/frontend/src/app/satellites/page.tsx index 9e02a25..4502e7b 100644 --- a/frontend/src/app/satellites/page.tsx +++ b/frontend/src/app/satellites/page.tsx @@ -6,6 +6,14 @@ import { } from "@/components/PageHeader"; import SatelliteStatsTableRow from "@/components/satelliteData/SatelliteStatsTableRow"; import { getClient } from "@/lib/ApolloClient"; +import { + Table, + TableBody, + TableHead, + TableHeader, + TableRow, +} from "@/components/shadcn/table"; + const GET_SATELLITES = gql(` query GET_SATELLITES { satellites { @@ -45,17 +53,17 @@ export default async function Satellites() { to see more details. - - - - - - - - - - - +
SatelliteSpeedAltitudeLatitudeLongitude
+ + + Satellite + Speed + Altitude + Latitude + Longitude + + + {graphqlData?.data?.satellites?.data?.map( (satellite: any) => { let satelliteName = @@ -69,8 +77,8 @@ export default async function Satellites() { ); }, )} - -
+ + ); } catch (error) { diff --git a/frontend/src/components/satelliteData/SatelliteStatsTableRow.tsx b/frontend/src/components/satelliteData/SatelliteStatsTableRow.tsx index 29c5750..b6c3097 100644 --- a/frontend/src/components/satelliteData/SatelliteStatsTableRow.tsx +++ b/frontend/src/components/satelliteData/SatelliteStatsTableRow.tsx @@ -2,7 +2,8 @@ import { useState, useEffect } from "react"; import { convertSatrec, SatelliteInfo } from "@/lib/convertSatrec"; import { useSatelliteStore } from "@/lib/store"; -import Link from "next/link"; +import { TableCell, TableRow } from "@/components/shadcn/table"; +import { useRouter } from "next/navigation"; const updateInterval = 10; @@ -18,6 +19,8 @@ export default function SatelliteStatsTableRow({ null, ); + const router = useRouter(); + // Fetch satellite data on component mount useEffect(() => { fetchAndSetSatelliteData(satName); @@ -50,33 +53,29 @@ export default function SatelliteStatsTableRow({ ); } + + function handleClick() { + router.replace(`/satellites/${slug}`); + } + return ( - - - - {satName} - - - - - {satelliteInfo.velocity + " km/s"} - - - - - {satelliteInfo.altitude + " km"} - - - - - {satelliteInfo.latitudeDeg + "° N"} - - - - - {satelliteInfo.longitudeDeg + "° E"} - - - + + {satName} + + {satelliteInfo.velocity + " km/s"} + + + {satelliteInfo.altitude + " km"} + + + {satelliteInfo.latitudeDeg + "° N"} + + + {satelliteInfo.longitudeDeg + "° E"} + + ); }