,
+ resourceType: IResourceType
+ ) => void;
+}) => {
+ return (
+
+
+
+ {props.bankAccount.resourceType.name}
+
+
+ {props.bankAccount.balance.toLocaleString("en-US", {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}{" "}
+ kg
+
+
+ {props.conversionPair ? (
+
+
+
+
+ {props.conversionPair.resourceType.name}
+
+
+ {props.conversionPair.resourceAmount.toLocaleString("en-US", {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}{" "}
+ kg.
+
+
+
+
+
+
+ Moonbucks
+
+
+ $
+ {props.conversionPair.moneyAmount.toLocaleString("en-US", {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: 2,
+ })}
+
+
+
+
+ ) : (
+
+ )}
+
+ props.handleAmountChange(e, props.bankAccount.resourceType)
+ }
+ />
+
+ );
+};
+
+export default ResourceStoreItem;
diff --git a/src/app/page.tsx b/src/app/page.tsx
index b8fa1ec..2a5c0be 100644
--- a/src/app/page.tsx
+++ b/src/app/page.tsx
@@ -5,7 +5,7 @@ import InventoryItemView from "./Components/InventoryItemView";
import StakingSourcesView from "./Components/StakingSourcesView";
import BankAccountsView from "./Components/BankAccountsView";
import StoreItemView from "./Components/StoreItemView";
-import LightBox from "./Components/LightBox";
+import ResourceStore from "./Components/ResourceStore";
import {
IStoreItem,
IInventoryItem,
@@ -194,19 +194,22 @@ export default function Home() {
};
const handleSetLightBox = () => {
+ console.log("Tester");
setLightBoxIsActive(!lightBoxIsActive);
};
- const renderLightBox = () => {
- if (lightBoxIsActive) return ;
- };
-
return (
<>
+ {lightBoxIsActive && (
+
+ )}
(array: T[], element: T): T[] {
const newArray = [...array]; // create a new array
newArray.push(element); // add the new element to the array
return newArray; // return the new array
+ }
+
+export function sumValues, K extends keyof T>(array: T[], key: K): number {
+ return array.reduce((acc, obj) => acc + obj[key], 0);
}
\ No newline at end of file
diff --git a/typings.d.ts b/typings.d.ts
index e607270..672ba0e 100644
--- a/typings.d.ts
+++ b/typings.d.ts
@@ -52,3 +52,9 @@ export interface IClaimableResource {
resourceType: IResourceType;
balance: number;
}
+
+export interface IConversionPair {
+ resourceType: IResourceType;
+ resourceAmount: number;
+ moneyAmount: number
+}