From 1b5564fc3abd22373767c4099ccd579472365edc Mon Sep 17 00:00:00 2001 From: Liam Arbuckle Date: Mon, 1 Apr 2024 16:42:15 +0800 Subject: [PATCH] =?UTF-8?q?=EF=B8=8F=F0=9F=AB=99=F0=9F=95=8D=20=E2=86=9D?= =?UTF-8?q?=20[SGV2-16]:=20I=20think=20I've=20done=20all=20the=20basePlane?= =?UTF-8?q?ts=20blocks/components?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/_Core/Section/BentoBox.tsx | 13 +++- components/_Skeleton/InventoryBlocks.tsx | 6 +- components/_Skeleton/PlanetDataBlocks.tsx | 73 ++++++++++++++++++++++- 3 files changed, 87 insertions(+), 5 deletions(-) diff --git a/components/_Core/Section/BentoBox.tsx b/components/_Core/Section/BentoBox.tsx index 699b501a..994759cc 100644 --- a/components/_Core/Section/BentoBox.tsx +++ b/components/_Core/Section/BentoBox.tsx @@ -4,7 +4,7 @@ import { RocketIcon } from "lucide-react"; import { BentoGrid, BentoGridTest } from "../ui/bento-grid"; import { InventoryOneList, InventoryTwoList, OwnedStructuresFullList } from "../../_Skeleton/InventoryBlocks"; import { ClassificationForPlanetFormBlock } from "../../_Skeleton/ClassificationBlocks"; -import { ContentPlaceholderBlockTest, PlanetStatBlock } from "../../_Skeleton/PlanetDataBlocks"; +import { ContentPlaceholderBlockTest, PlanetStatBlock, SectorsInsidePlanetBlock } from "../../_Skeleton/PlanetDataBlocks"; export default function BlockGrid() { return ( @@ -124,6 +124,17 @@ const items = [ header: , className: "md:col-span-2 row-span-1" }, + { + title: "All sectors that you own", + description: ( + + No discriminator for a specific anomaly/planet + + ), + icon: RocketIcon, + header: , + className: "md:col-span-2 row-span-1" + }, { title: "Data/stat display for an anomaly ", description: ( diff --git a/components/_Skeleton/InventoryBlocks.tsx b/components/_Skeleton/InventoryBlocks.tsx index 67903aa3..e4f5c864 100644 --- a/components/_Skeleton/InventoryBlocks.tsx +++ b/components/_Skeleton/InventoryBlocks.tsx @@ -67,9 +67,9 @@ const SectorStructureOwnedAllSectorsOneUser: React.FC<{}> = () => { return (
  • {item.name}

    -
    - {item.name} -
    + {/*
    + {item.name} +
    */}

    Quantity: {ownedItem?.quantity}

    On sector (id): {ownedItem?.sector}

  • diff --git a/components/_Skeleton/PlanetDataBlocks.tsx b/components/_Skeleton/PlanetDataBlocks.tsx index 95f71f96..3a2e252b 100644 --- a/components/_Skeleton/PlanetDataBlocks.tsx +++ b/components/_Skeleton/PlanetDataBlocks.tsx @@ -1,6 +1,7 @@ -import { useSupabaseClient } from "@supabase/auth-helpers-react"; +import { useSession, useSupabaseClient } from "@supabase/auth-helpers-react"; import ContentPlaceholder from "../Content/Planets/PlanetData/ContentPlaceholder" import { useEffect, useState } from "react"; +import Link from "next/link"; export const ContentPlaceholderBlockTest = () => { return ( @@ -79,4 +80,74 @@ export const PlanetStatBlock = () => { ); +}; + +export const SectorsInsidePlanetBlock = () => { + const supabase = useSupabaseClient(); + const session = useSession(); + + const planetId = "2"; + const userId = session?.user?.id; + const [sectors, setSectors] = useState([]); + + useEffect(() => { + fetchSectorsForPlanet(); + }, [planetId, session]) + + async function fetchSectorsForPlanet() { + try { + const { data, error } = await supabase + .from("basePlanetSectors") + .select('*') + // .eq('anomaly', planetId) // This will show all your sectors by default + .eq('owner', userId); + + if (error) { + console.assert('Error fetching sectors data: ', error.message); + return; + }; + + setSectors(data); + + } catch (error) { + console.error(error); + }; + }; + + return ( + <>
    + {sectors.map((sector) => ( + + +
    + {/* {sector.coverUrl && ( + Sector Cover + )} */} +
    +
    + + ))} +
    + + + ); }; \ No newline at end of file