From c7af50a5e14648c87ffcfbdb7f1eeb075b122ca6 Mon Sep 17 00:00:00 2001 From: Bran <52735957+brancoder@users.noreply.github.com> Date: Tue, 23 Jan 2024 23:35:19 +0100 Subject: [PATCH 1/2] fix: add absolute path for loading wasm files (#1002) Co-authored-by: Mario --- client/src/app/components/identity/DIDResolver.tsx | 4 ++-- client/src/helpers/hooks/useResolvedDID.ts | 2 +- client/src/index.tsx | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/client/src/app/components/identity/DIDResolver.tsx b/client/src/app/components/identity/DIDResolver.tsx index 382fbe090..0fb8b168f 100644 --- a/client/src/app/components/identity/DIDResolver.tsx +++ b/client/src/app/components/identity/DIDResolver.tsx @@ -148,8 +148,8 @@ export default IdentityStardustResolver; async function constructVerifiedDomains(resolvedDID: IDIDResolverResponse): Promise>> { const newVerifiedDomains = new Map>(); - - await ServiceFactory.get("identity").initLibrary(); + const origin = window?.location?.origin ?? ""; + await ServiceFactory.get("identity").initLibrary(origin + "/wasm/identity_wasm_bg.wasm"); const didDocument = identity.IotaDocument.fromJSON(resolvedDID.document); // Get the Linked Domain Services from the DID Document. diff --git a/client/src/helpers/hooks/useResolvedDID.ts b/client/src/helpers/hooks/useResolvedDID.ts index a21c29e32..38fa4ad5c 100644 --- a/client/src/helpers/hooks/useResolvedDID.ts +++ b/client/src/helpers/hooks/useResolvedDID.ts @@ -29,7 +29,7 @@ export function useResolvedDID(network: string, bech32Hrp: string, addressHex: s setidentityResponse(response); } }) - .then(() => identityService.initLibrary()) + .then(() => identityService.initLibrary(window?.location?.origin ?? "" + "/wasm/identity_wasm_bg.wasm")) .finally(() => { setIsLoading(false); }); diff --git a/client/src/index.tsx b/client/src/index.tsx index a7a9dfc04..48cc3a513 100644 --- a/client/src/index.tsx +++ b/client/src/index.tsx @@ -35,7 +35,8 @@ const apiEndpoint = (window as any).env.API_ENDPOINT; initialiseServices() .then(async () => { // load the wasm - await initStardustSdk("/wasm/iota_sdk_stardust_wasm_bg.wasm"); + const origin = window?.location?.origin ?? ""; + await initStardustSdk(origin + "/wasm/iota_sdk_stardust_wasm_bg.wasm"); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const container = document.querySelector("#root")!; From 7247b7da6523f1d6de7496a2b18989db60b98125 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 24 Jan 2024 17:07:33 +0100 Subject: [PATCH 2/2] feat: Show Explorer client version from package.json on the Footer (#1004) --- .../components/footer/ExplorerVersion.scss | 25 +++++++++++++++++++ .../app/components/footer/ExplorerVersion.tsx | 17 +++++++++++++ client/src/app/components/footer/Footer.scss | 2 +- client/src/app/components/footer/Footer.tsx | 2 ++ .../app/components/footer/ShimmerFooter.scss | 1 + .../app/components/footer/ShimmerFooter.tsx | 4 ++- client/vite-env.d.ts | 1 + client/vite.config.ts | 3 +++ 8 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 client/src/app/components/footer/ExplorerVersion.scss create mode 100644 client/src/app/components/footer/ExplorerVersion.tsx diff --git a/client/src/app/components/footer/ExplorerVersion.scss b/client/src/app/components/footer/ExplorerVersion.scss new file mode 100644 index 000000000..19377bce2 --- /dev/null +++ b/client/src/app/components/footer/ExplorerVersion.scss @@ -0,0 +1,25 @@ +@import "../../../scss/fonts"; +@import "../../../scss/media-queries"; +@import "../../../scss/mixins"; +@import "../../../scss/variables"; + +.explorer-version { + display: flex; + width: 100%; + background-color: $gray-11; + justify-content: center; + padding-bottom: 12px; + + &.shimmer-version { + position: absolute; + bottom: 0; + background-color: transparent; + } + + span { + @include font-size(13px); + + font-family: $inter; + color: $gray-6; + } +} diff --git a/client/src/app/components/footer/ExplorerVersion.tsx b/client/src/app/components/footer/ExplorerVersion.tsx new file mode 100644 index 000000000..821baae6b --- /dev/null +++ b/client/src/app/components/footer/ExplorerVersion.tsx @@ -0,0 +1,17 @@ +import React from "react"; +import classNames from "classnames"; +import "./ExplorerVersion.scss"; + +export default function ExplorerVersion({ shimmerTheme }: { shimmerTheme?: boolean }): React.JSX.Element { + const explorerVersion = EXPLORER_VERSION ?? ""; + + return ( + <> + {explorerVersion && ( +
+ v{explorerVersion} +
+ )} + + ); +} diff --git a/client/src/app/components/footer/Footer.scss b/client/src/app/components/footer/Footer.scss index 7dac793a3..c0f3b9110 100644 --- a/client/src/app/components/footer/Footer.scss +++ b/client/src/app/components/footer/Footer.scss @@ -7,7 +7,7 @@ footer { .footer--content { display: flex; justify-content: center; - padding: 40px 20px 64px 20px; + padding: 40px 20px 0px 20px; background-color: $gray-11; color: $white; diff --git a/client/src/app/components/footer/Footer.tsx b/client/src/app/components/footer/Footer.tsx index 8d3117e70..9826bdf22 100644 --- a/client/src/app/components/footer/Footer.tsx +++ b/client/src/app/components/footer/Footer.tsx @@ -11,6 +11,7 @@ import TwitterIcon from "~assets/twitter.svg?react"; import YoutubeIcon from "~assets/youtube.svg?react"; import { FoundationDataHelper } from "~helpers/foundationDataHelper"; import AsyncComponent from "../AsyncComponent"; +import ExplorerVersion from "./ExplorerVersion"; import "./Footer.scss"; /** @@ -135,6 +136,7 @@ class Footer extends AsyncComponent { +
{this.SOCIAL_LINKS.map((social, socialID) => ( {
+ ); diff --git a/client/vite-env.d.ts b/client/vite-env.d.ts index 8827bbe8f..88c01eeb3 100644 --- a/client/vite-env.d.ts +++ b/client/vite-env.d.ts @@ -1,3 +1,4 @@ /// /// +declare const EXPLORER_VERSION: string; diff --git a/client/vite.config.ts b/client/vite.config.ts index ab31aace8..6b1c0737b 100644 --- a/client/vite.config.ts +++ b/client/vite.config.ts @@ -23,6 +23,9 @@ export default defineConfig(() => { }), nodePolyfills() ], + define: { + EXPLORER_VERSION: JSON.stringify(process.env.npm_package_version) + }, test: { globals: true, teardownTimeout: 100