From 640e0bff031cc7110217dc0618f2ecad949de6fa Mon Sep 17 00:00:00 2001 From: Mike Manfredi Date: Thu, 14 Mar 2024 17:59:13 +0000 Subject: [PATCH] fixing build issue --- .../NftSys/include/services/user/NftSys.hpp | 1 + services/user/NftSys/ui/src/App.tsx | 38 +++++++++++-------- .../NftSys/ui/src/components/nft-table.tsx | 10 ++--- 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/services/user/NftSys/include/services/user/NftSys.hpp b/services/user/NftSys/include/services/user/NftSys.hpp index 21e31ee72f..766acb46a1 100644 --- a/services/user/NftSys/include/services/user/NftSys.hpp +++ b/services/user/NftSys/include/services/user/NftSys.hpp @@ -79,6 +79,7 @@ namespace UserService method(debit, nftId, memo), method(setUserConf, flag, enable), method(serveSys, request), + method(storeSys, path, contentType, content), method(getNft, nftId), method(getNftHolder, account), diff --git a/services/user/NftSys/ui/src/App.tsx b/services/user/NftSys/ui/src/App.tsx index 273d46ed3a..2428497392 100644 --- a/services/user/NftSys/ui/src/App.tsx +++ b/services/user/NftSys/ui/src/App.tsx @@ -6,23 +6,23 @@ import { Heading, NftTable, SendMintNft } from "./components"; import WalletIcon from "./assets/icon-wallet.svg?react"; export type Nft = { - id: string; + id: number; status: "owned" | "burned" | "pending-debit" | "pending-credit"; counterParty?: string; }; const nfts: Nft[] = [ { - id: "1", + id: 1, status: "owned", }, { - id: "2", + id: 2, status: "pending-debit", counterParty: "brandon", }, { - id: "3", + id: 3, status: "pending-credit", counterParty: "james", }, @@ -30,23 +30,29 @@ const nfts: Nft[] = [ function App() { const [resMint, setResMint] = useState("Empty"); + const [supervisor, setSupervisor] = useState(); const init = async () => { - const supervisor = new Supervisor(); + console.info("nft finding supervisor==null"); + if (!supervisor) return; + console.info("nft waiting for supervisor loaded"); await supervisor.onLoaded(); supervisor.preLoadServices(["nft-sys"]); + console.info("nft-sys connected to Supervisor and plugins preloaded"); }; useEffect(() => { init(); - console.info("nft-sys connected to Supervisor"); - }, []); + }, [supervisor]); - const supervisor = new Supervisor(); + useEffect(() => { + console.info("nft-sys -> new Supervisor()"); + setSupervisor(new Supervisor()); + }, []); const mintNft = async () => { - if (!supervisor.onLoaded()) return; + if (!supervisor?.onLoaded()) return; - console.log("calling nft-sys.callintoplugin"); + console.log("calling nft-sys.call(mintNft())"); const res = await supervisor.functionCall({ service: "nft-sys", method: "mint", @@ -56,9 +62,9 @@ function App() { }; const burnNft = async (nftId: number) => { - if (!supervisor.onLoaded()) return; + if (!supervisor?.onLoaded()) return; - console.log("calling nft-sys.callintoplugin"); + console.log("calling nft-sys.call(burnNft())"); const res = await supervisor.functionCall({ service: "nft-sys", method: "burn", @@ -68,9 +74,9 @@ function App() { }; const uncreditNft = async (nftId: number) => { - if (!supervisor.onLoaded()) return; + if (!supervisor?.onLoaded()) return; - console.log("calling nft-sys.callintoplugin"); + console.log("calling nft-sys.call(uncreditNft))"); const res = await supervisor.functionCall({ service: "nft-sys", method: "uncredit", @@ -80,9 +86,9 @@ function App() { }; const debitNft = async (nftId: number) => { - if (!supervisor.onLoaded()) return; + if (!supervisor?.onLoaded()) return; - console.log("calling nft-sys.callintoplugin"); + console.log("calling nft-sys.call(debitNft())"); const res = await supervisor.functionCall({ service: "nft-sys", method: "debit", diff --git a/services/user/NftSys/ui/src/components/nft-table.tsx b/services/user/NftSys/ui/src/components/nft-table.tsx index c229649ce7..2ba9f0446a 100644 --- a/services/user/NftSys/ui/src/components/nft-table.tsx +++ b/services/user/NftSys/ui/src/components/nft-table.tsx @@ -31,7 +31,7 @@ interface Props { export const NftTable = ({ nfts, - actionHandlers: _actionHandlers, + actionHandlers, queryResult: result = { isLoading: false, isError: false }, }: Props) => { if (result.isLoading) { @@ -52,7 +52,7 @@ export const NftTable = ({ ); } - // const { burnNft, uncreditNft, debitNft } = actionHandlers; + const { burnNft, uncreditNft, debitNft } = actionHandlers; return (
@@ -93,7 +93,7 @@ export const NftTable = ({ size="xs" fullWidth className="text-red-500" - // onClick={() => burnNft(nft.id)} + onClick={() => burnNft(nft.id)} > Burn @@ -102,7 +102,7 @@ export const NftTable = ({ size="xs" fullWidth className="text-green-500" - // onClick={() => debitNft(nft.id)} + onClick={() => debitNft(nft.id)} > Claim @@ -111,7 +111,7 @@ export const NftTable = ({ size="xs" fullWidth className="w-24" - // onClick={() => uncreditNft(nft.id)} + onClick={() => uncreditNft(nft.id)} > Uncredit