Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧨⌚️ ↝ [SSG-58]: The "Create Sprint" became...something else #163

Merged
merged 17 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
2c4905d
🔦🕰️ ↝ [SSC-34 SSC-35 SSC-36]: JVH module added into structuresconfig
Gizmotronn Oct 27, 2024
e7d8eef
🐛🥨 ↝ [SSG-53 SSG-61]: Drag & Drop editor/structure grid
Gizmotronn Oct 29, 2024
4604f47
🌦️🚣🏻‍♂️ ↝ [SSM-54 SSM-55]: Adding page for research view
Gizmotronn Oct 30, 2024
8f37fb8
🪭🦽 ↝ [SSG-62]: I want to do a Harold Holt
Gizmotronn Nov 1, 2024
7965f94
🛵🏄🏻 ↝ [SSG-62]: I have no idea why this is happening
Gizmotronn Nov 1, 2024
811ae86
🎤🍋 ↝ [SSG-62]: npm>zod can get in the bin
Gizmotronn Nov 1, 2024
83d635a
🎥🥗 ↝ [SSG-61 SSG-54 SSC-34 SSM-40]: Adding some customisation options
Gizmotronn Nov 1, 2024
c0e1843
🪸🪲 ↝ [SSG-61 SSG-54 SSC-34 SSG-63]: New onboarding/chapter-1 layout &…
Gizmotronn Nov 3, 2024
4df2c42
🦔🏎️ ↝ [SSG-63 SSC-30 SSM-40 SSM-54 SSP-31 SSG-58]: New focus on uploa…
Gizmotronn Nov 3, 2024
1cb47ff
🍀🌚 ↝ [SSG-63 SSM-54]: Testing out some new layout ideas
Gizmotronn Nov 4, 2024
2a5e5c9
🫘🎈 ↝ [SSM-57 SSM-55 SSM-56 SSM-40 SSC-30 SSM-54]: Mission guide with …
Gizmotronn Nov 5, 2024
157a622
🐡🪁 ↝ [SSM-57 SSM-55 SSM-56 SSM-40 SSC-30 SSM-54]: Updating some minin…
Gizmotronn Nov 6, 2024
2cfcd0b
🎍🧂 ↝ [SSM-57 SSM-55 SSM-56 SSM-40 SSC-30 SSM-54]: Adding some more fl…
Gizmotronn Nov 7, 2024
0dab625
🪂🍇 ↝ [SSM-54 SSM-40 SSC-30 SSM-54]: Table entries for missions, I thi…
Gizmotronn Nov 8, 2024
f30ba3a
🚀💠 ↝ [SSM-46 SSG-63 SSM-41 SSM-55]: Improving & closing some mission …
Gizmotronn Nov 9, 2024
79c8218
⏱️🌔 ↝ [SSM-46 SSG-53 SSP-15]: Mission list now working on mobile!
Gizmotronn Nov 10, 2024
049d772
📘🌃 ↝ [SSM-46 SSG-53 SSG-63 SSG-58 SSM-40]: Identified final bugs & op…
Gizmotronn Nov 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions app/api/gameplay/inventory/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ const inventoryItems: InventoryItem[] = [
{
id: 3103, name: 'Telescope', description: 'Space-based observations & classifications', icon_url: '/assets/Items/Telescope.png', ItemCategory: 'Structure', locationType: 'Surface'
},
{
id: 3104, name: "Zoodex", description: "Populate your planet with some animals to gain an understanding of animal behaviour on your planet and aide local research back home", cost: 1, icon_url: "/assets/Items/Pokedex.png", ItemCategory: "Structure", parentItem: null, itemLevel: 1, locationType: "Surface"
{ // Previously referred to as #Zoodex-3104
id: 3104, name: "Biodome", description: "Populate your planet with some animals to gain an understanding of animal behaviour on your planet and aide local research back home", cost: 1, icon_url: "/assets/Items/Pokedex.png", ItemCategory: "Structure", parentItem: null, itemLevel: 1, locationType: "Surface"
},
{
id: 3105,
Expand Down
2 changes: 1 addition & 1 deletion app/api/gameplay/missions/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface Mission {
chapter?: number;
component?: React.ComponentType<any>;
};

const missions: Mission[] = [
// Chapter One Missions
{
Expand Down
4 changes: 2 additions & 2 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { UserAnomaliesProvider } from "@/context/UserAnomalies";
import { bgImage, backgroundImages } from "@/constants/backgrounds";
import { Analytics } from "@vercel/analytics/react"
import { MissionProvider } from "@/context/MissionContext";
import TutorialPopup from "../content/Dialogue/helpButton";
import AppLayout from "@/components/Layout/Layout";
import Header from "@/components/ui/Header";

Expand Down Expand Up @@ -103,9 +102,10 @@ export default function RootLayout({ children }: RootLayoutProps) {
<div className="sci-fi-signal sci-fi-signal-1"></div>
<div className="sci-fi-signal sci-fi-signal-2"></div>
</div>
<div className="relative min-h-screen w-full flex flex-col">
{children}
</div>
</AppLayout>
<TutorialPopup />
<Analytics />
</InventoryProvider>
</UserAnomaliesProvider>
Expand Down
57 changes: 49 additions & 8 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ import {
} from './scenes';
import GlobeView from "./scenes/globe/page";
import InitialiseChapterOneUser from "@/components/(scenes)/chapters/one/InitialiseUser";
import { EarthScene } from "./scenes/earth/scene";
import StructuresOnPlanet, { AtmosphereStructuresOnPlanet, OrbitalStructuresOnPlanet } from "@/components/Structures/Structures";
import EnhancedWeatherEvents from "@/components/enhanced-weather-events";
import AllAutomatonsOnActivePlanet from "@/components/Structures/Auto/AllAutomatons";
import { EarthViewLayout } from "@/components/(scenes)/planetScene/layout";
import Onboarding from "./scenes/onboarding/page";
import VerticalToolbar from "@/components/Layout/Toolbar";
import StructureMissionGuide from "@/components/Layout/Guide";

export default function Home() {
const session = useSession();
Expand All @@ -52,6 +60,45 @@ export default function Home() {
52: <IoView />,
55: <EuropaView />,
51: <AmaltheaView />,
// 30: <EarthScene
// topSection={
// <EnhancedWeatherEvents />
// }
// middleSection={
// <StructuresOnPlanet />
// }
// middleSectionTwo={
// <AllAutomatonsOnActivePlanet />
// }
// />,
30: <EarthViewLayout>
<div className="w-full">
<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>
<AtmosphereStructuresOnPlanet />
</center>
</div>
</div>
<div className="w-full py-2">
<center>
<StructuresOnPlanet />
<AllAutomatonsOnActivePlanet />
</center>
</div>
<div className="w-full py-2"><StructureMissionGuide />
</div>
</EarthViewLayout>
// 60: <SaturnView />,
// 62: <TitanView />,
// 61: <EnceladusView />,
Expand All @@ -69,13 +116,7 @@ export default function Home() {

if (activePlanet?.id === 69) {
return (
<EarthView />
);
};

if (activePlanet?.id === null) {
return (
<InitialiseChapterOneUser />
<EarthScene />
);
};

Expand All @@ -85,5 +126,5 @@ export default function Home() {
);
};

return planetViews[activePlanet?.id] || <EarthView />;
return planetViews[activePlanet?.id] || <Onboarding />;
};
145 changes: 56 additions & 89 deletions app/scenes/earth/page.tsx
Original file line number Diff line number Diff line change
@@ -1,116 +1,83 @@
"use client";

import React, { useCallback, useEffect, useState } from "react";
import React, { ReactNode, useCallback, useEffect, useState } from "react";
import { useSupabaseClient, useSession } from "@supabase/auth-helpers-react";
import { useActivePlanet } from "@/context/ActivePlanet";
import { EarthViewLayout } from "@/components/(scenes)/planetScene/layout";
import { InventoryStructureItem } from "@/types/Items";
import { PlanetarySystem } from "@/components/(scenes)/planetScene/orbitals/system";
import StructuresOnPlanet, { AtmosphereStructuresOnPlanet, OrbitalStructuresOnPlanet } from "@/components/Structures/Structures";
import StructuresOnPlanet, {
AtmosphereStructuresOnPlanet,
OrbitalStructuresOnPlanet,
} from "@/components/Structures/Structures";
import AllAutomatonsOnActivePlanet from "@/components/Structures/Auto/AllAutomatons";
import InitialiseChapterOneUser from "@/components/(scenes)/chapters/one/InitialiseUser";
import InventoryPage from "@/components/Inventory/Grid/Grid";
import EnhancedWeatherEventsComponent from "@/components/enhanced-weather-events";
import TopographicMap from "@/components/topographic-map";

const EarthView: React.FC = () => {
const supabase = useSupabaseClient();
const session = useSession();
const { activePlanet, updatePlanetLocation } = useActivePlanet();
const handleUpdateToEarth = () => {
updatePlanetLocation(69);
};

return (
if (activePlanet?.id !== 50) {
return (
<div className="min-h-screen w-full flex flex-col">
<div className="bg-black/90">
<p>Current planet is not "old" Earth.</p>
<button onClick={handleUpdateToEarth}>Switch to 'old' Earth</button>
</div>
</div>
);
};

return (
<div className="min-h-screen w-full flex flex-col">
<img
className="absolute inset-0 w-full h-full object-cover"
src="/assets/Backdrops/Earth.png"
/>
<div className="relative min-h-screen">
<img
className="absolute inset-0 w-full h-full object-cover"
src="/assets/Backdrops/Earth.png"
/>
<div className="relative min-h-screen">
<EarthStructures />
</div>
</div>
</div>
);
};

export default EarthView;

const EarthStructures: React.FC = () => {
const supabase = useSupabaseClient();
const session = useSession();

const { activePlanet } = useActivePlanet();

const [orbitalStructures, setOrbitalStructures] = useState<InventoryStructureItem[]>([]);
const [atmosphereStructures, setAtmosphereStructures] = useState<InventoryStructureItem[]>([]);
const [surfaceStructures, setSurfaceStructures] = useState<InventoryStructureItem[]>([]);

const handleStructuresFetch = (
orbital: InventoryStructureItem[],
atmosphere: InventoryStructureItem[],
surface: InventoryStructureItem[]
) => {
setOrbitalStructures(orbital);
setAtmosphereStructures(atmosphere);
setSurfaceStructures(surface);
};

const fetchStructures = useCallback(async () => {
if (!session?.user?.id || !activePlanet?.id) return;

try {
const { data: inventoryData, error } = await supabase
.from('inventory')
.select('*')
.eq('owner', session.user.id)
.eq('anomaly', activePlanet.id)
.not('item', 'lte', 100);

if (error) throw error;

const orbital = inventoryData.filter((item) => item.locationType === 'Orbital');
const atmosphere = inventoryData.filter((item) => item.locationType === 'Atmosphere');
const surface = inventoryData.filter((item) => item.locationType === 'Surface');

handleStructuresFetch(orbital, atmosphere, surface);
} catch (error) {
console.error('Error fetching structures:', error);
};
}, [session?.user?.id, activePlanet?.id, supabase]);

useEffect(() => {
fetchStructures();
}, [fetchStructures]);
return (
<EarthViewLayout>
<EnhancedWeatherEventsComponent />
<div className="w-full">
<div className="py-2">
<center>
<AtmosphereStructuresOnPlanet />
</center>
</div>
</div>
<div className="w-full">
<center>
<StructuresOnPlanet />
</center>
</div>
<div className="relative flex-1">
<AllAutomatonsOnActivePlanet />
</div>
</EarthViewLayout>
);
};

return (
<EarthViewLayout>
<div className="w-full">
<div className="flex flex-row space-y-4">
{orbitalStructures.map((structure) => (
<div
key={structure.id}
className="relative flex items-center space-x-4"
>
<img
src={structure.itemDetail?.icon_url}
alt={structure.itemDetail?.name}
className="w-16 h-16 object-cover"
/>
</div>
))}
</div>
{/* <div className="w-full">
{/* <InventoryPage />
<div className="py-3">
<div className="py-1">
<PlanetarySystem />
</div>
<center><OrbitalStructuresOnPlanet onStructuresFetch={handleStructuresFetch} /></center>
<center><OrbitalStructuresOnPlanet /></center>
</div>
</div>
<div className="w-full">
<div className="py-2">
<center><AtmosphereStructuresOnPlanet onStructuresFetch={handleStructuresFetch} /></center>
</div>
</div>
<div className="w-full">
<center><StructuresOnPlanet onStructuresFetch={handleStructuresFetch} /></center>
</div>
<div className="relative flex-1">
<AllAutomatonsOnActivePlanet />
</div>
</EarthViewLayout>
);
};
</div> */}
{/* <TopographicMap /> */}
81 changes: 81 additions & 0 deletions app/scenes/earth/scene.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
'use client';

import { ReactNode, CSSProperties } from "react";

export const EarthScene: React.FC<{
toolbar?: ReactNode;
topSection?: ReactNode;
middleSection?: ReactNode;
bottomSection?: ReactNode;
middleSectionTwo?: ReactNode;
}> = ({ toolbar, topSection, middleSection, bottomSection, middleSectionTwo }) => {
// Collect all sections to determine height distribution
const sections = [topSection, middleSection, middleSectionTwo, bottomSection].filter(Boolean);
const totalSections = sections.length;

// Define the flex properties for each section
const sectionStyles: CSSProperties[] = sections.map((_, index) => {
// Distribute height for each section
let flexValue = 0;

if (index === 0) {
flexValue = 22.5; // Top section
} else if (index === 1 || index === 2) {
flexValue = 15; // Middle sections, reduced height
} else if (index === 3) {
flexValue = 22.5; // Bottom section
}

return {
flex: flexValue,
};
});

return (
<div className="relative min-h-screen w-full flex flex-col">
<img
className="absolute inset-0 w-full h-full object-cover"
src="/assets/Backdrops/Earth.png"
alt="Earth Background"
/>

<div className="relative flex flex-col h-full z-10">
{topSection && (
<div className="relative flex" style={sectionStyles[0]}>
{topSection}
</div>
)}

{middleSection && (
<div className="mt-4 relative flex" style={sectionStyles[1]}>
<div className="w-2/3 h-full mx-auto p-4 overflow-hidden">
{middleSection}
</div>

{toolbar && (
<div className="absolute top-0 right-0 h-full flex flex-col justify-center p-7">
{toolbar}
</div>
)}
</div>
)}

{middleSectionTwo && (
<div className="mt-4 relative flex" style={sectionStyles[2]}>
<div className="w-2/3 h-full mx-auto p-4 overflow-hidden">
{middleSectionTwo}
</div>
</div>
)}

{bottomSection && (
<div className="relative flex" style={sectionStyles[3]}>
<div className="w-2/3 h-full mx-auto p-4 overflow-hidden">
{bottomSection}
</div>
</div>
)}
</div>
</div>
);
};
Loading
Loading