Skip to content

Commit 9496673

Browse files
committed
🔐⛺️ ↝ Improve responsiveness of new popup [ GP-8 SGV2-3 ]
1 parent cd5fc3e commit 9496673

File tree

5 files changed

+182
-147
lines changed

5 files changed

+182
-147
lines changed

components/Content/Planets/Base/BasePlanetSector.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ export default function BasePlanetSector({ sectorid }: { sectorid: string }) {
157157
const fetchData = async () => {
158158
if (sectorId) {
159159
await getSectorData();
160-
await getPlanetData();
161160
};
162161
};
163162

@@ -204,7 +203,7 @@ export default function BasePlanetSector({ sectorid }: { sectorid: string }) {
204203
>
205204
<div className="h-[80vh] flex flex-col items-center justify-center relative">
206205
<h1 className="text-center text-slate-300 text-opacity-100 font-['Inter'] tracking-[3.48px] mt-[-50px] mb-4 text-4xl font-extrabold leading-none tracking-tight text-gray-900 md:text-5xl lg:text-6xl dark:text-white text-gray-400">
207-
Planet {planetData?.content}, Sector {id}
206+
Planet {sectorData?.anomaly}, Sector {id}
208207
</h1>
209208
<div className="w-full flex items-center justify-center">
210209
<img

components/Content/Planets/PlanetData/topographic-map.tsx

+17-6
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,29 @@ export function TopographicMap() {
88
body {
99
background: url('https://cdn.cloud.scenario.com/assets/W-75HHaTTKCFP_P51OMQVA?p=100&Policy=eyJTdGF0ZW1lbnQiOlt7IlJlc291cmNlIjoiaHR0cHM6Ly9jZG4uY2xvdWQuc2NlbmFyaW8uY29tL2Fzc2V0cy9XLTc1SEhhVFRLQ0ZQX1A1MU9NUVZBP3A9MTAwKiIsIkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTcxMDQ2MDc5OX19fV19&Key-Pair-Id=K36FIAB9LE2OLR&Signature=uKevl4LFfDomkvnHRbSQEjUjm5GC4eeTxD4xq-gGmt55GtBDaWe2HmcOcPDhh-2j9HqRKjBQXSjEJJMikk5wnxTMiYobp0l9K-M9WSnj-t6RPQVUpLzfy7foMSMwoMhGbsZ-pDDbyX9IMu-Q0yJKSEWhGsKXCmxv26UyV4qIMevDZvSbr3b8cFg6z90oliOi3DwROTswg9BHbk-iMTGm3vNgck4UIA5jerWXvojzH7y~zSHCtD2A4bkLv-eDOGyB3I~8LrfIDnE6bDgxbEgl2f1QRQl0N2HpDD6liXhgAZHmHGYjGFZv1ill4bHFKr5Ti7qQELGR1hax3sm9-he9tQ__') center/cover;
1010
}
11-
@media only screen and (max-width: 1000px) {
12-
body {
13-
background: url('/void.png') center/cover;
11+
12+
@media only screen and (max-width: 767px) {
13+
.planet-heading {
14+
color: white;
15+
font-size: 24px;
16+
text-align: center;
17+
margin-bottom: 10px;
1418
}
1519
}
20+
1621
@media only screen and (max-width: 767px) {
1722
.planet-heading {
1823
color: white;
1924
font-size: 24px;
2025
text-align: center;
2126
margin-bottom: 10px;
2227
}
28+
29+
/* Adjusted image size for mobile */
30+
.topographic-image {
31+
max-width: 90%;
32+
height: auto;
33+
}
2334
}
2435
`}
2536
</style>
@@ -91,7 +102,7 @@ export function TopographicMap() {
91102
<button className="justify-self-center self-center">
92103
<img
93104
alt="Structure 5"
94-
className="w-96 h-96"
105+
className="w-96 h-96 topographic-image"
95106
height="50"
96107
src="/Galaxy/Mars.png"
97108
style={{
@@ -199,7 +210,7 @@ export function TopographicMap() {
199210
</div> */}
200211
</div>
201212
</div>
202-
<div className="absolute top-0 left-0 right-0 mx-auto mt-8 text-center">
213+
{/* <div className="absolute top-0 left-0 right-0 mx-auto mt-8 text-center">
203214
<h1 className="text-4xl font-bold">MYCELIUM</h1>
204215
</div>
205216
<div className="absolute bottom-0 left-0 right-0 mx-auto mb-8 text-center space-x-4">
@@ -208,7 +219,7 @@ export function TopographicMap() {
208219
<span className="text-sm">DAY LENGTH 12 Earth hours</span>
209220
<span className="text-sm">AVG TEMPERATURE 10°C to 28°C</span>
210221
<span className="text-sm">CLIMATE Psilocybin</span>
211-
</div>
222+
</div> */}
212223
</div>
213224
)
214225
}

components/Core/BottomBar.tsx

+40-29
Original file line numberDiff line numberDiff line change
@@ -215,34 +215,45 @@ export const CreateBar = ({ onTabClick }) => {
215215
);
216216
};
217217

218-
export const CreateMenuBar = () => {
218+
export const CreateMenuBar = ({ onUpdatesClick }) => {
219219
return (
220-
<ul className="fixed bottom-10 left-1/2 transform -translate-x-1/2 flex justify-center space-x-4 bg-gray-200 rounded-full p-4 shadow-lg">
221-
<li className="flex items-center justify-center">
222-
<a className="flex items-center justify-center p-3">
223-
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
224-
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" />
225-
</svg>
226-
Inbox
227-
<span className="bg-gray-500 text-white text-xs px-1 ml-1 rounded">99+</span>
228-
</a>
229-
</li>
230-
<li className="flex items-center justify-center">
231-
<a className="flex items-center justify-center p-3">
232-
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
233-
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
234-
</svg>
235-
Updates
236-
<span className="bg-yellow-500 text-white text-xs px-1 ml-1 rounded">NEW</span>
237-
</a>
238-
</li>
239-
<li className="flex items-center justify-center">
240-
<a className="flex items-center justify-center p-3">
241-
Stats
242-
<span className="bg-blue-500 text-white text-xs px-1 ml-1 rounded"></span>
243-
</a>
244-
</li>
245-
</ul>
246-
220+
<ul className="fixed bottom-5 left-1/2 transform -translate-x-1/2 flex justify-center space-x-4 bg-gray-200 rounded-full p-2 shadow-lg">
221+
<li className="flex flex-col items-center justify-center">
222+
<a onClick={onUpdatesClick} className="flex flex-col items-center justify-center p-1 cursor-pointer">
223+
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
224+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" />
225+
</svg>
226+
<span className="bg-gray-500 text-white text-xs px-1 rounded">99+</span>
227+
<span>Inbox</span>
228+
</a>
229+
</li>
230+
<li className="flex flex-col items-center justify-center">
231+
<a className="flex flex-col items-center justify-center p-1">
232+
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
233+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
234+
</svg>
235+
<span className="bg-yellow-500 text-white text-xs px-1 rounded">NEW</span>
236+
<span>Feed</span>
237+
</a>
238+
</li>
239+
<li className="flex flex-col items-center justify-center">
240+
<a onClick={onUpdatesClick} className="flex flex-col items-center justify-center p-1 cursor-pointer">
241+
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
242+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" />
243+
</svg>
244+
<span className="bg-gray-500 text-white text-xs px-1 rounded">99+</span>
245+
<span>Inbox</span>
246+
</a>
247+
</li>
248+
<li className="flex flex-col items-center justify-center">
249+
<a onClick={onUpdatesClick} className="flex flex-col items-center justify-center p-1 cursor-pointer">
250+
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
251+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" />
252+
</svg>
253+
<span className="bg-gray-500 text-white text-xs px-1 rounded">99+</span>
254+
<span>Inbox</span>
255+
</a>
256+
</li>
257+
</ul>
247258
);
248-
};
259+
};

pages/planets/[id].tsx

+70-53
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,23 @@ import { CreateBar, CreateMenuBar } from "../../components/Core/BottomBar";
1313
import RoverImageGallery from "../../components/Content/Planets/PlanetData/RandomRoverImage";
1414
import StructureComponent from "../../components/Content/Planets/Activities/StructureCreate";
1515
import { TopographicMap } from "../../components/Content/Planets/PlanetData/topographic-map";
16+
import { useSupabaseClient } from "@supabase/auth-helpers-react";
1617

1718
export default function PlanetIdPage () {
1819
const router = useRouter();
1920
const { id } = router.query;
2021
const [activeView, setActiveView] = useState('home');
2122

22-
const handleTabClick = (view) => {
23-
setActiveView(view);
23+
const supabase = useSupabaseClient();
24+
25+
const [showUpdates, setShowUpdates] = useState(false);
26+
27+
const handleUpdatesClick = () => {
28+
setShowUpdates(true);
29+
};
30+
31+
const handleCloseUpdates = () => {
32+
setShowUpdates(false);
2433
};
2534

2635
const [isMobile, setIsMobile] = useState(false);
@@ -42,58 +51,34 @@ export default function PlanetIdPage () {
4251
return null;
4352
};
4453

45-
if (isMobile) {
46-
return (
47-
<LayoutNoNav>
48-
<IndividualBasePlanet id={id as string} />
49-
</LayoutNoNav>
50-
);
51-
};
54+
// Planet sector data:
55+
const [sectorData, setSectorData] = useState([]);
5256

53-
// For testing/archiving of old layout
54-
if (isMobile && !id && !router) {
55-
return (
56-
<div className="flex h-screen">
57-
<div className="w-1/6 bg-gray-50">
58-
<DesktopSidebar />
59-
</div>
60-
<div className="w-3/6 overflow-y-auto mr-30 z-40">
61-
{/* <br /><ActivateButton /> */}
62-
<IndividualBasePlanetDesktop id={id as string} />
63-
</div>
64-
<div className="w-2/6 bg-gray-50 overflow-y-auto z-">
65-
<BasePlanetData planetId={{ id: id as string }} />
66-
{/* <EditableBasePlanetData planetId={{ id: id as string }} /> */}
67-
<PostFormCardAnomalyTag planetId={id} onPost={null} />
68-
<ClassificationFeedForIndividualPlanet planetId={{ id: id as string }} />
69-
</div>
70-
</div>
71-
);
72-
};
57+
useEffect(() => {
58+
const fetchSectorsByPlanetId = async () => {
59+
try {
60+
const { data, error } = await supabase
61+
.from("basePlanetSectors")
62+
.select("*")
63+
.eq("anomaly", 2); // Assuming "anomaly" is the field representing the planet ID
7364

74-
// Two panel layout for desktop devices, with orbitals
75-
if (!isMobile && !id && router) {
76-
return (
77-
<>
78-
<Navbar />
79-
<div className="flex h-screen">
80-
<div className="w-3/6 overflow-y-auto mr-30 z-40">
81-
{/* <br /><ActivateButton /> */}
82-
<IndividualBasePlanetDesktopTwoPanel id={id as string} />
83-
{/* <TopographicMap /> */}
84-
</div>
85-
<div className="w-3/6 bg-gray-50 overflow-y-auto">
86-
<div className="py-3">
87-
<BasePlanetData planetId={{ id: id as string }} />
88-
<PostFormCardAnomalyTag planetId={id} onPost={null} />
89-
<ClassificationFeedForIndividualPlanet planetId={{ id: id as string }} />
90-
</div>
91-
</div>
92-
</div>
93-
</>
94-
);
65+
if (data) {
66+
setSectorData(data);
67+
}
68+
69+
if (error) {
70+
throw error;
71+
}
72+
} catch (error) {
73+
console.error("Error fetching sectors:", error.message);
74+
}
9575
};
9676

77+
if (supabase) {
78+
fetchSectorsByPlanetId();
79+
}
80+
}, [supabase]);
81+
9782
return (
9883
<>
9984
<Navbar />
@@ -133,9 +118,41 @@ export default function PlanetIdPage () {
133118
</div>
134119
</div>
135120
)}
136-
</div> */}
137-
{/* <CreateBar onTabClick={handleTabClick} /> */}
138-
<CreateMenuBar />
121+
</div> */}
122+
<CreateMenuBar onUpdatesClick={handleUpdatesClick} />
123+
<h1>Sectors on Planet</h1>
124+
<div className="grid grid-cols-4 gap-4">
125+
{sectorData.map((sector) => (
126+
<div key={sector.id}>
127+
{/* Display sector details here */}
128+
<p>Sector ID: {sector.id}</p>
129+
<p>Owner: {sector.owner}</p>
130+
{/* Add more details as needed */}
131+
</div>
132+
))}
133+
</div>
134+
{showUpdates && (
135+
<div className="fixed top-0 left-0 w-full h-full bg-black bg-opacity-50 flex justify-center items-center">
136+
<div className="bg-white rounded-lg md:w-4/6 lg:w-3/6 xl:w-2/6 p-4">
137+
<button onClick={handleCloseUpdates} className="absolute top-0 right-0 m-2 text-gray-600 hover:text-gray-800">
138+
<svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
139+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M6 18L18 6M6 6l12 12" />
140+
</svg>
141+
</button>
142+
<PostFormCardAnomalyTag planetId={id} onPost={null} />
143+
<ClassificationFeedForIndividualPlanet
144+
planetId={{ id: id as string }}
145+
backgroundColorSet="bg-blue-200"
146+
/>
147+
<center><button onClick={handleCloseUpdates} className="flex items-center justify-center p-3">
148+
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
149+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
150+
</svg>
151+
<span className="bg-yellow-500 text-white text-xs px-1 ml-1 rounded">Back</span>
152+
</button></center>
153+
</div>
154+
</div>
155+
)}
139156
</>
140157
);
141158
};

0 commit comments

Comments
 (0)