Skip to content

Commit

Permalink
chore: env variables fix and small ui package fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
AbhinavMV committed Jun 19, 2022
1 parent ae21889 commit 107f064
Show file tree
Hide file tree
Showing 13 changed files with 600 additions and 127 deletions.
2 changes: 0 additions & 2 deletions .env

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
**/*.tsbuildinfo
**/.DS_Store
.env
/storybook-static/
**/coverage
6 changes: 5 additions & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ module.exports = {
onlyFiles: true,
absolute: true,
}),
addons: ['@storybook/addon-links', '@storybook/addon-essentials'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'msw-storybook-addon',
],
framework: '@storybook/react',
staticDirs: ['../' + previewFolder],
typescript: {
Expand Down
File renamed without changes.
160 changes: 80 additions & 80 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,81 +1,81 @@
{
"name": "web3uikit",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"private": true,
"workspaces": [
"apps/*",
"packages/*"
],
"scripts": {
"build": "nx run-many --target=build --all --parallel --verbose=true",
"test": "nx affected --target=test --all --parallel --verbose=true",
"test:ui": "nx affected --target=test:ui --all --parallel --verbose=true",
"nm:clear": "find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +",
"nx:clear": "nx clear-cache",
"nx:graph": "nx graph --skip-nx-cache",
"start:dev": "nx run-many --target=start:dev --all --parallel --verbose=true",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook",
"analyze": "nx run example:analyze",
"icons:create": "nx run-many --target=icons:create --all --parallel --verbose=true",
"new": "plop"
},
"dependencies": {
"@babel/core": "^7.18.2",
"@jscutlery/semver": "^2.22.0",
"@nrwl/workspace": "^14.1.4",
"dotenv": "^16.0.1",
"nx": "^14.1.4",
"tslib": "^2.3.0"
},
"devDependencies": {
"@mdx-js/react": "^2.1.1",
"@nrwl/eslint-plugin-nx": "14.1.5",
"@nrwl/jest": "14.1.9",
"@nrwl/js": "14.1.9",
"@nrwl/linter": "14.1.5",
"@storybook/addon-essentials": "^6.4.22",
"@storybook/addon-links": "^6.4.22",
"@storybook/builder-vite": "^0.1.36",
"@storybook/react": "^6.4.22",
"@storybook/testing-react": "^1.2.4",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.2.0",
"@types/jest": "^27.5.1",
"@types/node": "^17.0.26",
"@types/react": "^18.0.6",
"@types/react-dom": "^18.0.2",
"@types/styled-components": "^5.1.25",
"@typescript-eslint/eslint-plugin": "~5.18.0",
"@typescript-eslint/parser": "~5.18.0",
"@vitejs/plugin-react": "^1.3.2",
"@vitest/ui": "^0.15.1",
"eslint": "~8.12.0",
"eslint-config-prettier": "8.1.0",
"fast-glob": "^3.2.11",
"jest": "^28.1.0",
"jest-styled-components": "^7.0.8",
"msw": "^0.42.1",
"msw-storybook-addon": "^1.6.3",
"plop": "^3.1.1",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-lazily": "^0.9.1",
"rollup-plugin-dts": "^4.2.1",
"rollup-plugin-node-builtins": "^2.1.2",
"storybook": "^6.5.8",
"styled-components": "^5.3.5",
"ts-jest": "27.1.4",
"ts-node": "9.1.1",
"typescript": "^4.6.3",
"vite": "^2.9.5",
"vite-plugin-dts": "^1.1.1",
"vite-tsconfig-paths": "^3.4.1",
"vitest": "^0.15.1"
},
"msw": {
"workerDirectory": "public"
}
}
"name": "web3uikit",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"private": true,
"workspaces": [
"apps/*",
"packages/*"
],
"scripts": {
"build": "nx run-many --target=build --all --parallel --verbose=true",
"test": "nx affected --target=test --all --parallel --verbose=true",
"test:ui": "nx affected --target=test:ui --all --parallel --verbose=true",
"nm:clear": "find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +",
"nx:clear": "nx clear-cache",
"nx:graph": "nx graph --skip-nx-cache",
"start:dev": "nx run-many --target=start:dev --all --parallel --verbose=true",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook",
"analyze": "nx run example:analyze",
"icons:create": "nx run-many --target=icons:create --all --parallel --verbose=true",
"new": "plop"
},
"dependencies": {
"@babel/core": "^7.18.2",
"@jscutlery/semver": "^2.22.0",
"@nrwl/workspace": "^14.1.4",
"dotenv": "^16.0.1",
"nx": "^14.1.4",
"tslib": "^2.3.0"
},
"devDependencies": {
"@mdx-js/react": "^2.1.1",
"@nrwl/eslint-plugin-nx": "14.1.5",
"@nrwl/jest": "14.1.9",
"@nrwl/js": "14.1.9",
"@nrwl/linter": "14.1.5",
"@storybook/addon-essentials": "^6.4.22",
"@storybook/addon-links": "^6.4.22",
"@storybook/builder-vite": "^0.1.36",
"@storybook/react": "^6.4.22",
"@storybook/testing-react": "^1.2.4",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.2.0",
"@types/jest": "^27.5.1",
"@types/node": "^17.0.26",
"@types/react": "^18.0.6",
"@types/react-dom": "^18.0.2",
"@types/styled-components": "^5.1.25",
"@typescript-eslint/eslint-plugin": "~5.18.0",
"@typescript-eslint/parser": "~5.18.0",
"@vitejs/plugin-react": "^1.3.2",
"@vitest/ui": "^0.15.1",
"eslint": "~8.12.0",
"eslint-config-prettier": "8.1.0",
"fast-glob": "^3.2.11",
"jest": "^28.1.0",
"jest-styled-components": "^7.0.8",
"msw": "^0.42.1",
"msw-storybook-addon": "^1.6.3",
"plop": "^3.1.1",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-lazily": "^0.9.1",
"rollup-plugin-dts": "^4.2.1",
"rollup-plugin-node-builtins": "^2.1.2",
"storybook": "^6.5.8",
"styled-components": "^5.3.5",
"ts-jest": "27.1.4",
"ts-node": "9.1.1",
"typescript": "^4.6.3",
"vite": "^2.9.5",
"vite-plugin-dts": "^1.1.1",
"vite-tsconfig-paths": "^3.4.1",
"vitest": "^0.15.1"
},
"msw": {
"workerDirectory": "public"
}
}
2 changes: 1 addition & 1 deletion packages/core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"compilerOptions": {
"rootDir": "src"
},
"include": ["src", "../styles/src/lib/rgbToHex.ts"]
"include": ["src"]
}
4 changes: 3 additions & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
"react-blockies": "^1.4.1",
"react-moralis": "^1.3.5",
"moralis": "^1.8.0",
"@walletconnect/web3-provider": "^1.7.8"
"@walletconnect/web3-provider": "^1.7.8",
"@moralisweb3/evm-wallet-connect-connector": "2.0.0-alpha.1",
"@moralisweb3/evm-api": "2.0.0-alpha.1"
}
}
78 changes: 42 additions & 36 deletions packages/ui/src/lib/NFT/NFT.fetched.tsx
Original file line number Diff line number Diff line change
@@ -1,45 +1,51 @@
import React, { useState } from "react";
import { Button, Typography } from "@web3uikit/core";
import NFTStyles from "./NFT.styles";
import NFTUtils from "./NFT.utils";
import { TNFTMetadata } from "./types";
import { color } from "@web3uikit/styles";
import NFTModal from "./NFT.modal";
import React, { useState } from 'react';
import { Button, Typography } from '@web3uikit/core';
import NFTStyles from './NFT.styles';
import NFTUtils from './NFT.utils';
import { TNFTMetadata } from './types';
import { color } from '@web3uikit/styles';
import NFTModal from './NFT.modal';
import { Info } from '@web3uikit/icons';

const { DivStyled } = NFTStyles;
const { image } = NFTUtils;

const FetchedNFT: React.FC<{
metadata?: TNFTMetadata;
name?: string;
metadata?: TNFTMetadata;
name?: string;
}> = ({ metadata, name }) => {
const [showModal, setShowModal] = useState(false);
return (
<DivStyled id="nft">
{image(metadata?.animation_url, metadata?.image || metadata?.image_url)}
<div id="nft-info">
<div>
<Typography variant="body16">{metadata?.name || name}</Typography>
<Typography variant="caption12">ERC721</Typography>
</div>
</div>
<div id="nft-footer">
<Button
icon="info"
isTransparent
iconColor={color.grey}
iconLayout="icon-only"
onClick={() => setShowModal(true)}
/>
{showModal && (
<NFTModal
attributes={metadata?.traits || metadata?.attributes}
setShowModal={setShowModal}
/>
)}
</div>
</DivStyled>
);
const [showModal, setShowModal] = useState(false);
return (
<DivStyled id="nft">
{image(
metadata?.animation_url,
metadata?.image || metadata?.image_url,
)}
<div id="nft-info">
<div>
<Typography variant="body16">
{metadata?.name || name}
</Typography>
<Typography variant="caption12">ERC721</Typography>
</div>
</div>
<div id="nft-footer">
<Button
icon={<Info fontSize={20} />}
isTransparent
iconColor={color.grey}
iconLayout="icon-only"
onClick={() => setShowModal(true)}
/>
{showModal && (
<NFTModal
attributes={metadata?.traits || metadata?.attributes}
setShowModal={setShowModal}
/>
)}
</div>
</DivStyled>
);
};

export default FetchedNFT;
2 changes: 1 addition & 1 deletion packages/ui/src/lib/NFT/NFT.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const NFT: React.FC<INFTProps> = ({
</div>
<div id="nft-footer">
<Button
icon={<Info fill={color.grey} />}
icon={<Info fill={color.grey} fontSize={20} />}
isTransparent
iconColor={color.grey}
iconLayout="icon-only"
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/src/lib/NFTBalance/NFTBalance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { NFT } from '../NFT';
import styles from './NFTBalance.styles';
import { Button, Typography, Skeleton } from '@web3uikit/core';
import { INFTBalance } from './types';
import { ChevronDown } from '@web3uikit/icons';
const { DivStyled, DivFlexStyled } = styles;

const NFTBalance: React.FC<INFTBalance> = ({ address, chain, ...props }) => {
Expand Down Expand Up @@ -103,7 +104,7 @@ const NFTBalance: React.FC<INFTBalance> = ({ address, chain, ...props }) => {
{data.result.length > limit && (
<Button
text="Show more"
icon="chevronDown"
icon={<ChevronDown fontSize={10} />}
iconLayout="trailing"
theme="translucent"
onClick={() => setLimit(limit + 5)}
Expand Down
7 changes: 3 additions & 4 deletions packages/ui/src/web3utils/decorators.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React, { useEffect } from 'react';
import { useEffect } from 'react';
import { MoralisProvider, useMoralis } from 'react-moralis';
import { DecoratorFn } from '@storybook/react';
import { default as MoralisType } from 'moralis/types';

export const moralisContext: DecoratorFn = (Story) => {
const MORALIS_APP_ID = 'Ee6dXw6BMrIwvZCToiliDH2qZaIipi1RIN2ODI3v';
const MORALIS_SERVER_URL =
'https://inlxtebatbqn.usemoralis.com:2053/server';
const MORALIS_APP_ID = import.meta.env.STORYBOOK_MORALIS_APPLICATION_ID;
const MORALIS_SERVER_URL = import.meta.env.STORYBOOK_MORALIS_SERVER_URL;

const Web3Initialize = () => {
const {
Expand Down
Loading

0 comments on commit 107f064

Please sign in to comment.