"use client"; import React from "react"; import { IInventoryItem, IStakingSource } from "typings"; import StakingSource from "./StakingSource"; const moons = [ { name: "Caelusium", description: "Caelusium is a medium-sized moon with a diverse landscape. Its craters contain a wealth of common resources, making it an ideal starting location for beginners. The moon's relatively mild weather conditions and stable surface offer a friendly environment for establishing mining operations.", image: "/assets/moon_1.png", price: 100, }, { name: "Caelusium", description: "Caelusium is a medium-sized moon with a diverse landscape. Its craters contain a wealth of common resources, making it an ideal starting location for beginners. The moon's relatively mild weather conditions and stable surface offer a friendly environment for establishing mining operations.", image: "/assets/moon_2.png", price: 100, }, { name: "Caelusium", description: "Caelusium is a medium-sized moon with a diverse landscape. Its craters contain a wealth of common resources, making it an ideal starting location for beginners. The moon's relatively mild weather conditions and stable surface offer a friendly environment for establishing mining operations.", image: "/assets/moon_3.png", price: 100, }, { name: "Caelusium", description: "Caelusium is a medium-sized moon with a diverse landscape. Its craters contain a wealth of common resources, making it an ideal starting location for beginners. The moon's relatively mild weather conditions and stable surface offer a friendly environment for establishing mining operations.", image: "/assets/moon_4.png", price: 100, }, { name: "Caelusium", description: "Caelusium is a medium-sized moon with a diverse landscape. Its craters contain a wealth of common resources, making it an ideal starting location for beginners. The moon's relatively mild weather conditions and stable surface offer a friendly environment for establishing mining operations.", image: "/assets/moon_5.png", price: 100, }, ]; interface RowProps { stakingSources: IStakingSource[]; inventoryItems: IInventoryItem[]; claimStake: (stakingEventId: number) => void; startStake: ( inventoryItemId: number, storeItemId: string, wellId: number ) => void; } const Row: React.FC = ({ stakingSources, inventoryItems, claimStake, startStake, }) => { return (
{stakingSources.map((stakingSource, index) => (
))}
); }; const moonSizes = [250, 375, 300, 225, 175, 300, 200, 150, 300, 225]; const StakingSourcesView = (props: { stakingSources: IStakingSource[] | null; inventoryItems: IInventoryItem[] | null | undefined; claimStake: (stakingEventId: number) => void; startStake: ( inventoryItemId: number, storeItemId: string, wellId: number ) => void; createStakingSource: () => void; }) => { // Generate rows of stakingSources const handleRows = () => { let rows = []; let currentRow = []; let rowSize = 3; if (props.stakingSources) { props.stakingSources.forEach((stakingSource, index) => { currentRow.push({ ...stakingSource, size: moonSizes[index] }); if (currentRow.length === rowSize) { rows.push(currentRow); currentRow = []; rowSize = rowSize === 3 ? 4 : 3; } }); if (currentRow.length) { rows.push(currentRow); } return rows; } else { return []; } }; const rows = handleRows(); return (

Your Moons

{rows.map((stakingSources, index) => ( ))}
); }; export default StakingSourcesView;