Skip to content

Commit

Permalink
🤿🎼 ↝ [SSG-125]: Making worlds (part 1) - Merge pull request #175 from…
Browse files Browse the repository at this point in the history
… Signal-K/SSG-125

🦽🤿 ↝ [SSG-125]: Making worlds (part 1)
  • Loading branch information
Gizmotronn authored Feb 16, 2025
2 parents afb02f8 + 4ad96cf commit cd733a1
Show file tree
Hide file tree
Showing 62 changed files with 4,348 additions and 879 deletions.
50 changes: 25 additions & 25 deletions app/api/gameplay/inventory/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const inventoryItems: InventoryItem[] = [

// Structures
{
id: 3102, name: 'Automaton station', description: 'View, control and upgrade all your automatons and rovers here', cost: 1, icon_url: '/assets/Items/AutoController.png', ItemCategory: 'Structure', parentItem: 30, itemLevel: 1, locationType: 'Surface'
id: 3102, name: 'Automaton station', description: 'Control and upgrade your automatons here', cost: 1, icon_url: '/assets/Items/AutoController.png', ItemCategory: 'Structure', parentItem: 30, itemLevel: 1, locationType: 'Surface'
},
{
id: 3103, name: 'Telescope', description: 'Space-based observations & classifications', icon_url: '/assets/Items/Telescope.png', ItemCategory: 'Structure', locationType: 'Surface'
Expand All @@ -83,33 +83,33 @@ const inventoryItems: InventoryItem[] = [
ItemCategory: "Structure",
locationType: 'Surface',
},
{
id: 3107,
name: "Launchpad",
description: "Launch rockets and satellites",
icon_url: "/assets/Items/Launchpad.jpg",
ItemCategory: "Structure",
locationType: 'Surface',
},
{
id: 3108,
name: "First rocket",
description: "Travel the solar-system",
icon_url: "/assets/Items/Rocket.png",
ItemCategory: "Structure",
locationType: 'Atmosphere',
},
// {
// id: 3107,
// name: "Launchpad",
// description: "Launch rockets and satellites",
// icon_url: "/assets/Items/Launchpad.jpg",
// ItemCategory: "Structure",
// locationType: 'Surface',
// },
// {
// id: 3108,
// name: "First rocket",
// description: "Travel the solar-system",
// icon_url: "/assets/Items/Rocket.png",
// ItemCategory: "Structure",
// locationType: 'Atmosphere',
// },


// Classification structures introduced in C2
{
id: 31010,
name: "Physics Lab",
description: "Catalogue results from different particle experiments across the universe",
icon_url: "/assets/Items/PhysicsLab.png",
ItemCategory: "Structure",
locationType: 'Surface',
},
// {
// id: 31010,
// name: "Physics Lab",
// description: "Catalogue results from different particle experiments across the universe",
// icon_url: "/assets/Items/PhysicsLab.png",
// ItemCategory: "Structure",
// locationType: 'Surface',
// },

// Community stations
{
Expand Down
2 changes: 1 addition & 1 deletion app/auth/register/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const Register = () => {
useEffect(() => {
if (session) {
router.push('/');
}
};
}, [session, router]);

return (
Expand Down
22 changes: 14 additions & 8 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,20 @@ interface RootLayoutProps {
children: ReactNode;
};

export default function RootLayout({ children }: RootLayoutProps) {
const [supabaseClient] = useState(() => createPagesBrowserClient());

function LayoutContent({ children }: { children: ReactNode }) {
const { activePlanet } = useActivePlanet();

if (activePlanet) {
useEffect(() => {
useEffect(() => {
if (activePlanet) {
console.log("Active Planet: ", activePlanet);
}, [activePlanet]);
}
}
}, [activePlanet]);

return <>{children}</>;
};

export default function RootLayout({ children }: RootLayoutProps) {
const [supabaseClient] = useState(() => createPagesBrowserClient());

return (
<html lang="en">
Expand Down Expand Up @@ -76,7 +80,8 @@ export default function RootLayout({ children }: RootLayoutProps) {
{/* <MissionProvider> */}
<UserAnomaliesProvider>
<InventoryProvider>
<div className="sci-fi-overlay">
<LayoutContent>
<div className="sci-fi-overlay">
<svg className="sci-fi-shape sci-fi-shape-1" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
<path d="M100,10 L190,50 L190,150 L100,190 L10,150 L10,50 Z" fill="none" stroke="#5FCBC3" strokeWidth="2" />
<path d="M100,30 L170,60 L170,140 L100,170 L30,140 L30,60 Z" fill="none" stroke="#85DDA2" strokeWidth="2" />
Expand All @@ -103,6 +108,7 @@ export default function RootLayout({ children }: RootLayoutProps) {
<div className="relative min-h-screen w-full flex flex-col">
{children}
</div>
</LayoutContent>
<Analytics />
</InventoryProvider>
</UserAnomaliesProvider>
Expand Down
97 changes: 35 additions & 62 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"use client"
"use client";

import { useSession, useSupabaseClient } from "@supabase/auth-helpers-react";
import { useEffect, useState } from "react";
Expand All @@ -20,70 +20,45 @@ import AllSatellitesOnActivePlanet from "@/components/Structures/Auto/AllSatelli

export default function Home() {
const session = useSession();

const supabase = useSupabaseClient();
const { activePlanet } = useActivePlanet();
const [hasRequiredItems, setHasRequiredItems] = useState<boolean | null>(null);

useEffect(() => {
console.log(session?.user.id);
});
if (!session) return;

const planetViews: Record<number, JSX.Element> = {
// 30: <EarthScene
// topSection={
// <EnhancedWeatherEvents />
// }
// middleSection={
// <StructuresOnPlanet />
// }
// middleSectionTwo={
// <AllAutomatonsOnActivePlanet />
// }
// />,
30: <EarthViewLayout>
<div className="w-full">
<Navbar />
<div className="flex flex-row space-y-4"></div>
<div className="py-3">
<div className="py-1">
{/* <EnhancedWeatherEvents /> */}
</div>
<center>
<OrbitalStructuresOnPlanet />
</center>
</div>
</div>
<div className="w-full">
<div className="py-2">
<center>
<AllSatellitesOnActivePlanet />
<AtmosphereStructuresOnPlanet />
</center>
</div>
</div>
<div className="w-full py-2">
<center>
<StructuresOnPlanet />
<AllAutomatonsOnActivePlanet />
</center>
</div>
{/* <div className="w-full py-2"><StructureMissionGuide /> */}
<div className="w-full py-2"><SimpleeMissionGuide />
</div>
</EarthViewLayout>
// 60: <SaturnView />,
// 62: <TitanView />,
// 61: <EnceladusView />,
// 70: <UranusView />,
// 71: <MirandaView />,
// 80: <NeptuneView />,
// 81: <TritonView />,
// 90: <PlutoView />,
// <MiningView />,
};
const checkInventory = async () => {
try {
const { data, error } = await supabase
.from("inventory")
.select("id, quantity")
.eq("owner", session.user.id)
.in("item", [3105, 3104, 3103])
.gt("quantity", 0);

if (error) throw error;

setHasRequiredItems(data.length > 0);
} catch (error: any) {
console.error("Error checking inventory:", error.message);
setHasRequiredItems(false);
}
};

checkInventory();
}, [session, supabase]);

if (!session) {
return <LoginPage />;
};
}

if (hasRequiredItems === null) {
return <div>Loading...</div>;
}

if (!hasRequiredItems) {
return <Onboarding />;
}

return (
<EarthViewLayout>
Expand Down Expand Up @@ -113,9 +88,7 @@ export default function Home() {
<AllAutomatonsOnActivePlanet />
</center>
</div>
{/* <div className="w-full py-2"><StructureMissionGuide /> */}
<div className="w-full py-2"><SimpleeMissionGuide />
</div>
<div className="w-full py-2"><SimpleeMissionGuide /></div>
</EarthViewLayout>
)
);
};
8 changes: 6 additions & 2 deletions app/planets/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useSession, useSupabaseClient } from "@supabase/auth-helpers-react";
import SimplePlanetGenerator from "@/components/Data/Generator/Astronomers/PlanetHunters/SimplePlanetGenerator";
import Navbar from "@/components/Layout/Navbar";
import { PostCardSingleWithGenerator } from "@/content/Posts/PostWithGen";
import ClassificationComments from "@/content/Classifications/ClassificationStats";

interface Classification {
id: number;
Expand All @@ -21,7 +22,7 @@ interface Classification {
tags?: string[];
images?: string[];
relatedClassifications?: Classification[];
}
};

type Anomaly = {
id: number;
Expand Down Expand Up @@ -129,7 +130,7 @@ export default function ClassificationDetail({ params }: { params: { id: string
classificationType={classification.classificationtype || "Unknown"}
/>
)}
{anomaly && (
{/* {anomaly && (
<div className="mt-6 p-4 bg-[#1E3A47] border border-gray-300 rounded-md">
<h2 className="text-xl font-bold">Related Planet</h2>
<p className="mt-2 text-sm">{anomaly.content || `Anomaly #${anomaly.id}`}</p>
Expand All @@ -149,6 +150,9 @@ export default function ClassificationDetail({ params }: { params: { id: string
/>
)}
</div>
)} */}
{classification && (
<ClassificationComments classification={classification} />
)}
{classification.relatedClassifications && classification.relatedClassifications.length > 0 && (
<div className="mt-6">
Expand Down
Loading

0 comments on commit cd733a1

Please # to comment.