diff --git a/components/Content/Inventory/UserOwnedItems.tsx b/components/Content/Inventory/UserOwnedItems.tsx
index 1c8d8447..4f7d958b 100644
--- a/components/Content/Inventory/UserOwnedItems.tsx
+++ b/components/Content/Inventory/UserOwnedItems.tsx
@@ -97,22 +97,26 @@ export const ItemsVerticalList: React.FC = () => {
const supabase = useSupabaseClient();
const [ownedItems, setOwnedItems] = useState([]);
const [itemDetails, setItemDetails] = useState([]);
+ const [isLoading, setIsLoading] = useState(true); // Loading state
useEffect(() => {
- const fetchOwnedItemsAndDetails = async () => {
- if (!session) return;
+ if (!session || !supabase) {
+ return;
+ }
+ const fetchOwnedItemsAndDetails = async () => {
try {
+ setIsLoading(true);
const userId = session.user.id;
// Fetch owned items from the database
const { data: ownedItemsData, error: ownedItemsError } = await supabase
- .from('inventoryUSERS')
- .select('*')
- .eq('owner', userId)
- .gt('id', 20)
+ .from("inventoryUSERS")
+ .select("*")
+ .eq("owner", userId)
+ .gt("id", 20)
.limit(6)
- .order('id', { ascending: false});
+ .order("id", { ascending: false });
if (ownedItemsError) {
throw ownedItemsError;
@@ -126,20 +130,20 @@ export const ItemsVerticalList: React.FC = () => {
// Fetch details of owned items based on item IDs
const { data: itemDetailsData, error: itemDetailsError } = await supabase
- .from('inventoryITEMS')
- .select('*')
- .in('id', itemIds);
+ .from("inventoryITEMS")
+ .select("*")
+ .in("id", itemIds);
if (itemDetailsError) {
throw itemDetailsError;
}
- if (itemDetailsData) {
- setItemDetails(itemDetailsData);
- }
+ setItemDetails(itemDetailsData);
}
} catch (error) {
- console.error('Error fetching owned items and details:', error);
+ console.error("Error fetching owned items and details:", error);
+ } finally {
+ setIsLoading(false);
}
};
@@ -148,15 +152,19 @@ export const ItemsVerticalList: React.FC = () => {
// Combine owned items with their details
const combinedItems = ownedItems.map(ownedItem => {
- // Find the matching item detail based on item ID
const itemDetail = itemDetails.find(detail => detail.id === ownedItem.item);
-
return {
...ownedItem,
...itemDetail,
};
});
+ // If the component is loading, you can display a loading indicator or message
+ if (isLoading) {
+ return
Loading...
;
+ }
+
+ // Render the list of items
return (
{combinedItems.map(item => (
diff --git a/components/_Core/Section/BentoBox.tsx b/components/_Core/Section/BentoBox.tsx
new file mode 100644
index 00000000..85494750
--- /dev/null
+++ b/components/_Core/Section/BentoBox.tsx
@@ -0,0 +1,81 @@
+import React from "react";
+import { cn } from "../../../lib/uitls";
+import { RocketIcon } from "lucide-react";
+import { BentoGrid } from "../ui/bento-grid";
+import { InventoryOneList, InventoryTwoList } from "../../_Skeleton/InventoryBlocks";
+
+export default function BlockGrid() {
+ return (
+
+ {items.map((item, i) => (
+ p:text-lg]", item.className)}
+ />
+ ))}
+
+ );
+};
+
+// Boxes
+export const BentoBoxItem = ({
+ title,
+ description,
+ className,
+ header,
+}: {
+ title?: string | React.ReactNode;
+ description?: string | React.ReactNode;
+ className?: string | React.ReactNode;
+ header?: React.ReactNode;
+}) => {
+ return (
+
+ {header}
+
+ {/*
+
+
+ {title}
+
+
+ {description}
+
+
*/}
+
+ );
+};
+
+// Items
+const items = [
+ {
+ title: "Inventory list", // Rover Temperature Control Panel"
+ description: (
+
+
+
+ ),
+ icon: RocketIcon,
+ header:
,
+ className: "md:col-span-1",
+ },
+ {
+ title: "Inventory list 2", // Rover Temperature Control Panel"
+ description: (
+
+
+
+ ),
+ icon: RocketIcon,
+ header:
,
+ className: "md:col-span-1",
+ },
+];
\ No newline at end of file
diff --git a/components/_Skeleton/InventoryBlocks.tsx b/components/_Skeleton/InventoryBlocks.tsx
new file mode 100644
index 00000000..cbb102f0
--- /dev/null
+++ b/components/_Skeleton/InventoryBlocks.tsx
@@ -0,0 +1,13 @@
+import OwnedItemsList, { ItemsVerticalList } from "../Content/Inventory/UserOwnedItems";
+
+export const InventoryOneList = () => {
+ return (
+
+ );
+};
+
+export const InventoryTwoList = () => {
+ return (
+
+ );
+};
\ No newline at end of file
diff --git a/pages/tests/blocks.tsx b/pages/tests/blocks.tsx
new file mode 100644
index 00000000..40ae54d9
--- /dev/null
+++ b/pages/tests/blocks.tsx
@@ -0,0 +1,11 @@
+import React from "react";
+import { LayoutNoNav } from "../../components/_Core/Section/Layout";
+import BlockGrid from "../../components/_Core/Section/BentoBox";
+
+export default function AllBlocksTestPage() {
+ return (
+
+
+
+ );
+};
\ No newline at end of file
diff --git a/pages/tests/planetRing.tsx b/pages/tests/planetRing.tsx
index 8d0c3928..23ba5445 100644
--- a/pages/tests/planetRing.tsx
+++ b/pages/tests/planetRing.tsx
@@ -1,5 +1,5 @@
export default function PlanetRingTestPage() {
return (
<>p>
- )
-}
\ No newline at end of file
+ );
+};
\ No newline at end of file