From d824a5fbb7714b3bf27448dbc3bf74d10949ea56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Alexander=20Str=C3=B8mseng?= Date: Mon, 15 Apr 2024 14:08:36 +0200 Subject: [PATCH] 262 vise norad pa satelitt siden (#298) * fix conditional rendering of related projects * add norad id to page * fix merge conflicts and borders * fix more borders * fix even more borders --- frontend/src/app/page.tsx | 2 +- .../app/satellites/[satelliteSlug]/page.tsx | 54 ++++++++++--------- .../satelliteData/SatelliteDataHome.tsx | 2 +- frontend/src/lib/data/fetchSatelliteInfo.ts | 3 ++ 4 files changed, 35 insertions(+), 26 deletions(-) diff --git a/frontend/src/app/page.tsx b/frontend/src/app/page.tsx index 3fa7c81..f23b569 100644 --- a/frontend/src/app/page.tsx +++ b/frontend/src/app/page.tsx @@ -31,7 +31,7 @@ export default async function Home() { {/* Globe Container */} -
+
diff --git a/frontend/src/app/satellites/[satelliteSlug]/page.tsx b/frontend/src/app/satellites/[satelliteSlug]/page.tsx index 87001b1..d77f3a7 100644 --- a/frontend/src/app/satellites/[satelliteSlug]/page.tsx +++ b/frontend/src/app/satellites/[satelliteSlug]/page.tsx @@ -10,6 +10,7 @@ export interface SatelliteInfo { name: string; content: BlocksContent; relatedProjects?: ProjectOrSatellite[]; + noradId: string | undefined; } export interface ProjectOrSatellite { @@ -33,23 +34,28 @@ export default async function SatelliteInfoPage({ return ( <> -
+
+

+ {satelliteInfo.name} +

{/* Container for satname, stats and sat image */} -
+
{/* Stats Container */} -
-
-

- {satelliteInfo.name} -

-
-
+
+ {satelliteInfo.noradId ? ( +
+

+ {satelliteInfo.noradId} +

+

NORAD ID

+
+ ) : null} +
- {/* Image container */} -
+

Satellite Image

@@ -68,22 +74,22 @@ export default async function SatelliteInfoPage({
{/* Related projects */} -
- {satelliteInfo.relatedProjects?.length != 0 ? ( + {satelliteInfo.relatedProjects?.length != 0 ? ( +

Related Projects

- ) : null} -
- {satelliteInfo.relatedProjects?.map( - (project: ProjectOrSatellite) => ( - - ), - )} +
+ {satelliteInfo.relatedProjects?.map( + (project: ProjectOrSatellite) => ( + + ), + )} +
-
+ ) : null} ); } diff --git a/frontend/src/components/satelliteData/SatelliteDataHome.tsx b/frontend/src/components/satelliteData/SatelliteDataHome.tsx index a0eb254..687c5d4 100644 --- a/frontend/src/components/satelliteData/SatelliteDataHome.tsx +++ b/frontend/src/components/satelliteData/SatelliteDataHome.tsx @@ -77,7 +77,7 @@ export default function SatelliteDataHome() {
-
+

{satelliteInfo diff --git a/frontend/src/lib/data/fetchSatelliteInfo.ts b/frontend/src/lib/data/fetchSatelliteInfo.ts index b4d7399..0626061 100644 --- a/frontend/src/lib/data/fetchSatelliteInfo.ts +++ b/frontend/src/lib/data/fetchSatelliteInfo.ts @@ -77,6 +77,9 @@ export default async function fetchSatelliteInfo({ content: graphqlData?.data?.satellites?.data[0]?.attributes?.content ?? "", relatedProjects: projects ?? [], + noradId: + graphqlData?.data?.satellites?.data[0]?.attributes + ?.catalogNumberNORAD ?? undefined, }; return satelliteInfo;