Skip to content

Commit

Permalink
πŸ§‘πŸ»β€πŸŽ„πŸ§ ↝ Popup for [ GP-13 ]
Browse files Browse the repository at this point in the history
  • Loading branch information
Gizmotronn committed Mar 11, 2024
1 parent 9608327 commit 6d8cfb9
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 13 deletions.
4 changes: 2 additions & 2 deletions components/Content/CreatePostForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ export default function CreatePostForm ( { planetId2 } ) { // category_id
]);

setPostContent('');
}
})
};
});
};

useEffect(() => {
Expand Down
37 changes: 30 additions & 7 deletions components/Content/Planets/Base/IndividualBasePlanet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -21,6 +22,17 @@ export function IndividualBasePlanetDesktop({ id }: { id: string }) {

const [screenWidth, setScreenWidth] = useState<number>(0);
const [showSidebar, setShowSidebar] = useState<boolean>(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 = () => {
Expand Down Expand Up @@ -264,18 +276,16 @@ export function IndividualBasePlanetDesktop({ id }: { id: string }) {
width="50"
/> */}
</button>
<button className="justify-self-center self-start">
<button
className="justify-self-center self-start"
onClick={() => handleStructureClick("Structure 2")}
>
<img
alt="Structure 2"
className="w-24 h-24"
height="50"
src="/assets/Inventory/Structures/Telescope2.png"
style={{
aspectRatio: "50/50",
objectFit: "cover",
}}
width="50"
/>
<div className="text-center text-white text-opacity-90 text-[27.17px] font-medium font-['Inter']">View planet light curves</div>
</button>
<button className="justify-self-end self-start">
{/* <img
Expand Down Expand Up @@ -412,6 +422,19 @@ export function IndividualBasePlanetDesktop({ id }: { id: string }) {
</div>
</div>
</div> */}
{selectedStructure && (
<div className="fixed inset-0 flex items-center justify-center bg-gray-900 bg-opacity-50">
<div className="max-w-2xl w-full bg-white p-8 rounded-lg shadow-xl z-50">
<button
className="absolute top-4 right-4 text-gray-600"
onClick={handleClosePopup}
>
Close
</button>
<LightkurveBaseGraph planetId={selectedStructure} />
</div>
</div>
)}
</div>
<div className="grid-container mb-24">
{sectors.map((sector) => (
Expand Down
31 changes: 29 additions & 2 deletions components/Content/Planets/PlanetData/ContentPlaceholder.tsx
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down Expand Up @@ -83,4 +84,30 @@ export function ActivateButton(planetIdDeepnote) {
)}
</div>
);
}
}

export function LightkurveBaseGraph(planetId) {
const supabase = useSupabaseClient();

const [planetData, setPlanetData] = useState(null);

// const { content, avatar_url, type, deepnote, cover, temperatureEq, smaxis, mass } = planetData;

return (
<center>
<div className="max-w-2xl w-full bg-white p-8 rounded-lg shadow-xl z-50 mt-10">
{/* <p className="text-base font-semibold leading-7 text-indigo-600">Planet type: {type}</p>
<h1 className="mt-2 text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl">Planet name: {content}</h1> */}
<p className="mt-6 text-xl leading-8 text-gray-700">
Brief summaary: owner, sectors, etc
</p>

<div className="text-gray-700">
<div className="pt-10">
<LightcurveGenerator planetId={planetId} />
</div>
</div>
</div>
</center>
);
};
9 changes: 7 additions & 2 deletions components/Content/Planets/PlanetData/PopulatePlanetData.tsx
Original file line number Diff line number Diff line change
@@ -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('');

Expand All @@ -17,8 +21,9 @@ const LightcurveGenerator = () => {
setImageUrl(url);
} catch (error) {
console.error(error.message);
}
};
};


return (
<div>
Expand Down

0 comments on commit 6d8cfb9

Please sign in to comment.