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

🥬🍓 ↝ [GP-16 GP-14 SGV2-141 SGV2-186]: Interactive globe? #153

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a3198f1
🎧💨 ↝ New page component if user hasn't finished onboarding/location. …
Gizmotronn Feb 24, 2024
ff6028e
💇🏻‍♂️🐭 ↝ Some deta tests
Gizmotronn Feb 13, 2024
77238a0
🧟‍♂️🐥 ↝ UI background test
Gizmotronn Feb 12, 2024
2a3c8da
🏡🧸 ↝ [ SGV2-10 SGV2-9 SGV2-2 ] Silod areas for home navigation now
Gizmotronn Feb 15, 2024
042d859
🧟‍♂️🍫 ↝ [ SGV2-10 SGV2-9 SGV2-2 FCDB-24 ] Automation & other accordio…
Gizmotronn Feb 15, 2024
fc374a6
😆🖐🏼 ↝ [ SGV2-10 SGV2-9 SGV2-2 FCDB-24 ] Working accordion layout
Gizmotronn Feb 16, 2024
8d818c5
🧝🏻🦁 ↝ [ SGV2-10 SGV2-9 SGV2-2 FCDB-24 ] Updating components inside on…
Gizmotronn Feb 18, 2024
16d7786
🚣🏻🌆 ↝ [ SGV2-10 SGV2-9 SGV2-2 FCDB-24 ] Characters are back
Gizmotronn Feb 19, 2024
155bf0a
📧🎮 ↝ [ SGV2-10 SGV2-9 SGV2-2 FCDB-24 ] Fixing mobile orientation
Gizmotronn Feb 20, 2024
e2add33
⌛️🏮 ↝ [ SGV2-10 SGV2-9 SGV2-2 FCDB-24 ] Trying (and failing, (again))…
Gizmotronn Feb 20, 2024
f9708d8
💗🛣️ ↝ [ SGV2-10 SGV2-9 SGV2-2 FCDB-24 ] Some changes to overlays for …
Gizmotronn Feb 21, 2024
0846849
💻🎪 ↝ [ SGV2-10 SGV2-9 SGV2-2 FCDB-24 ] Some reorganisation & pitch work
Gizmotronn Feb 20, 2024
25e3c97
👩🏻‍🦽🍬 ↝ Removing a file with some interesting words
Gizmotronn Mar 6, 2024
9abbc19
🤖🔭 ↝ Some alien components, rover, exploration, inspiration. Bayer nu…
Gizmotronn Mar 4, 2024
09a64ff
🏃🏻‍♀️🥖 ↝ Finding there's a lot of complications and issues with secto…
Gizmotronn Mar 5, 2024
29101b4
🍞⚓️ ↝ Some updates, planning/briefing [SGV2-10 SGV2-2 SGV2-1 SGV2-7]
Gizmotronn Mar 5, 2024
ecd0bf3
🌒🍔 ↝ Layout changes for bottom [SGV2-10 SGV2-2 SGV2-1 SGV2-7]
Gizmotronn Mar 6, 2024
5a07721
🍙🥓 ↝ Habby ideas [SGV2-10 SGV2-2 SGV2-1 SGV2-7]
Gizmotronn Mar 7, 2024
33a41bb
🍚🫒 ↝ Trying to debug pwa [SGV2-10 SGV2-2 SGV2-1 SGV2-7]
Gizmotronn Mar 8, 2024
dd8db3c
🤶🏻🎒 ↝ Taking minimap out (fornow) [SGV2-10 SGV2-2 SGV2-1 SGV2-7]
Gizmotronn Mar 9, 2024
6e13213
👜💦 ↝ [SGV2-10 SGV2-2 SGV2-1 SGV2-7]: Change OOO for bottom overlay
Gizmotronn Mar 10, 2024
4dc3895
🌩️🐹 ↝ [SGV2-10 SGV2-2 SGV2-1 SGV2-7]: Experimenting with bg
Gizmotronn Mar 11, 2024
25832f5
😦🧏🏽‍♂️ ↝ [SGV2-10 SGV2-2 SGV2-1 SGV2-7]: New grid layout for sectors …
Gizmotronn Mar 12, 2024
578ea53
🎨🌐 ↝ [SGV2-7 GP-16]: Globe data packets
Gizmotronn Mar 13, 2024
46185a3
🦔🕹️ ↝ [SGV2-7 GP-16]: Working globe
Gizmotronn Mar 14, 2024
6526361
️🚲🎅🏻 ↝ [SGV2-7 GP-16]: Test page
Gizmotronn Mar 15, 2024
55e929b
️👩‍👩‍👧‍👧🍒 ↝ [SGV2-7 GP-16]: Having a go at creating new landmasses
Gizmotronn Mar 16, 2024
93c2c9d
🦆🤶🏻 ↝ Merge pull request #102 from Signal-K/SGV2-10-Onboarding-envir…
Gizmotronn Apr 17, 2024
2afc314
Merge branch 'initialClassification' into GP-16-New-globe-component-i…
Gizmotronn Apr 17, 2024
f252145
🤹🏼‍♀️🌎 ↝ [SGV2-141 GP-16]: Some more merge fixes
Gizmotronn Jun 14, 2023
576e946
🦔🦙 ↝ [SGV2-141 GP-16]: Some more merge fixes
Gizmotronn Jun 14, 2023
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
.pnp.js
.env

citizen
/citizen
supabase
/supabase

# testing
/coverage
.env
Expand Down
72 changes: 71 additions & 1 deletion components/Content/Inventory/UserOwnedItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,80 @@ const OwnedItemsList: React.FC = () => {
})}
</div>
);
};
};

export default OwnedItemsList;

interface InventoryItem {
id: number;
name: string;
icon_url: string;
quantity: number;
}

export const ItemsVerticalList: React.FC = () => {
const session = useSession();
const [itemDetails, setItemDetails] = useState<InventoryItem[]>([]);
const supabase = useSupabaseClient();

useEffect(() => {
const fetchOwnedItems = async () => {
try {
if (!session) return;

const user = session.user.id;
// Fetch owned items from the database
const { data: ownedItemsData, error: ownedItemsError } = await supabase
.from('inventoryUSERS')
.select('*')
.eq('owner', user)
.gt('id', 20);

if (ownedItemsError) {
throw ownedItemsError;
}

if (ownedItemsData) {
const itemIds = ownedItemsData.map(item => item.item);
// Fetch details of owned items
const { data: itemDetailsData, error: itemDetailsError } = await supabase
.from('inventoryITEMS')
.select('*')
.in('id', itemIds);

if (itemDetailsError) {
throw itemDetailsError;
}

if (itemDetailsData) {
setItemDetails(itemDetailsData);
}
}
} catch (error) {
console.error('Error fetching owned items:', error.message);
}
};

fetchOwnedItems();
}, [session]);

return (
<div className="w-full">
{itemDetails.map(item => (
<div key={item.id} className="flex items-center justify-between mb-2">
<div className="flex items-center space-x-2">
<div className="w-10 h-10 rounded-full overflow-hidden">
<img src={item.icon_url} alt={item.name} className="w-full h-full object-cover" />
</div>
<p className="text-sm">{item.name}</p>
</div>
<p className="text-sm">x{item.quantity}</p>
</div>
))}
</div>
);
};

export const SectorStructureOwned: React.FC<{ sectorid: string }> = ({ sectorid }) => {
const supabase = useSupabaseClient();
const session = useSession();
Expand Down
70 changes: 70 additions & 0 deletions components/Content/Planets/Construction/GlobeClickable.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { useEffect, useRef } from "react";
import * as THREE from "three";
import { Sprite, SpriteMaterial, TextureLoader } from "three";
import { useFrame } from "@react-three/fiber";

interface Landmass {
lat: number;
lng: number;
imageURL: string;
onClickFunction: () => void;
}

interface ClickableImagesProps {
landmasses: Landmass[];
}

function ClickableImages({ landmasses }: ClickableImagesProps) {
const groupRef = useRef<THREE.Group | null>(null);

useEffect(() => {
if (groupRef.current) {
landmasses.forEach((landmass) => {
const { lat, lng, imageURL, onClickFunction } = landmass;

// Load texture
const textureLoader = new TextureLoader();
const texture = textureLoader.load(imageURL);

// Create a sprite with the texture
const spriteMaterial = new SpriteMaterial({ map: texture });
const sprite = new Sprite(spriteMaterial);

// Set the size of the sprite
const size = 8; // Adjust size as needed (e.g. 8 for Tailwind scale)
sprite.scale.set(size, size, 1);

// Convert lat/lng to 3D coordinates
const radius = 100; // Adjust radius as needed
const phi = (90 - lat) * (Math.PI / 180);
const theta = lng * (Math.PI / 180);
sprite.position.set(
radius * Math.sin(phi) * Math.cos(theta),
radius * Math.cos(phi),
radius * Math.sin(phi) * Math.sin(theta)
);

// Create a click handler for the sprite
const handleClick = (event: any) => {
event.stopPropagation();
onClickFunction();
};

// Add event listener to the sprite for the 'click' event
sprite.addEventListener('click', handleClick);

// Add the sprite to the group
groupRef.current.add(sprite);
});
}
}, [landmasses]);

// Use useFrame hook to continuously update the scene if needed
useFrame(() => {
// Add any animation logic here if required
});

return <group ref={groupRef} />;
}

export default ClickableImages;
8 changes: 4 additions & 4 deletions components/Content/Planets/GalleryList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ const PlanetGalleryWithSectors: React.FC = () => {
let query = supabase
.from('basePlanets')
.select('*')
.order('created_at', { ascending: false })
.limit(200);
.order('created_at', { ascending: true })
.limit(3); // Set this to be owned planets

const { data, error } = await query;

Expand Down Expand Up @@ -302,12 +302,12 @@ export const Garden: React.FC<GardenProps> = ({ onClose }) => {
<div className={`fixed inset-x-0 bottom-0 flex justify-center transition-transform duration-300 ${isOpen ? 'translate-y-0' : 'translate-y-full'}`}>
<div className="bg-cover bg-center w-full sm:max-w-screen-lg sm:w-full max-h-96vh overflow-y-auto shadow-lg relative rounded-t-3xl">
<div style={{ backgroundImage: `url('/garden.png')` }} className="bg-cover bg-center h-96vh flex items-center justify-center relative rounded-t-3xl">
<button
{/* <button
onClick={handleClose}
className="absolute top-4 right-4 px-4 py-2 bg-gray-200 text-gray-800 rounded"
>
Close
</button>
</button> */}
<PlanetGalleryWithSectors />
</div>
</div>
Expand Down
Loading
Loading