From 6d8cfb96c28f080a17b36d308f60466b57ee9982 Mon Sep 17 00:00:00 2001 From: Liam Arbuckle Date: Tue, 13 Feb 2024 17:45:21 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=91=F0=9F=8F=BB=E2=80=8D=F0=9F=8E=84?= =?UTF-8?q?=F0=9F=90=A7=20=E2=86=9D=20Popup=20for=20[=20GP-13=20]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Content/CreatePostForm.tsx | 4 +- .../Planets/Base/IndividualBasePlanet.tsx | 37 +++++++++++++++---- .../Planets/PlanetData/ContentPlaceholder.tsx | 31 +++++++++++++++- .../Planets/PlanetData/PopulatePlanetData.tsx | 9 ++++- 4 files changed, 68 insertions(+), 13 deletions(-) diff --git a/components/Content/CreatePostForm.tsx b/components/Content/CreatePostForm.tsx index 2bd97fdc..824808bb 100644 --- a/components/Content/CreatePostForm.tsx +++ b/components/Content/CreatePostForm.tsx @@ -57,8 +57,8 @@ export default function CreatePostForm ( { planetId2 } ) { // category_id ]); setPostContent(''); - } - }) + }; + }); }; useEffect(() => { diff --git a/components/Content/Planets/Base/IndividualBasePlanet.tsx b/components/Content/Planets/Base/IndividualBasePlanet.tsx index edec0f2a..0344ef8c 100644 --- a/components/Content/Planets/Base/IndividualBasePlanet.tsx +++ b/components/Content/Planets/Base/IndividualBasePlanet.tsx @@ -3,6 +3,7 @@ import { useRouter } from "next/router"; import { useSupabaseClient, useSession } from "@supabase/auth-helpers-react"; import ContentPlaceholder, { ActivateButton } from "../PlanetData/ContentPlaceholder"; import Link from "next/link"; +import { LightkurveBaseGraph } from "../PlanetData/ContentPlaceholder"; export function IndividualBasePlanetDesktop({ id }: { id: string }) { const router = useRouter(); @@ -21,6 +22,17 @@ export function IndividualBasePlanetDesktop({ id }: { id: string }) { const [screenWidth, setScreenWidth] = useState(0); const [showSidebar, setShowSidebar] = useState(true); + + // For handling selection of specific structures and then displaying content + const [selectedStructure, setSelectedStructure] = useState(null); + + const handleStructureClick = (structureName) => { + setSelectedStructure(structureName); + }; + + const handleClosePopup = () => { + setSelectedStructure(null); + }; useEffect(() => { const handleResize = () => { @@ -264,18 +276,16 @@ export function IndividualBasePlanetDesktop({ id }: { id: string }) { width="50" /> */} - + + + + )}
{sectors.map((sector) => ( diff --git a/components/Content/Planets/PlanetData/ContentPlaceholder.tsx b/components/Content/Planets/PlanetData/ContentPlaceholder.tsx index f11b03b2..49ee8b8b 100644 --- a/components/Content/Planets/PlanetData/ContentPlaceholder.tsx +++ b/components/Content/Planets/PlanetData/ContentPlaceholder.tsx @@ -1,6 +1,7 @@ import { CloudArrowUpIcon, LockClosedIcon, ServerIcon } from '@heroicons/react/20/solid'; -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import LightcurveGenerator from './PopulatePlanetData'; +import { useSupabaseClient } from '@supabase/auth-helpers-react'; export default function ContentPlaceholder(planetIdDeepnote) { return ( @@ -83,4 +84,30 @@ export function ActivateButton(planetIdDeepnote) { )}
); - } \ No newline at end of file +} + +export function LightkurveBaseGraph(planetId) { + const supabase = useSupabaseClient(); + + const [planetData, setPlanetData] = useState(null); + +// const { content, avatar_url, type, deepnote, cover, temperatureEq, smaxis, mass } = planetData; + + return ( +
+
+ {/*

Planet type: {type}

+

Planet name: {content}

*/} +

+ Brief summaary: owner, sectors, etc +

+ +
+
+ +
+
+
+
+ ); +}; \ No newline at end of file diff --git a/components/Content/Planets/PlanetData/PopulatePlanetData.tsx b/components/Content/Planets/PlanetData/PopulatePlanetData.tsx index 19df4a87..2faf6bff 100644 --- a/components/Content/Planets/PlanetData/PopulatePlanetData.tsx +++ b/components/Content/Planets/PlanetData/PopulatePlanetData.tsx @@ -1,7 +1,11 @@ import React, { useState } from "react"; import axios from "axios"; +import { useSupabaseClient } from "@supabase/auth-helpers-react"; -const LightcurveGenerator = () => { +const LightcurveGenerator = ({ planetId }: { planetId: string }) => { + const supabase = useSupabaseClient(); + + const [planetData, setPlanetData] = useState(null); const [ticId, setTicId] = useState(''); const [imageURL, setImageUrl] = useState(''); @@ -17,8 +21,9 @@ const LightcurveGenerator = () => { setImageUrl(url); } catch (error) { console.error(error.message); - } + }; }; + return (