Skip to content

Commit

Permalink
262 vise norad pa satelitt siden (#298)
Browse files Browse the repository at this point in the history
* fix conditional rendering of related projects

* add norad id to page

* fix merge conflicts and borders

* fix more borders

* fix even more borders
  • Loading branch information
Magnus Alexander Strømseng authored and GitHub committed Apr 15, 2024
1 parent 1e123b8 commit d824a5f
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 26 deletions.
2 changes: 1 addition & 1 deletion frontend/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default async function Home() {
</div>

{/* Globe Container */}
<div className="z-0 w-full overflow-x-hidden border-2 border-gray-600 xl:w-2/3 ">
<div className="z-0 w-full overflow-x-hidden border-2 border-t-0 border-gray-600 xl:w-2/3 xl:border-t-2">
<div className="flex h-full items-center justify-center ">
<SatelliteGlobeNoSSR />
</div>
Expand Down
54 changes: 30 additions & 24 deletions frontend/src/app/satellites/[satelliteSlug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface SatelliteInfo {
name: string;
content: BlocksContent;
relatedProjects?: ProjectOrSatellite[];
noradId: string | undefined;
}

export interface ProjectOrSatellite {
Expand All @@ -33,23 +34,28 @@ export default async function SatelliteInfoPage({

return (
<>
<div className="flex w-full flex-col items-center ">
<div className="flex flex-col items-center ">
<h1 className="mb-2 self-start text-4xl font-bold">
{satelliteInfo.name}
</h1>
{/* Container for satname, stats and sat image */}
<div className="flex w-full flex-col bg-gray-600 p-0.5 xl:flex-row">
<div className="flex w-full flex-col border-2 border-gray-600 xl:flex-row">
{/* Stats Container */}
<div className="z-10 flex w-full flex-col">
<div className="bg-black p-5">
<h1 className="text-xl font-bold tracking-wide">
{satelliteInfo.name}
</h1>
</div>
<div className="mt-0.5">
<div className="z-10 flex w-full flex-col border-gray-600 xl:border-r-2">
{satelliteInfo.noradId ? (
<div className="grow basis-0 border-b border-gray-600 bg-black p-5">
<h1 className="text-xl font-bold tracking-wide">
{satelliteInfo.noradId}
</h1>
<p className="text-gray-400">NORAD ID</p>
</div>
) : null}
<div>
<SatelliteDataHome />
</div>
</div>

{/* Image container */}
<div className="z-0 ml-0.5 w-full">
<div className="w-full border-t-2 border-gray-600 xl:border-t-0">
<div className="flex h-full w-full items-center justify-center bg-black">
<h1>Satellite Image</h1>
</div>
Expand All @@ -68,22 +74,22 @@ export default async function SatelliteInfoPage({
</div>

{/* Related projects */}
<div className="mt-8 flex w-full flex-col items-center">
{satelliteInfo.relatedProjects?.length != 0 ? (
{satelliteInfo.relatedProjects?.length != 0 ? (
<div className="mt-8 flex w-full flex-col items-center">
<h1 className="text-xl font-bold">Related Projects</h1>
) : null}

<div className="mx-10 mt-4 flex flex-wrap justify-center gap-4 md:justify-start">
{satelliteInfo.relatedProjects?.map(
(project: ProjectOrSatellite) => (
<RelatedProjectsAndSatellites
project={project}
key={project.id}
/>
),
)}
<div className="mx-10 mt-4 flex flex-wrap justify-center gap-4 md:justify-start">
{satelliteInfo.relatedProjects?.map(
(project: ProjectOrSatellite) => (
<RelatedProjectsAndSatellites
project={project}
key={project.id}
/>
),
)}
</div>
</div>
</div>
) : null}
</>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default function SatelliteDataHome() {
</div>
</div>

<div className="border-t border-gray-600 bg-black p-5 xl:border-b-2">
<div className="border-t border-gray-600 bg-black p-5">
<div>
<p className="text-xl font-medium">
{satelliteInfo
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/lib/data/fetchSatelliteInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d824a5f

Please sign in to comment.