Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes for #83, #84, #85. Good error message for web wallet on wallet … #86

Merged
merged 1 commit into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 the public explore the Itheum protocol components",
"version": "0.1.0.beta.2",
"version": "0.2.0",
"author": "Itheum",
"license": "GPL-3.0-or-later",
"dependencies": {
Expand Down
14 changes: 9 additions & 5 deletions src/components/Layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@ export const Layout = ({ children }: { children: React.ReactNode }) => {
<div className="d-flex flex-column flex-fill wrapper">
<Navbar />
<main className="d-flex flex-column flex-grow-1">
<AuthenticatedRoutesWrapper
routes={routes}
unlockRoute={`${routeNames.unlock}${search}`}
>
<AuthenticatedRoutesWrapper routes={routes} unlockRoute={`${routeNames.unlock}${search}`}>
{children}
</AuthenticatedRoutesWrapper>
</main>
<Footer />
<Toaster />
<Toaster
toastOptions={{
// Default options for specific types
error: {
duration: 30000,
},
}}
/>
</div>
);
};
4 changes: 2 additions & 2 deletions src/components/TrailBlazerModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ export const TrailBlazerModal = ({
}

return (
<Modal isOpen={isModalOpened} onRequestClose={closeModal} style={customStyles} ariaHideApp={false}>
<Modal isOpen={isModalOpened} onRequestClose={closeModal} style={customStyles} ariaHideApp={false} shouldCloseOnOverlayClick={false}>
<div style={{ height: "3rem" }}>
<div
style={{
Expand All @@ -243,7 +243,7 @@ export const TrailBlazerModal = ({
</div>
</div>
<ModalHeader>
<h4 className="text-center font-title font-weight-bold">Itheum Trailblazer</h4>
<h4 className="text-center font-title font-weight-bold">Trailblazer</h4>
</ModalHeader>
<ModalBody>
{!owned ? (
Expand Down
23 changes: 20 additions & 3 deletions src/libs/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { MARKETPLACE_DETAILS_PAGE } from "config";

export const modalStyles = {
overlay: {
backgroundColor: 'var(--light-20) !important',
backdropFilter: 'blur(10px)',
backgroundColor: "var(--light-20) !important",
backdropFilter: "blur(10px)",
},
content: {
width: "80%",
Expand All @@ -13,6 +13,23 @@ export const modalStyles = {
bottom: "auto",
marginRight: "-50%",
transform: "translate(-50%, -50%)",
backgroundColor: 'var(--light)',
backgroundColor: "var(--light)",
},
};

export const modalStylesFull = {
overlay: {
backgroundColor: "var(--light-20) !important",
backdropFilter: "blur(10px)",
},
content: {
width: "95%",
top: "50%",
left: "50%",
right: "auto",
bottom: "auto",
marginRight: "-50%",
transform: "translate(-50%, -50%)",
backgroundColor: "var(--light)",
},
};
17 changes: 13 additions & 4 deletions src/pages/MultiversxBubbles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { MULTIVERSX_BUBBLE_NONCES } from "config";
import { useGetAccount, useGetPendingTransactions } from "hooks";
import { getMessageSignatureFromWalletUrl } from "libs/mvx";
import { BlobDataType } from "libs/types";
import { modalStyles } from "libs/ui";
import { modalStylesFull } from "libs/ui";
import { toastError } from "libs/utils";
import { routeNames } from "routes";

Expand Down Expand Up @@ -200,6 +200,15 @@ export const MultiversxBubbles = () => {
}
}

function preProcess(code: any) {
// let newCode = code.replace(/fill=".*?"/g, 'fill="red"');
let newCode = code.replace(/height="1080pt"/, 'height="100%"');
newCode = newCode.replace(/width="1080pt"/, 'width="100%"');
newCode = newCode.replace(/<a/g, '<a xlink:show="new"'); // makes all link open in new tab

return newCode;
}

if (isLoading) {
return <Loader />;
}
Expand Down Expand Up @@ -230,7 +239,7 @@ export const MultiversxBubbles = () => {
</div>
</div>

<Modal isOpen={isModalOpened} onRequestClose={closeModal} style={modalStyles} ariaHideApp={false}>
<Modal isOpen={isModalOpened} onRequestClose={closeModal} style={modalStylesFull} ariaHideApp={false} shouldCloseOnOverlayClick={false}>
<div style={{ height: "3rem" }}>
<div
style={{
Expand All @@ -243,7 +252,7 @@ export const MultiversxBubbles = () => {
</div>
</div>
<ModalHeader>
<h4 className="text-center font-title font-weight-bold">View Data</h4>
<h4 className="text-center font-title font-weight-bold">MultiversX Bubbles</h4>
</ModalHeader>
<ModalBody
style={{
Expand Down Expand Up @@ -289,7 +298,7 @@ export const MultiversxBubbles = () => {
<audio controls autoPlay src={viewDataRes.data} />
</div>
) : viewDataRes.blobDataType === BlobDataType.SVG ? (
<SVG src={viewDataRes.data} style={{ width: "100%", height: "auto" }} />
<SVG src={viewDataRes.data} preProcessor={(code) => preProcess(code)} style={{ width: "100%", height: "auto" }} />
) : (
<p className="p-2" style={{ wordWrap: "break-word", whiteSpace: "pre-wrap" }}>
{viewDataRes.data}
Expand Down
27 changes: 25 additions & 2 deletions src/pages/MyWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { BlobDataType } from "libs/types";
import { modalStyles } from "libs/ui";
import { toastError } from "libs/utils";
import { routeNames } from "routes";
import toast from "react-hot-toast";

interface ExtendedViewDataReturnType extends ViewDataReturnType {
blobDataType: BlobDataType;
Expand Down Expand Up @@ -71,7 +72,29 @@ export const MyWallet = () => {

async function viewNormalData(index: number) {
if (isWebWallet) {
toastError("Web Wallet is not supported on this page.");
toast.error(
<div>
Web Wallet is yet to be supported as an option to <b>View Data</b> on this page (it's coming very soon). In the meantime: <br />
<br />
<div>
1) You can use Web Wallet to <b>View Data</b> in <b>Itheum Explorer</b> by using a custom app in the <b>App Marketplace</b> section by{" "}
<a href="/" target="_blank">
heading here
</a>
</div>
<br />
<div>
2) Or head over to the <b>Data DEX</b> at{" "}
<a href="https://datadex.itheum.io" target="_blank">
datadex.itheum.io
</a>
, login, and then navigate to the <b>Wallet</b> section to view and open your Data NFTs.
</div>
</div>,
{
position: "top-right",
}
);
return;
}
if (!(index >= 0 && index < dataNfts.length)) {
Expand Down Expand Up @@ -262,7 +285,7 @@ export const MyWallet = () => {
{isTrailBlazer || targetNonce ? (
<TrailBlazerModal isModalOpened={isModalOpened} closeModal={closeModal} owned={true} isFetchingDataMarshal={isFetchingDataMarshal} data={data} />
) : (
<Modal isOpen={isModalOpened} onRequestClose={closeModal} style={modalStyles} ariaHideApp={false}>
<Modal isOpen={isModalOpened} onRequestClose={closeModal} style={modalStyles} ariaHideApp={false} shouldCloseOnOverlayClick={false}>
<div style={{ height: "3rem" }}>
<div
style={{
Expand Down