Skip to content

Commit

Permalink
infographics
Browse files Browse the repository at this point in the history
  • Loading branch information
damienen committed Sep 15, 2023
2 parents e7c8f15 + c354668 commit 909d2c3
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 77 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "explorer-dapp",
"description": "Itheum Explorer is a DApp for the public to explore and visualize data within the Itheum protocol",
"version": "1.4.0",
"version": "1.5.0",
"author": "Itheum",
"license": "GPL-3.0-or-later",
"dependencies": {
Expand Down
2 changes: 0 additions & 2 deletions src/pages/AppMarketplace/MultiversxInfographics/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,8 @@ export const MultiversxInfographics = () => {
"authorization": `Bearer ${tokenLogin.nativeAuthToken}`,
},
};
console.log("arg", arg);

res = await dataNft.viewDataViaMVXNativeAuth(arg);
console.log("res", res);

let blobDataType = BlobDataType.TEXT;

Expand Down
10 changes: 3 additions & 7 deletions src/pages/EsdtBubble.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export const EsdtBubble = () => {
async function fetchDataNfts() {
setIsLoading(true);

const _nfts: DataNft[] = await DataNft.createManyFromApi(ESDT_BUBBLE_NONCES.map(v => ({ nonce: v })));
const _nfts: DataNft[] = await DataNft.createManyFromApi(ESDT_BUBBLE_NONCES.map((v) => ({ nonce: v })));
setDataNfts(_nfts);

setIsLoading(false);
Expand Down Expand Up @@ -227,7 +227,7 @@ export const EsdtBubble = () => {

const dataNft = dataNfts[index];
setSelectedDataNft(dataNft);

let res: any;
if (!(tokenLogin && tokenLogin.nativeAuthToken)) {
throw Error("No nativeAuth token");
Expand All @@ -240,12 +240,10 @@ export const EsdtBubble = () => {
"authorization": `Bearer ${tokenLogin.nativeAuthToken}`,
},
};
console.log('arg', arg);

res = await dataNft.viewDataViaMVXNativeAuth(arg);
res.data = await (res.data as Blob).text();
res.data = JSON.parse(res.data);
console.log('res', res);

processData(res.data);
} else {
Expand Down Expand Up @@ -375,9 +373,7 @@ export const EsdtBubble = () => {
}}>
<div>
<Loader noText />
<p className="text-center font-weight-bold">
{"Loading..."}
</p>
<p className="text-center font-weight-bold">{"Loading..."}</p>
</div>
</div>
) : (
Expand Down
34 changes: 7 additions & 27 deletions src/pages/GamerInsights.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,10 @@ function GamerInsights({ gamerId, gamerData }) {
const [userId, setUserId] = useState(null);
// const { colorMode, toggleColorMode } = useColorMode();

const [
readingsDiscordBotUserOnGuildActivity,
setReadingsDiscordBotUserOnGuildActivity,
] = useState([]);
const [readingsTrdPtyWonderHeroGameApi, setReadingsTrdPtyWonderHeroGameApi] =
useState([]);
const [readingsOnChainAddrTxOnCon, setReadingsOnChainAddrTxOnCon] = useState(
[]
);
const [readingsOnChainAddrTxOnConErd, setReadingsOnChainAddrTxOnConErd] =
useState([]);
const [readingsDiscordBotUserOnGuildActivity, setReadingsDiscordBotUserOnGuildActivity] = useState([]);
const [readingsTrdPtyWonderHeroGameApi, setReadingsTrdPtyWonderHeroGameApi] = useState([]);
const [readingsOnChainAddrTxOnCon, setReadingsOnChainAddrTxOnCon] = useState([]);
const [readingsOnChainAddrTxOnConErd, setReadingsOnChainAddrTxOnConErd] = useState([]);
const [gamingActivityAllData, setGamingActivityAllData] = useState([]);
const [socialActivityAllData, setSocialActivityAllData] = useState([]);

Expand All @@ -36,29 +29,16 @@ function GamerInsights({ gamerId, gamerData }) {
setUserId(gamerId);
setReadingsOnChainAddrTxOnCon(gamerData.readingsOnChainAddrTxOnCon);
setReadingsOnChainAddrTxOnConErd(gamerData.readingsOnChainAddrTxOnConErd);
setReadingsDiscordBotUserOnGuildActivity(
gamerData.readingsDiscordBotUserOnGuildActivity
);
setReadingsTrdPtyWonderHeroGameApi(
gamerData.readingsTrdPtyWonderHeroGameApi
);
setReadingsDiscordBotUserOnGuildActivity(gamerData.readingsDiscordBotUserOnGuildActivity);
setReadingsTrdPtyWonderHeroGameApi(gamerData.readingsTrdPtyWonderHeroGameApi);
setSocialActivityAllData(gamerData.socialActivityAllData);
setGamingActivityAllData(gamerData.gamingActivityAllData);
}
}, [gamerData]);

// useEffect(() => {
// console.log('colorMode', colorMode);
// }, [colorMode]);

return (
<>
<ActivityHeatmap
startDate="2022-04-01"
endDateIsToday={true}
activityAllData={gamingActivityAllData}
showToolTips={true}
/>
<ActivityHeatmap startDate="2022-04-01" endDateIsToday={true} activityAllData={gamingActivityAllData} showToolTips={true} />
</>
);
}
Expand Down
12 changes: 2 additions & 10 deletions src/pages/ItheumTrailblazer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const ItheumTrailblazer = () => {
async function fetchAppNfts() {
setIsLoading(true);

const _nfts: DataNft[] = await DataNft.createManyFromApi(TRAILBLAZER_NONCES.map(v => ({ nonce: v })));
const _nfts: DataNft[] = await DataNft.createManyFromApi(TRAILBLAZER_NONCES.map((v) => ({ nonce: v })));

setItDataNfts(_nfts);
setIsLoading(false);
Expand Down Expand Up @@ -90,12 +90,10 @@ export const ItheumTrailblazer = () => {
"authorization": `Bearer ${tokenLogin.nativeAuthToken}`,
},
};
console.log('arg', arg);

res = await dataNft.viewDataViaMVXNativeAuth(arg);
res.data = await (res.data as Blob).text();
res.data = JSON.parse(res.data);
console.log('res', res);

setData(res.data.data.reverse());
setIsFetchingDataMarshal(false);
Expand Down Expand Up @@ -130,13 +128,7 @@ export const ItheumTrailblazer = () => {
<h3 className="text-center text-white">No Data NFTs</h3>
)}

<TrailBlazerModal
isModalOpened={isModalOpened}
closeModal={closeModal}
owned={owned}
isFetchingDataMarshal={isFetchingDataMarshal}
data={data}
/>
<TrailBlazerModal isModalOpened={isModalOpened} closeModal={closeModal} owned={owned} isFetchingDataMarshal={isFetchingDataMarshal} data={data} />
</HeaderComponent>
);
};
15 changes: 4 additions & 11 deletions src/pages/MultiversxBubbles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const MultiversxBubbles = () => {
async function fetchDataNfts() {
setIsLoading(true);

const _nfts: DataNft[] = await DataNft.createManyFromApi(MULTIVERSX_BUBBLE_NONCES.map(v => ({ nonce: v })));
const _nfts: DataNft[] = await DataNft.createManyFromApi(MULTIVERSX_BUBBLE_NONCES.map((v) => ({ nonce: v })));
setDataNfts(_nfts);

setIsLoading(false);
Expand Down Expand Up @@ -92,7 +92,7 @@ export const MultiversxBubbles = () => {
openModal();

const dataNft = dataNfts[index];

let res: any;
if (!(tokenLogin && tokenLogin.nativeAuthToken)) {
throw Error("No nativeAuth token");
Expand All @@ -106,10 +106,8 @@ export const MultiversxBubbles = () => {
},
stream: true,
};
console.log('arg', arg);

res = await dataNft.viewDataViaMVXNativeAuth(arg);
console.log('res', res);

let blobDataType = BlobDataType.TEXT;
if (!res.error) {
Expand Down Expand Up @@ -224,9 +222,7 @@ export const MultiversxBubbles = () => {
<div className="flex flex-col items-center justify-center min-h-[40rem]">
<div>
<Loader noText />
<p className="text-center text-foreground ">
{"Loading..."}
</p>
<p className="text-center text-foreground ">{"Loading..."}</p>
</div>
</div>
) : (
Expand All @@ -237,10 +233,7 @@ export const MultiversxBubbles = () => {
<img src={viewDataRes.data} className="w-full h-auto" />
) : viewDataRes.blobDataType === BlobDataType.SVG ? (
// <SVG src={viewDataRes.data} preProcessor={(code) => preProcess(code)} style={{ width: "100%", height: "auto" }} />
<ZoomableSvg
data={viewDataRes.data}
preProcess={preProcess}
/>
<ZoomableSvg data={viewDataRes.data} preProcess={preProcess} />
) : (
<p className="p-2" style={{ wordWrap: "break-word", whiteSpace: "pre-wrap" }}>
{viewDataRes.data}
Expand Down
8 changes: 2 additions & 6 deletions src/pages/MultiversxInfographics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const MultiversxInfographics = () => {
async function fetchDataNfts() {
setIsLoading(true);

const _nfts: DataNft[] = await DataNft.createManyFromApi(MULTIVERSX_INFOGRAPHICS_NONCES.map(v => ({ nonce: v })));
const _nfts: DataNft[] = await DataNft.createManyFromApi(MULTIVERSX_INFOGRAPHICS_NONCES.map((v) => ({ nonce: v })));
setDataNfts(_nfts);

setIsLoading(false);
Expand Down Expand Up @@ -101,10 +101,8 @@ export const MultiversxInfographics = () => {
"authorization": `Bearer ${tokenLogin.nativeAuthToken}`,
},
};
console.log('arg', arg);

res = await dataNft.viewDataViaMVXNativeAuth(arg);
console.log('res', res);

let blobDataType = BlobDataType.TEXT;

Expand Down Expand Up @@ -224,9 +222,7 @@ export const MultiversxInfographics = () => {
}}>
<div>
<Loader noText />
<p className="text-center font-weight-bold">
{"Loading..."}
</p>
<p className="text-center font-weight-bold">{"Loading..."}</p>
</div>
</div>
) : (
Expand Down
18 changes: 7 additions & 11 deletions src/pages/MyWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export const MyWallet = () => {
const { address } = useGetAccount();
const { hasPendingTransactions } = useGetPendingTransactions();
const { tokenLogin } = useGetLoginInfo();

const [dataNftCount, setDataNftCount] = useState<number>(0);
const [dataNfts, setDataNfts] = useState<DataNft[]>([]);
const [isLoading, setIsLoading] = useState(true);
Expand All @@ -34,6 +33,12 @@ export const MyWallet = () => {
const [isAutoOpenFormat, setIsAutoOpenFormat] = useState<boolean>(false);
const [isDomPurified, setIsDomPurified] = useState<boolean>(false);

useEffect(() => {
if (!hasPendingTransactions) {
fetchData();
}
}, [hasPendingTransactions]);

function openModal() {
setIsModalOpened(true);
}
Expand All @@ -55,12 +60,6 @@ export const MyWallet = () => {
setIsLoading(false);
}

useEffect(() => {
if (!hasPendingTransactions) {
fetchData();
}
}, [hasPendingTransactions]);

async function viewNormalData(index: number) {
if (!(index >= 0 && index < dataNfts.length)) {
toastError("Data is not loaded");
Expand All @@ -84,7 +83,6 @@ export const MyWallet = () => {
"authorization": `Bearer ${tokenLogin.nativeAuthToken}`,
},
};
console.log('arg', arg);

res = await dataNft.viewDataViaMVXNativeAuth(arg);

Expand Down Expand Up @@ -204,9 +202,7 @@ export const MyWallet = () => {
}}>
<div>
<Loader noText />
<p className="text-center font-weight-bold">
{"Loading..."}
</p>
<p className="text-center font-weight-bold">{"Loading..."}</p>
</div>
</div>
) : (
Expand Down

0 comments on commit 909d2c3

Please sign in to comment.