Skip to content

Commit

Permalink
🏺💸 ↝ Crossing the mountains: uniform one-panel layout initialisation …
Browse files Browse the repository at this point in the history
…for planet pages
  • Loading branch information
Gizmotronn committed Jan 5, 2024
1 parent 3e24201 commit aecf2f5
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 3 deletions.
Binary file modified .DS_Store
Binary file not shown.
69 changes: 69 additions & 0 deletions components/Content/Planets/Base/IndividualBasePlanet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,75 @@ export default function IndividualBasePlanet({ id }: { id: string }) {
};

export function IndividualBasePlanetDesktop({ id }: { id: string }) {
const router = useRouter();
const [screenWidth, setScreenWidth] = useState<number>(0);

const supabase = useSupabaseClient();
const session = useSession();

const [planetData, setPlanetData] = useState(null);
// const [planetPosts, setPlanetPosts] = useState([]);
const { id: planetId } = router.query;

const [sectors, setPlanetSectors] = useState([]);

const getPlanetData = async () => {
try {
const { data, error } = await supabase
.from("basePlanets")
.select("*")
.eq("id", planetId)
.single();

if (data) {
setPlanetData(data);
}

if (error) {
throw error;
}
} catch (error: any) {
console.error(error.message);
}
};

if (!planetData) {
return <div>Loading...</div>;
}

const { content, avatar_url, type, deepnote, cover } = planetData;

return (
<div className="h-screen relative">
{/* Background Styles */}
<style jsx global>
{`
body {
background: url('/garden.png') center/cover;
);
}
@media only screen and (max-width: 1000px) {
body {
background: url('/void.png') center/cover;
}
}
@media only screen and (max-width: 767px) {
.planet-heading {
color: white;
font-size: 24px;
text-align: center;
margin-bottom: 10px;
}
`}
</style>
<div className="bg-cover bg-center h-screen flex items-center justify-center relative">
<div className="underline"></div>
</div>
</div>
);
}

export function IndividualBasePlanetDesktopTwoPanel({ id }: { id: string }) {
const router = useRouter();

const supabase = useSupabaseClient();
Expand Down
2 changes: 1 addition & 1 deletion pages/garden.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Navbar from "../components/Section/Navbar";
export default function GardenPage() {
return (
<LayoutNoNav>
<Navbar />
{/* <Navbar /> */}
<Garden />
</LayoutNoNav>
)
Expand Down
25 changes: 23 additions & 2 deletions pages/planets/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,35 @@ export default function PlanetIdPage () {
</div>
</div>
);
}
};

// Two panel layout for desktop devices, with orbitals
if (!isMobile && !id && router) {
return (
<>
<Navbar />
<div className="flex h-screen">
<div className="w-3/6 overflow-y-auto mr-30 z-40">
{/* <br /><ActivateButton /> */}
<IndividualBasePlanetDesktop id={id as string} />
</div>
<div className="w-3/6 bg-gray-50 overflow-y-auto">
<div className="py-3">
<BasePlanetData planetId={{ id: id as string }} />
<PostFormCardAnomalyTag planetId={id} onPost={null} />
<ClassificationFeedForIndividualPlanet planetId={{ id: id as string }} />
</div>
</div>
</div>
</>
);
};

return (
<>
<Navbar />
<div className="flex h-screen">
<div className="w-3/6 overflow-y-auto mr-30 z-40">
{/* <br /><ActivateButton /> */}
<IndividualBasePlanetDesktop id={id as string} />
</div>
<div className="w-3/6 bg-gray-50 overflow-y-auto">
Expand Down

0 comments on commit aecf2f5

Please sign in to comment.