Skip to content

Commit

Permalink
️🪞🥞 ↝ [SGV2-17]: that remain untold...
Browse files Browse the repository at this point in the history
  • Loading branch information
Gizmotronn committed Apr 22, 2024
1 parent 60e0267 commit e214d53
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
6 changes: 5 additions & 1 deletion components/Content/[id]/BasePlanetAllSectors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@ import { useRouter } from "next/router";
import { useSupabaseClient, useSession } from "@supabase/auth-helpers-react";
import Card from "../../_Core/ui/Content/Card";

interface Sector {
// Define the properties of a sector
};

export default function BasePlanetSectors({ planetId }: { planetId: string }) {
const router = useRouter();
const { id: planetid } = router?.query;

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

const [sectorsData, setSectorsData] = useState(null);
const [sectorsData, setSectorsData] = useState<Sector[] | null>(null);

const getPlanetSectors = async () => {
if (!planetId) {
Expand Down
8 changes: 6 additions & 2 deletions components/Content/[id]/BasePlanetSector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import StructureComponent, { PlacedStructures } from "../Populate/StructureCreat
import { SectorStructureOwned } from "../Inventory/UserOwnedItems";
// import { CreateMenuBar, SectorCircularMenu } from "../../../Core/BottomBar";

interface PlanetData {
content?: string; // Define the properties of planetData
};

const AddResourceToInventory = ({ resource, sectorId }) => {
const supabase = useSupabaseClient();
const session = useSession();
Expand Down Expand Up @@ -74,8 +78,8 @@ export default function BasePlanetSector({ sectorid }: { sectorid: string }) {

const supabase = useSupabaseClient();

const [planetData, setPlanetData] = useState(null);
const [sectorData, setSectorData] = useState(null);
const [planetData, setPlanetData] = useState<PlanetData | null>(null);
const [sectorData, setSectorData] = useState<{ anomaly?: string, id: string, created_at: string, owner: string, deposit: string, coverUrl: string, exploration_start_data: string, explored: boolean } | null>(null);
const [depositItem, setDepositItem] = useState(null);

const fetchDepositItem = async (depositId) => {
Expand Down
9 changes: 7 additions & 2 deletions components/_Skeleton/PlanetDataBlocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ interface PlanetData {
mass: number;
};

interface Sector {
id: string;
// Add other properties according to the actual structure of your 'basePlanetSectors' table
};

export const PlanetStatBlock = () => {
const supabase = useSupabaseClient();

Expand Down Expand Up @@ -88,7 +93,7 @@ export const SectorsInsidePlanetBlock = () => {

const planetId = "2";
const userId = session?.user?.id;
const [sectors, setSectors] = useState([]);
const [sectors, setSectors] = useState<Sector[]>([]); // Define the type as Sector[]

useEffect(() => {
fetchSectorsForPlanet();
Expand Down Expand Up @@ -117,7 +122,7 @@ export const SectorsInsidePlanetBlock = () => {
return (
<><div className="grid-container mb-24">
{sectors.map((sector) => (
<Link legacyBehavior key={sector.id} href={`/planets/sector/${sector.id}`}>
<Link key={sector.id} href={`/planets/sector/${sector.id}`}>
<a className="sector-link">
<div className="sector-square">
{/* {sector.coverUrl && (
Expand Down

0 comments on commit e214d53

Please sign in to comment.