Skip to content

Commit

Permalink
feat: Enhanced Dedaub support, automated workflows, fixed Ethereum ch…
Browse files Browse the repository at this point in the history
…ain restriction, and resolved website list issue
  • Loading branch information
0xbe37e committed Sep 8, 2023
1 parent 7e3e5a5 commit 103497f
Show file tree
Hide file tree
Showing 56 changed files with 756 additions and 357 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
### v3.6.0

- [feat] Improve MetaDock's Dedaub Support
- [build] Configure GitHub Actions for automated workflows
- [fix] Fix evm.storage to only support Ethereum chain
- [fix] Fix the issue of the supported website list becoming invalid in the settings

### v3.5.0

- [feat] Change logo
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ yarn

### Chrome and Firefox

- Build the project to the `/dist` folder with `yarn build:prod` or `yarn build-firefox:prod`.
- Build the project to the `/dist/*` folder with `yarn build:prod` or `yarn build-firefox:prod`.

```shell
# chrome
Expand All @@ -40,7 +40,7 @@ yarn build:prod
yarn build-firefox:prod
# safari
yarn build-safari:prod
xcrun safari-web-extension-converter --macos-only /path/to/metadock/dist
xcrun safari-web-extension-converter --macos-only /path/to/metadock/dist/safari-extension
```

- Optionally, you may run `yarn dev` to run dev mode.
Expand All @@ -57,7 +57,7 @@ To build the extension for distribution, or to run it locally for testing purpos
# step 1
yarn build-safari:prod
# step 2
xcrun safari-web-extension-converter --macos-only /path/to/metadock/dist
xcrun safari-web-extension-converter --macos-only /path/to/metadock/dist/safari-extension
```

For more information on building and debugging Safari extensions, see the [official documentation](https://developer.apple.com/documentation/safariservices/safari_web_extensions/).
Expand Down
6 changes: 4 additions & 2 deletions build/firefox.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,17 @@ function main() {
// Copy background.html to dist/
fs.cp(
path.join(__dirname, './', 'background.html'),
path.join(__dirname, '../dist', 'background.html'),
path.join(__dirname, '../dist/firefox-extension', 'background.html'),
err => {
if (err) throw err
}
)

// Smooth out the differences in the configuration file: chrome v3 => firefox v2
// TODO: Upgrade to firefox v3
defineFirefoxManifestV2(path.join(__dirname, '../dist', 'manifest.json'))
defineFirefoxManifestV2(
path.join(__dirname, '../dist/firefox-extension', 'manifest.json')
)
}

main()
6 changes: 4 additions & 2 deletions build/safari.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,17 @@ function main() {
// Copy background.html to dist/
fs.cp(
path.join(__dirname, './', 'background.html'),
path.join(__dirname, '../dist', 'background.html'),
path.join(__dirname, '../dist/safari-extension', 'background.html'),
err => {
if (err) throw err
}
)

// Smooth out the differences in the configuration file: chrome v3 => firefox v2
// TODO: Upgrade to firefox v3
defineSafariManifestV2(path.join(__dirname, '../dist', 'manifest.json'))
defineSafariManifestV2(
path.join(__dirname, '../dist/safari-extension', 'manifest.json')
)
}

main()
2 changes: 1 addition & 1 deletion manifest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ConfigEnv } from 'vite'
import { version } from './package.json'

export default defineManifest((env: ConfigEnv) => ({
name: 'MetaDock',
name: "MetaDock - Builders' Swiss Army Knife",
description:
'Improve the usability of blockchain explorers, including BTC.com, Etherscan, BscScan, and *scans of most EVM-compatible chains.',
version: version,
Expand Down
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
{
"name": "metadock",
"version": "3.5.0",
"version": "3.6.0",
"repository": {
"type": "git",
"url": "https://github.com/blocksecteam/metadock.git"
},
"type": "module",
"scripts": {
"dev": "vite --mode development",
"build:prod": "vite build --mode production",
"build:test": "vite build --mode test",
"build-firefox:prod": "yarn build:prod && node build/firefox.js",
"build-firefox:test": "yarn build:test && node build/firefox.js",
"build-safari:prod": "yarn build:prod && node build/safari.js",
"build-safari:test": "yarn build:test && node build/safari.js",
"build:prod": "vite build --mode production --outDir dist/chrome-extension",
"build:test": "vite build --mode test --outDir dist/chrome-extension",
"build-firefox:prod": "vite build --mode production --outDir dist/firefox-extension && node build/firefox.js",
"build-firefox:test": "vite build --mode test --outDir dist/firefox-extension && node build/firefox.js",
"build-safari:prod": "vite build --mode production --outDir dist/safari-extension && node build/safari.js",
"build-safari:test": "vite build --mode test --outDir dist/safari-extension && node build/safari.js",
"build:all": "yarn build:prod & yarn build-firefox:prod & yarn build-safari:prod",
"stylelint": "stylelint \"**/*.{css,scss,less}\"",
"stylelint:fix": "stylelint \"**/*.{css,scss,less}\" --fix",
"prepare": "husky install && husky set .husky/pre-commit \"npx lint-staged\" && husky set .husky/commit-msg 'npx --no -- commitlint --edit \"$1\"'",
Expand Down
Binary file removed src/assets/images/logo-circle.png
Binary file not shown.
Binary file removed src/assets/images/logo-pure.png
Binary file not shown.
52 changes: 31 additions & 21 deletions src/common/components/Cell/cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,41 @@ export interface CellProps extends BaseComponent {
}

const Cell: FC<CellProps> = props => {
const { title, desc, action, icon, border = true, pointer, onClick } = props
const {
className,
style,
title,
desc,
action,
icon,
border = true,
pointer,
onClick
} = props

return (
<div className={styles.container} onClick={onClick}>
<div
className={cls(styles.content, {
[styles.border]: border,
[styles.pointer]: pointer ? pointer : !action
})}
>
<div className="align-center">
{icon && <img className={styles.icon} src={icon} alt="" />}
<div className={styles.title}>
<span style={{ fontSize: desc ? '14px' : '12px' }}>{title}</span>
{desc && <span>{desc}</span>}
</div>
<div
className={cls(styles.container, className, {
[styles.border]: border,
[styles.pointer]: pointer ? pointer : action === undefined
})}
style={style}
onClick={onClick}
>
<div className="align-center flex1">
{icon && <img className={styles.icon} src={icon} alt="" />}
<div className={cls(styles.title, 'flex1')}>
<span style={{ fontSize: desc ? '14px' : '12px' }}>{title}</span>
{desc && <span>{desc}</span>}
</div>
{action ? (
<div className={styles.action}>{action}</div>
) : (
<div className={styles.iconContainer}>
<Iconfont type="icon-arrow-right" />
</div>
)}
</div>
{action !== undefined ? (
<div className={styles.action}>{action}</div>
) : (
<div className={styles.iconContainer}>
<Iconfont type="icon-arrow-right" />
</div>
)}
</div>
)
}
Expand Down
72 changes: 35 additions & 37 deletions src/common/components/Cell/index.module.less
Original file line number Diff line number Diff line change
@@ -1,44 +1,42 @@
@import '@common/styles/common.less';

.container {
.content {
padding: 12px 20px;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 12px;
line-height: 15px;
&.border {
border-bottom: 1px solid #f0f0f2;
}
&.pointer {
cursor: pointer;
}
.icon {
width: 40px;
height: 40px;
margin-right: 14px;
}
.title {
.flex-column;
span {
font-size: 14px;
&:nth-of-type(1) {
font-weight: 400;
color: #000000;
line-height: 17px;
}
&:nth-of-type(2) {
color: #747478;
line-height: 17px;
margin-top: 3px;
}
padding: 12px 20px;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 12px;
line-height: 15px;
&.border {
border-bottom: 1px solid #f0f0f2;
}
&.pointer {
cursor: pointer;
}
.icon {
width: 40px;
height: 40px;
margin-right: 14px;
}
.title {
.flex-column;
span {
font-size: 14px;
&:nth-of-type(1) {
font-weight: 400;
color: #000000;
line-height: 17px;
}
&:nth-of-type(2) {
color: #747478;
line-height: 17px;
margin-top: 3px;
}
}
.iconContainer {
width: 22px;
height: 22px;
.center;
}
}
.iconContainer {
width: 22px;
height: 22px;
.center;
}
}
5 changes: 3 additions & 2 deletions src/common/components/RarityLabel/index.module.less
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
div {
transform: translateY(-14px);
}
img {
.icon {
transform: translateY(0);
}
}
Expand All @@ -27,6 +27,7 @@
overflow: hidden;
position: relative;
margin-right: 3px;
.align-center;

div {
opacity: 1;
Expand All @@ -37,7 +38,7 @@
transition: transform 0.2s ease-out 0s, opacity 0.2s ease-out 0s;
.center;
}
img {
.icon {
height: 14px;
width: 14px;
position: absolute;
Expand Down
6 changes: 3 additions & 3 deletions src/common/components/RarityLabel/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { type FC } from 'react'
import { Tooltip, ConfigProvider } from 'antd'

import { getImageUrl, numFormatter } from '@common/utils'
import { numFormatter } from '@common/utils'
import type { NFTRarityRankResItem } from '@common/api/types'
import { IconArrow } from '@common/components'
import { IconArrow, IconMetaDock } from '@common/components'

import styles from './index.module.less'

Expand Down Expand Up @@ -46,7 +46,7 @@ const RarityLabel: FC<Props> = ({ data: { rank, total } }) => {
<div className={styles.container}>
<div className={styles.symbol}>
<div>#</div>
<img src={getImageUrl('logo-pure')} alt="" />
<IconMetaDock className={styles.icon} />
</div>
<span>{numFormatter(rank.toString())}</span>
</div>
Expand Down
15 changes: 7 additions & 8 deletions src/common/components/TokenSymbol/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { type FC } from 'react'

import { getImageUrl } from '@common/utils'
import type { BaseComponent } from '@common/types'
import { IconMetaDock } from '@common/components'

interface Props extends BaseComponent {
logo?: string
size?: number
mr?: number
ml?: number
color?: string
}

const TokenSymbol: FC<Props> = ({
color,
logo,
style = {},
size = 14,
Expand All @@ -29,13 +31,10 @@ const TokenSymbol: FC<Props> = ({
style
)

return (
<img
style={stylesheet}
className={className}
src={logo || getImageUrl('logo-circle')}
alt=""
/>
return logo ? (
<img style={stylesheet} className={className} src={logo} alt="" />
) : (
<IconMetaDock style={stylesheet} className={className} color={color} />
)
}

Expand Down
Loading

0 comments on commit 103497f

Please sign in to comment.