From 1b54a88d8bbcb3adf0ab217df54a0e95440ef17b Mon Sep 17 00:00:00 2001 From: constwz Date: Fri, 20 Oct 2023 14:05:16 +0800 Subject: [PATCH 1/2] feat:ui fix --- package.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index df405b87db..32399fc868 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,6 @@ "name": "safe-wallet-web", "homepage": "https://github.com/safe-global/safe-wallet-web", "license": "GPL-3.0", - "type": "module", "version": "1.19.1", "scripts": { "dev": "next dev", @@ -19,7 +18,7 @@ "routes": "node scripts/generate-routes.js > src/config/routes.ts && prettier -w src/config/routes.ts && cat src/config/routes.ts", "css-vars": "ts-node-esm ./scripts/css-vars.ts > ./src/styles/vars.css && prettier -w src/styles/vars.css", "generate-types": "typechain --target ethers-v5 --out-dir src/types/contracts ./node_modules/@safe-global/safe-deployments/dist/assets/**/*.json ./node_modules/@safe-global/safe-modules-deployments/dist/assets/**/*.json ./node_modules/@openzeppelin/contracts/build/contracts/ERC20.json ./node_modules/@openzeppelin/contracts/build/contracts/ERC721.json", - "after-install": "yarn patch-package && yarn generate-types && yarn css-vars", + "after-install": "yarn patch-package && yarn generate-types", "postinstall": "yarn after-install", "analyze": "cross-env ANALYZE=true yarn build", "cypress:open": "cross-env TZ=UTC cypress open --e2e", @@ -133,5 +132,10 @@ "typescript": "4.9.4", "typescript-plugin-css-modules": "^4.2.2", "webpack": "^5.88.2" + }, + "tsconfig": { + "compilerOptions": { + "esModuleInterop": true + } } } \ No newline at end of file From f7ba683d2b3cf8cdf43ab9aa8cb6ef7c8254f70b Mon Sep 17 00:00:00 2001 From: constwz Date: Wed, 25 Oct 2023 13:39:18 +0800 Subject: [PATCH 2/2] fix:icon --- package.json | 8 ++------ src/components/common/TokenIcon/index.tsx | 17 ++++++++++++++++- src/hooks/useChainId.ts | 2 +- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 32399fc868..df405b87db 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "safe-wallet-web", "homepage": "https://github.com/safe-global/safe-wallet-web", "license": "GPL-3.0", + "type": "module", "version": "1.19.1", "scripts": { "dev": "next dev", @@ -18,7 +19,7 @@ "routes": "node scripts/generate-routes.js > src/config/routes.ts && prettier -w src/config/routes.ts && cat src/config/routes.ts", "css-vars": "ts-node-esm ./scripts/css-vars.ts > ./src/styles/vars.css && prettier -w src/styles/vars.css", "generate-types": "typechain --target ethers-v5 --out-dir src/types/contracts ./node_modules/@safe-global/safe-deployments/dist/assets/**/*.json ./node_modules/@safe-global/safe-modules-deployments/dist/assets/**/*.json ./node_modules/@openzeppelin/contracts/build/contracts/ERC20.json ./node_modules/@openzeppelin/contracts/build/contracts/ERC721.json", - "after-install": "yarn patch-package && yarn generate-types", + "after-install": "yarn patch-package && yarn generate-types && yarn css-vars", "postinstall": "yarn after-install", "analyze": "cross-env ANALYZE=true yarn build", "cypress:open": "cross-env TZ=UTC cypress open --e2e", @@ -132,10 +133,5 @@ "typescript": "4.9.4", "typescript-plugin-css-modules": "^4.2.2", "webpack": "^5.88.2" - }, - "tsconfig": { - "compilerOptions": { - "esModuleInterop": true - } } } \ No newline at end of file diff --git a/src/components/common/TokenIcon/index.tsx b/src/components/common/TokenIcon/index.tsx index a3a64d80ae..d7df8e4225 100644 --- a/src/components/common/TokenIcon/index.tsx +++ b/src/components/common/TokenIcon/index.tsx @@ -4,6 +4,16 @@ import css from './styles.module.css' const FALLBACK_ICON = '/images/common/token-placeholder.svg' +const CUSTOM_LOGO_MAP: Record = { + BNB: `https://www.bnbchainlist.org/static/images/rsz_bnb.svg`, + TCBNB: `https://www.bnbchainlist.org/static/images/rsz_bnb.svg`, + BTC: `https://raw.githubusercontent.com/bnb-chain/opbnb-bridge-tokens/main/data/BTCB/logo.svg`, + BTCB: `https://raw.githubusercontent.com/bnb-chain/opbnb-bridge-tokens/main/data/BTCB/logo.svg`, + USDT: `https://raw.githubusercontent.com/bnb-chain/opbnb-bridge-tokens/main/data/USDT/logo.svg`, + FDUSD: `https://raw.githubusercontent.com/bnb-chain/opbnb-bridge-tokens/main/data/FDUSD/logo.jpeg`, + ETH: `https://raw.githubusercontent.com/bnb-chain/opbnb-bridge-tokens/main/data/ETH/logo.svg`, +} + const TokenIcon = ({ logoUri, tokenSymbol, @@ -15,9 +25,14 @@ const TokenIcon = ({ size?: number fallbackSrc?: string }): ReactElement => { + let logoURL = logoUri + if (tokenSymbol && CUSTOM_LOGO_MAP[tokenSymbol]) { + logoURL = CUSTOM_LOGO_MAP[tokenSymbol] + } + return ( { const walletChainId = wallet?.chainId && configs.some(({ chainId }) => chainId === wallet.chainId) ? wallet.chainId : undefined - return urlChainId || walletChainId || session.lastChainId || defaultChainId + return defaultChainId || urlChainId || walletChainId || session.lastChainId } export default useChainId