Skip to content

Commit

Permalink
fix: Fix satellite data graph rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
Thibault Camlane committed Jun 10, 2025
1 parent 3f40a90 commit dd28c2b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 21 deletions.
Binary file modified backend/dbLocation.sqlite
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@ const OrbitDataGraph: React.FC<OrbitDataProps> = ({
updateSize();

return () => window.removeEventListener("resize", updateSize);
}, [handleChartScroll, months]);
}, []);

console.log("orbitalData", orbitalData);

return (
<>
Expand Down
28 changes: 11 additions & 17 deletions frontend/src/app/satellites/[satelliteSlug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default async function SatelliteInfoPage({

// Get the satellite attributes
let satAttributes = graphqlData?.data?.satellites?.data[0]?.attributes;
console.log("satAttributes", satAttributes);

// If the satellite is not found return a message
if (!satAttributes?.catalogNumberNORAD) {
return <div className="flex justify-center">Satellite not found</div>;
Expand All @@ -74,6 +74,8 @@ export default async function SatelliteInfoPage({
imageURL = STRAPI_URL + satelliteImage;
}

console.log("satAttributes", satAttributes);

return (
<>
<div className="flex flex-col items-center">
Expand Down Expand Up @@ -112,17 +114,9 @@ export default async function SatelliteInfoPage({
: null}
</p>
</div>

{satAttributes.missionStatus === "IN ORBIT" ? (
<div>
{" "}
<SatelliteDataHome
satelliteNum={
satAttributes?.catalogNumberNORAD
}
/>
</div>
) : null}
<div>
<SatelliteDataHome satelliteNum={noradId} />
</div>
</div>
{/* Image container */}
<div className="w-full border-t-2 border-gray-600 xl:border-t-0">
Expand All @@ -146,14 +140,16 @@ export default async function SatelliteInfoPage({
<div className="w-full">
<LaunchDateCountDown
launchDate={satAttributes?.launchDate}
missionStatus={satAttributes?.missionStatus}
orbitalData={satAttributes?.historicalOrbitalData}
missionStatus={satAttributes?.missionStatus ?? ""}
orbitalData={
satAttributes?.historicalOrbitalData ?? []
}
></LaunchDateCountDown>
</div>
) : null}

{/* Container for map */}
{noradId && satAttributes.missionStatus === "IN ORBIT" ? (
{noradId ? (
<div className="mt-6 w-full">
<Map2d satNum={noradId} />
</div>
Expand All @@ -167,7 +163,6 @@ export default async function SatelliteInfoPage({

{/* Container for graph of historical orbital data */}
<div className="mt-8 flex w-full flex-col items-center">
{/*Pass the historicalData and the launchDate as props to OrbitDataGraph*/}
{noradId ? (
satAttributes?.launchDate ? (
<OrbitDataGraph
Expand All @@ -177,7 +172,6 @@ export default async function SatelliteInfoPage({
) : null
) : null}
</div>

{/* Related projects */}
<div className="mt-8 flex w-full flex-col items-center">
{relatedProjects?.length != 0 ? (
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/components/satelliteData/SatelliteDataHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const updateInterval = 50; // in ms
export default function SatelliteDataHome({
satelliteNum,
}: {
satelliteNum: string | null;
satelliteNum: SatelliteNumber | null;
}) {
const { selectedSatellite, setSelectedSatellite, satNumToEntry } =
useSatelliteStore();
Expand All @@ -24,8 +24,7 @@ export default function SatelliteDataHome({
useEffect(() => {
const intervalId = setInterval(() => {
if (satelliteNum) {
const satelliteNumber = parseInt(satelliteNum, 10);
setSelectedSatellite(satelliteNumber as SatelliteNumber);
setSelectedSatellite(satelliteNum);
}
if (selectedSatellite) {
// Access satellite data by name
Expand Down

0 comments on commit dd28c2b

Please sign in to comment.