From b9b8ef538a9f22b84963e19ddffc8eb0dbcd0e6e Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 6 Jun 2023 16:34:14 +0300 Subject: [PATCH 01/14] added Terminal chart --- package.json | 29 +- src/components/Charts/Terminal/constants.ts | 6 + src/components/Charts/Terminal/index.tsx | 15 + src/components/Charts/Terminal/styles.ts | 10 + src/components/Charts/index.stories.tsx | 13 + src/components/Charts/index.ts | 1 + src/components/index.ts | 3 +- yarn.lock | 1297 +++++++++---------- 8 files changed, 678 insertions(+), 696 deletions(-) create mode 100644 src/components/Charts/Terminal/constants.ts create mode 100644 src/components/Charts/Terminal/index.tsx create mode 100644 src/components/Charts/Terminal/styles.ts create mode 100644 src/components/Charts/index.stories.tsx create mode 100644 src/components/Charts/index.ts diff --git a/package.json b/package.json index 0ff30f1..821cdb8 100644 --- a/package.json +++ b/package.json @@ -21,38 +21,39 @@ "@storybook/react": "^7.0.12", "@storybook/react-vite": "^7.0.12", "@storybook/testing-library": "^0.0.14-next.2", + "@testing-library/jest-dom": "^5.11.6", + "@testing-library/react": "^12.1.3", "@types/react": "^18.0.15", "@types/react-dom": "^18.0.6", + "@types/react-router-dom": "^5.1.7", + "@types/rebass": "^4.0.7", "@types/styled-components": "^5.1.25", - "prop-types": "^15.8.1", - "react-dom": "^18.2.0", - "storybook": "^7.0.12", - "typescript": "^5.0.4", - "vite": "^4.3.8", - "vitest": "^0.27.2", - "@testing-library/react": "^12.1.3", "@vanilla-extract/vite-plugin": "^3.8.0", "@vitejs/plugin-react": "4.0.0", - "@testing-library/jest-dom": "^5.11.6", "jest-environment-jsdom": "^29.3.1", "jest-styled-components": "^7.0.8", - "@types/react-router-dom": "^5.1.7", + "polished": "^3.3.2", + "prop-types": "^15.8.1", + "react-dom": "^18.2.0", "react-router-dom": "^5.2.0", + "storybook": "^7.0.12", "themeprovider-storybook": "^1.7.2", - "polished": "^3.3.2", - "@types/rebass": "^4.0.7" + "typescript": "^5.0.4", + "vite": "^4.3.8", + "vitest": "^0.27.2" }, "dependencies": { + "@real-wagmi/sdk": "^0.0.2", "@types/node": "^13.13.5", "@types/styled-system": "^5.1.15", "framer-motion": "10.11.2", "react": "^18.2.0", + "react-feather": "^2.0.8", + "rebass": "^4.0.7", "styled-components": "^5.3.5", "styled-system": "^5.1.5", "tslint": "^6.1.3", - "tslint-config-prettier": "^1.18.0", - "rebass": "^4.0.7", - "react-feather": "^2.0.8" + "tslint-config-prettier": "^1.18.0" }, "repository": "https://github.com/RealWagmi/uikit.git", "files": [ diff --git a/src/components/Charts/Terminal/constants.ts b/src/components/Charts/Terminal/constants.ts new file mode 100644 index 0000000..0d5b37b --- /dev/null +++ b/src/components/Charts/Terminal/constants.ts @@ -0,0 +1,6 @@ +import { SupportedChainId } from '@real-wagmi/sdk'; + +export const URLS = { + [SupportedChainId.ZK_SYNC]: (address: string) => `https://www.geckoterminal.com/zksync/pools/${address}?embed=1&info=0&swaps=0`, + [SupportedChainId.FANTOM]: (address: string) => `https://www.geckoterminal.com/ftm/pools/${address}?embed=1&info=0&swaps=0` +} \ No newline at end of file diff --git a/src/components/Charts/Terminal/index.tsx b/src/components/Charts/Terminal/index.tsx new file mode 100644 index 0000000..add4e2c --- /dev/null +++ b/src/components/Charts/Terminal/index.tsx @@ -0,0 +1,15 @@ +import { SupportedChainId } from '@real-wagmi/sdk'; +import { useMemo } from 'react'; +import { URLS } from './constants'; +import { ChartWrapper } from './styles'; + +interface IProps { + poolAddress: string; + chainId: SupportedChainId +} + +export function TerminalChart({ poolAddress, chainId }: IProps){ + const url = useMemo(() => URLS[chainId](poolAddress) ,[chainId]); + + return