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

STG -> MAIN (milestone 1.5.0) #160

Merged
merged 19 commits into from
Sep 15, 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
2,363 changes: 1,247 additions & 1,116 deletions package-lock.json

Large diffs are not rendered by default.

37 changes: 19 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
{
"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": {
"@fortawesome/fontawesome-svg-core": "6.1.0",
"@fortawesome/free-solid-svg-icons": "6.1.0",
"@fortawesome/react-fontawesome": "0.1.18",
"@headlessui/react": "1.7.15",
"@itheum/sdk-mx-data-nft": "^0.1.1",
"@multiversx/sdk-core": "12.6.0",
"@multiversx/sdk-dapp": "2.19.2",
"@multiversx/sdk-network-providers": "1.5.0",
"@radix-ui/react-dropdown-menu": "^2.0.5",
"@radix-ui/react-navigation-menu": "^1.1.3",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-switch": "^1.0.3",
"@itheum/sdk-mx-data-nft": "1.0.0",
"@multiversx/sdk-core": "12.8.0",
"@multiversx/sdk-dapp": "2.20.1",
"@multiversx/sdk-network-providers": "2.0.0",
"@radix-ui/react-dropdown-menu": "2.0.5",
"@radix-ui/react-navigation-menu": "1.1.3",
"@radix-ui/react-slot": "1.0.2",
"@radix-ui/react-switch": "1.0.3",
"@types/react-modal": "3.16.0",
"axios": "0.24.0",
"bootstrap": "4.6.2",
"chartjs-plugin-zoom": "2.0.1",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"class-variance-authority": "0.7.0",
"clsx": "2.0.0",
"d3": "7.8.5",
"dompurify": "^3.0.5",
"lucide-react": "^0.265.0",
"dompurify": "3.0.5",
"lucide-react": "0.265.0",
"moment": "2.29.4",
"moment-timezone": "0.5.43",
"react": "18.2.0",
Expand All @@ -35,15 +35,16 @@
"react-dom": "18.2.0",
"react-hot-toast": "2.4.0",
"react-icons": "4.8.0",
"react-inlinesvg": "^3.0.2",
"react-inlinesvg": "3.0.2",
"react-modal": "3.16.1",
"react-pdf": "^7.3.3",
"react-pdf": "7.3.3",
"react-router-dom": "6.14.2",
"react-tooltip": "5.11.1",
"react-vertical-timeline-component": "3.6.0",
"react-zoom-pan-pinch": "^3.1.0",
"styled-components": "5.3.11",
"tailwind-merge": "^1.14.0",
"tailwindcss-animate": "^1.0.6",
"tailwind-merge": "1.14.0",
"tailwindcss-animate": "1.0.6",
"web-vitals": "1.0.1"
},
"scripts": {
Expand All @@ -69,7 +70,7 @@
"@testing-library/react": "14.0.0",
"@testing-library/user-event": "14.4.3",
"@types/d3": "7.4.0",
"@types/dompurify": "^3.0.2",
"@types/dompurify": "3.0.2",
"@types/jest": "26.0.15",
"@types/node": "12.0.0",
"@types/react": "18.0.24",
Expand Down
9 changes: 5 additions & 4 deletions src/components/AuthRedirectWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import React, { PropsWithChildren } from "react";
import { Navigate } from "react-router-dom";
import { useNavigate } from "react-router-dom";
import { useGetIsLoggedIn } from "hooks";
import { routeNames } from "routes";

export const AuthRedirectWrapper = ({ children }: PropsWithChildren) => {
const isLoggedIn = useGetIsLoggedIn();
const navigate = useNavigate();

// if (isLoggedIn) {
// return <Navigate to={routeNames.dashboard} />;
// }
if (isLoggedIn) {
navigate(routeNames.dashboard);
}

return <>{children}</>;
};
1 change: 1 addition & 0 deletions src/components/CustomPagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ interface PropsType {
export const CustomPagination: FC<PropsType> = ({
pageCount,
pageIndex,
// eslint-disable-next-line
pageSize,
gotoPage,
disabled = false,
Expand Down
2 changes: 1 addition & 1 deletion src/components/DataNftCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { DataNft } from "@itheum/sdk-mx-data-nft/out";
import { useGetNetworkConfig } from "@multiversx/sdk-dapp/hooks/useGetNetworkConfig";
import { MARKETPLACE_DETAILS_PAGE } from "config";
import { convertToLocalString } from "libs/utils";
import { ElrondAddressLink } from "./ElrondAddressLink";
import { Button } from "../libComponents/Button";
import { Card, CardContent, CardFooter } from "../libComponents/Card";
import { ElrondAddressLink } from "./ElrondAddressLink";

export function DataNftCard({
index,
Expand Down
1 change: 0 additions & 1 deletion src/components/Layout/HeaderComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from "react";
import headerHero from "../../assets/img/custom-app-header-trailblazer.png";

type HeaderProps = {
pageTitle: string;
Expand Down
4 changes: 2 additions & 2 deletions src/components/Modal/TwModal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Fragment, useEffect, useState } from "react";
import { Dialog, Transition } from "@headlessui/react";
import { Fragment, useEffect, useState } from "react";
import { MdOutlineClose } from "react-icons/md";

type ModalProps = {
Expand All @@ -9,7 +9,7 @@ type ModalProps = {
};

export const TwModal = (props: ModalProps) => {
const { isModalOpen = false, content, setIsModalOpen } = props;
const { isModalOpen = false, content } = props;
let [isOpen, setIsOpen] = useState(isModalOpen);

function closeModal() {
Expand Down
10 changes: 5 additions & 5 deletions src/components/TrailBlazerModal.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { useState } from "react";
import { useGetLoginInfo } from "@multiversx/sdk-dapp/hooks";
import { ModalBody, ModalHeader } from "react-bootstrap";
import { FaCalendarCheck, FaChartBar, FaChessKnight, FaFlagCheckered, FaHandshake, FaMoneyBillAlt, FaShopify, FaShoppingCart, FaTrophy } from "react-icons/fa";
import { IoClose } from "react-icons/io5";
import Modal from "react-modal";
import { VerticalTimeline, VerticalTimelineElement } from "react-vertical-timeline-component";
import { Loader } from "components";
import { useGetLoginInfo } from "@multiversx/sdk-dapp/hooks";
import { IFrameModal } from "./iFrameModal";
import { TwModal } from "./Modal/TwModal";

Expand Down Expand Up @@ -46,17 +46,17 @@ export const TrailBlazerModal = ({
}) => {
const { loginMethod } = useGetLoginInfo();
const [content, setContent] = useState<React.ReactElement>(<></>);
const [title, setTitle] = useState<string>();
// const [title, setTitle] = useState<string>();
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);

const handleIFrameModal = (link: string) => {
setContent(<IFrameModal link={link} />);
setIsModalOpen(true);
};

const handleCloseModal = () => {
setContent(<></>);
};
// const handleCloseModal = () => {
// setContent(<></>);
// };

const getIconForCategory = (dataItem: any) => {
switch (dataItem.category) {
Expand Down
5 changes: 5 additions & 0 deletions src/components/ZoomableSvg/Reset.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/components/ZoomableSvg/ZoomIn.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/components/ZoomableSvg/ZoomOut.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions src/components/ZoomableSvg/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.zoomable-toolbar-button {
display: block;
width: 2.5rem;
height: 2.5rem;
margin: 1px 2px;
color: rgb(255, 255, 255);
transition: color 200ms ease 0s;
background: none;
padding: 0px;
border: 0px;
outline: 0px;
cursor: pointer;
}
116 changes: 116 additions & 0 deletions src/components/ZoomableSvg/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import React, { useRef } from "react";
import SVG from "react-inlinesvg";
import {
TransformWrapper,
TransformComponent,
ReactZoomPanPinchRef,
} from "react-zoom-pan-pinch";
import svgReset from "./Reset.svg";
import svgZoomIn from "./ZoomIn.svg";
import svgZoomOut from "./ZoomOut.svg";
import "./index.scss";

const INITIAL_SCALE = 2;

export const ZoomableSvg = ({
data,
preProcess,
} : {
data: any,
preProcess: any,
}) => {
const transformComponentRef = useRef<ReactZoomPanPinchRef | null>(null);

const actionZoomIn = () => {
if (transformComponentRef.current) {
const { zoomIn } = transformComponentRef.current;
zoomIn();
}
};

const actionZoomOut = () => {
if (transformComponentRef.current) {
const { zoomOut } = transformComponentRef.current;
zoomOut();
}
};

const actionReset = () => {
if (transformComponentRef.current) {
const { centerView } = transformComponentRef.current;
centerView(INITIAL_SCALE);
}
};

return (
<TransformWrapper
initialScale={INITIAL_SCALE}
centerOnInit
centerZoomedOut
initialPositionX={0}
initialPositionY={0}
ref={transformComponentRef}
wheel={{
// step: 0.5,
smoothStep: 0.004,
}}
// pinch={{
// step: 0.5,
// }}
>
<React.Fragment>
<TransformComponent
wrapperStyle={{
width: '100%',
height: '100%',
}}
contentStyle={{
height: "100%",
// width: "auto",
}}
>
<SVG
id="zoomable-svg"
src={data}
preProcessor={(code) => preProcess(code)}
// style={{ width: "100%", height: "auto" }}
/>
</TransformComponent>

<div
style={{
position: "absolute",
top: "1rem",
left: "unset",
right: "1rem",
bottom: "unset",
backgroundColor: "rgba(19, 20, 22, 0.9)",
borderRadius: "2px",
display: "flex",
flexDirection: "column",
padding: "2px 1px",
}}
>
<button
className="zoomable-toolbar-button"
onClick={actionZoomIn}
>
<img src={svgZoomIn} style={{ width: "100%", height: "100%" }} />
</button>
<button
className="zoomable-toolbar-button"
onClick={actionZoomOut}
>
<img src={svgZoomOut} style={{ width: "100%", height: "100%" }} />
</button>
<button
className="zoomable-toolbar-button"
onClick={actionReset}
>
<img src={svgReset} style={{ width: "100%", height: "100%" }} />
</button>
</div>
</React.Fragment>
</TransformWrapper>
);
};
1 change: 1 addition & 0 deletions src/components/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ export * from "./DataNftCard";
export * from "./ElrondAddressLink";
export * from "./sdkDappComponents";
export * from "./TrailBlazerModal";
export * from "./ZoomableSvg";
6 changes: 3 additions & 3 deletions src/libComponents/ThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ export function ThemeProvider({ children, defaultTheme = "system", storageKey =

const value = {
theme,
setTheme: (theme: Theme) => {
localStorage.setItem(storageKey, theme);
setTheme(theme);
setTheme: (_theme: Theme) => {
localStorage.setItem(storageKey, _theme);
setTheme(_theme);
},
};

Expand Down
2 changes: 0 additions & 2 deletions src/libs/ui.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { MARKETPLACE_DETAILS_PAGE } from "config";

export const modalStyles = {
overlay: {
backgroundColor: "var(--light-20) !important",
Expand Down
2 changes: 1 addition & 1 deletion src/libs/utils/constant.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import iconBubbleMaps from "assets/img/expl-app-bubblemaps-icon.png";
import iconTrailblazer from "assets/img/expl-app-trailblazer-icon.png";
import iconInfrographics from "assets/img/expl-app-infographics-icon.png";
import iconTrailblazer from "assets/img/expl-app-trailblazer-icon.png";

export const ERROR_CONNECT_WALLET = "Connect your wallet";
export const ERROR_TRANSACTION_ONGOING = "A transaction is ongoing";
Expand Down
10 changes: 5 additions & 5 deletions src/libs/utils/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export function onChainDataInsights_LIB({rawReadings, userTz}) {
}

let scoreGroup = '';
let totalScore = 0;
// let totalScore = 0;

let workOnReadings = rawReadings.reverse().map((i, idx) => {
let workOnReadings = rawReadings.reverse().map((i) => {
let newObj = { ...i };
let thisReadingTs = moment.utc(newObj.createdAt);
let readingDataPoints = [];
Expand Down Expand Up @@ -207,10 +207,10 @@ export function thirdPartyDataInsights_LIB({rawReadings, userTz}) {
userTz = 'Australia/Sydney';
}

let scoreGroup = '';
let totalScore = 0;
// let scoreGroup = '';
// let totalScore = 0;

let workOnReadings = rawReadings.reverse().map((i, idx) => {
let workOnReadings = rawReadings.reverse().map((i) => {
let newObj = { ...i };
let thisReadingTs = moment.utc(newObj.createdAt);
let readingDataPoints = [];
Expand Down
2 changes: 1 addition & 1 deletion src/libs/utils/ui.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import toast from "react-hot-toast";
import { clsx, ClassValue } from "clsx";
import toast from "react-hot-toast";
import { twMerge } from "tailwind-merge";

/*
Expand Down
Loading