From 21e89f685bb1bdc6c5d31c22bfefdbbe5cc7c4c7 Mon Sep 17 00:00:00 2001 From: Mads Hermansen <119772939+madshermansen@users.noreply.github.com> Date: Mon, 22 Apr 2024 14:41:13 +0200 Subject: [PATCH] =?UTF-8?q?feat(frontend):=20:sparkles:=20Update=20satelli?= =?UTF-8?q?te=20page=20layout=20and=20map=20compo=E2=80=A6=20(#312)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(frontend): :sparkles: Update satellite page layout and map component + navbar fix * feat(frontend): :sparkles: prettier write * small fixes with styling * underline noradID * prettier --------- Co-authored-by: Lukas --- .../app/satellites/[satelliteSlug]/page.tsx | 35 ++++++++++++------- frontend/src/components/2dmap/Map2d.tsx | 14 ++++---- frontend/src/components/Navbar.tsx | 2 +- .../src/components/ui/launchDateCountDown.tsx | 9 +++-- 4 files changed, 35 insertions(+), 25 deletions(-) diff --git a/frontend/src/app/satellites/[satelliteSlug]/page.tsx b/frontend/src/app/satellites/[satelliteSlug]/page.tsx index a1597fc..344cf8b 100644 --- a/frontend/src/app/satellites/[satelliteSlug]/page.tsx +++ b/frontend/src/app/satellites/[satelliteSlug]/page.tsx @@ -52,7 +52,7 @@ export default async function SatelliteInfoPage({ return ( <> -
+
{satelliteInfo.name} @@ -62,22 +62,24 @@ export default async function SatelliteInfoPage({ - {satelliteInfo.launchDate ? ( -
- -
- ) : null} {/* Container for satname, stats and sat image */} {satelliteInfo.noradId ? (
{/* Stats Container */}
- {satelliteInfo.noradId - ? "NORAD ID: " + satelliteInfo.noradId - : null} + {satelliteInfo.noradId ? ( + + ) : null}

{satelliteInfo.massKg ? "Mass: " + @@ -115,8 +117,17 @@ export default async function SatelliteInfoPage({

) : null} + {/* Container for launch date */} + {satelliteInfo.launchDate ? ( +
+ +
+ ) : null} + {/* Container for body content */} -
+
diff --git a/frontend/src/components/2dmap/Map2d.tsx b/frontend/src/components/2dmap/Map2d.tsx index a4e1854..aba8cf8 100644 --- a/frontend/src/components/2dmap/Map2d.tsx +++ b/frontend/src/components/2dmap/Map2d.tsx @@ -8,7 +8,7 @@ import { predictFuturePositions, } from "@/lib/convertSatrec"; -const updateInterval = 50; +const updateInterval = 100; export default function Map2d({ satName }: { satName: string }) { const { satelliteData } = useSatelliteStore(); @@ -94,9 +94,9 @@ export default function Map2d({ satName }: { satName: string }) { return (
-
-

- Current and Predicted Satellite Position +
+

+ Satellite Position

- Positions {projectionAmount} minutes into the{" "} - {projectionAmount >= 0 ? "future" : "past"} + Projected positions {projectionAmount / 60} hours into + the {projectionAmount >= 0 ? "future" : "past"}

diff --git a/frontend/src/components/Navbar.tsx b/frontend/src/components/Navbar.tsx index c52e5cd..74ddf09 100644 --- a/frontend/src/components/Navbar.tsx +++ b/frontend/src/components/Navbar.tsx @@ -122,7 +122,7 @@ export function CodiconGithubProject(props: SVGProps) { export default function Navbar() { const pathname = usePathname(); const getButtonVariant = (path: string) => { - if (path === pathname) { + if (pathname.includes(path)) { return; } return "ghost"; diff --git a/frontend/src/components/ui/launchDateCountDown.tsx b/frontend/src/components/ui/launchDateCountDown.tsx index 84bf812..26a1a7f 100644 --- a/frontend/src/components/ui/launchDateCountDown.tsx +++ b/frontend/src/components/ui/launchDateCountDown.tsx @@ -1,5 +1,4 @@ -"use client"; // This directive marks the component for client-side execution - +"use client"; import React, { useState, useEffect } from "react"; type LaunchDateCountDownProps = { @@ -62,11 +61,11 @@ const LaunchDateCountDown: React.FC = ({ )}

-
-
+
+
-
+
{displayTime.length > 0 && (