Skip to content

Commit

Permalink
Merge origin/develop into upgrade-lumos
Browse files Browse the repository at this point in the history
  • Loading branch information
homura committed Jun 21, 2023
2 parents ac3cb25 + ad5450e commit 3b9a06e
Show file tree
Hide file tree
Showing 326 changed files with 16,197 additions and 13,694 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/package_for_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

name: ${{ matrix.os }}(Node.js ${{ matrix.node }})
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
MAC_SHOULD_CODE_SIGN: ${{ github.event_name != 'pull_request' && secrets.APPLE_ID != '' }}
WIN_CERTIFICATE_BASE64: ${{ secrets.WIN_CERTIFICATE_BASE64 }}

steps:
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
CI: false

- name: Package for MacOS
if: ${{ matrix.os == 'macos-latest' && env.APPLE_ID != '' }}
if: ${{ matrix.os == 'macos-latest' && env.MAC_SHOULD_CODE_SIGN == 'true' }}
run: |
./scripts/download-ckb.sh mac
yarn package:test mac
Expand All @@ -79,10 +79,9 @@ jobs:
CSC_KEY_PASSWORD: ${{ secrets.MAC_CERTIFICATE_PASSWORD }}

- name: Package for MacOS for skip code sign
if: ${{ matrix.os == 'macos-latest' && env.APPLE_ID == '' }}
if: ${{ matrix.os == 'macos-latest' && env.MAC_SHOULD_CODE_SIGN == 'false' }}
run: |
export CSC_IDENTITY_AUTO_DISCOVERY=false
unset APPLE_ID
./scripts/download-ckb.sh mac
yarn package:test mac
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
path: |
node_modules
*/*/node_modules
key: 2022-05-07-${{ runner.os }}-${{ hashFiles('**/yarn.lock')}}
key: 2022-10-11-${{ runner.os }}-${{ hashFiles('**/yarn.lock')}}

- name: Install libudev
if: matrix.os == 'ubuntu-20.04'
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
"typescriptreact"
],
"typescript.tsdk": "node_modules/typescript/lib"
}
}
6 changes: 6 additions & 0 deletions packages/neuron-ui/.storybook/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"presets": [
"@babel/preset-env",
"@babel/preset-typescript"
]
}
4 changes: 0 additions & 4 deletions packages/neuron-ui/.storybook/addons.js

This file was deleted.

9 changes: 0 additions & 9 deletions packages/neuron-ui/.storybook/config.js

This file was deleted.

21 changes: 21 additions & 0 deletions packages/neuron-ui/.storybook/electron.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const sendSyncValues = {
'get-locale': 'zh',
'get-version': '0.103.1'
}

module.exports = {
ipcRenderer: {
sendSync(key) {
return sendSyncValues[key]
},
invoke() {
return Promise.resolve({})
},
on() {},
removeAllListeners() {}
},
clipboard() {},
nativeImage() {},
shell() {},
desktopCapturer() {}
}
11 changes: 0 additions & 11 deletions packages/neuron-ui/.storybook/main.js

This file was deleted.

21 changes: 21 additions & 0 deletions packages/neuron-ui/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export default {
"stories": ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
"addons": [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
"@storybook/preset-create-react-app",
"storybook-addon-react-router-v6"
],
"framework": "@storybook/react",
core: {
builder: "webpack5"
},
webpackFinal: config => {
config.resolve.alias = {
...config.resolve.alias,
electron: require.resolve('./electron')
}
return config
},
}
39 changes: 39 additions & 0 deletions packages/neuron-ui/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import 'theme'
import 'styles/index.scss'
import 'styles/layout.scss'
import 'styles/theme.scss'
import 'utils/i18n'
import 'stories/styles.scss'
import React from 'react'
import { action } from '@storybook/addon-actions'
import { NeuronWalletContext, initStates } from '../src/states'

export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
}
}

const dispatch = action('Dispatch')

BigInt.prototype['toJSON'] = function() { return this.toString() }

export const decorators = [
(Story, { argTypes, args }) => {
const globalArgTypes = Object.keys(argTypes).filter(v => argTypes[v]?.isGlobal)
const globalStates = globalArgTypes.reduce((pre, cur) => args[cur] ? ({
...pre,
[cur]: args[cur]
}) : pre, initStates)
return (
<NeuronWalletContext.Provider value={{ state: globalStates, dispatch }}>
<Story />
</NeuronWalletContext.Provider>
)
},
];

40 changes: 24 additions & 16 deletions packages/neuron-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@
"registry": "https://registry.npmjs.org/"
},
"lint-staged": {
"src/**/*.{ts,tsx}": [
"src/**/*.{js,cjs,mjs,jsx,ts,tsx}": [
"prettier --write",
"eslint --fix",
"git add"
],
"src/**/*.{css,scss}": [
"prettier --write",
"git add"
]
},
"jest": {
Expand All @@ -42,8 +47,6 @@
"dependencies": {
"@nervosnetwork/ckb-sdk-core": "0.107.0",
"@nervosnetwork/ckb-sdk-utils": "0.107.0",
"@uifabric/experiments": "7.45.14",
"@uifabric/styling": "7.25.1",
"canvg": "2.0.0",
"i18next": "21.10.0",
"immer": "9.0.21",
Expand All @@ -53,31 +56,35 @@
"react": "17.0.2",
"react-dom": "17.0.2",
"react-i18next": "12.1.5",
"react-router-dom": "5.1.2",
"react-router-dom": "6.4.1",
"react-transition-group": "4.4.5",
"sass": "1.62.0"
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "7.21.0",
"@storybook/addon-actions": "5.3.18",
"@storybook/addon-knobs": "5.3.21",
"@storybook/addon-links": "5.3.18",
"@storybook/addon-storyshots": "5.3.18",
"@storybook/addon-viewport": "5.3.18",
"@storybook/addons": "5.3.18",
"@storybook/cli": "5.3.18",
"@storybook/react": "5.3.18",
"@babel/preset-typescript": "7.18.6",
"@storybook/addon-actions": "6.5.12",
"@storybook/addon-essentials": "6.5.12",
"@storybook/addon-interactions": "6.5.12",
"@storybook/addon-links": "6.5.12",
"@storybook/builder-webpack4": "6.5.12",
"@storybook/builder-webpack5": "6.5.12",
"@storybook/manager-webpack4": "6.5.12",
"@storybook/manager-webpack5": "6.5.12",
"@storybook/node-logger": "6.5.12",
"@storybook/preset-create-react-app": "4.1.2",
"@storybook/react": "6.5.12",
"@storybook/testing-library": "0.0.13",
"@types/enzyme": "3.10.12",
"@types/enzyme-adapter-react-16": "1.0.6",
"@types/node": "18.15.11",
"@types/react": "17.0.58",
"@types/react-dom": "17.0.19",
"@types/react-router-dom": "5.3.3",
"@types/storybook-react-router": "1.0.1",
"@types/storybook__addon-storyshots": "5.1.2",
"@types/styled-components": "5.1.26",
"@wojtekmaj/enzyme-adapter-react-17": "0.8.0",
"babel-jest": "25.5.1",
"electron": "24.1.1",
"electron": "24.5.1",
"enzyme": "3.11.0",
"enzyme-adapter-react-16": "1.15.7",
"eslint-config-airbnb": "19.0.4",
Expand All @@ -88,7 +95,8 @@
"react-app-rewired": "2.2.1",
"react-scripts": "5.0.1",
"react-test-renderer": "16.14.0",
"storybook-react-router": "1.0.8"
"storybook-addon-react-router-v6": "0.2.1",
"webpack": "5.74.0"
},
"resolutions": {
"react-i18next": "12.1.5"
Expand Down
30 changes: 30 additions & 0 deletions packages/neuron-ui/public/css/fonts.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,33 @@
font-family: 'SourceCodePro-Regular';
src: url('../fonts/SourceCodePro-Regular.ttf') format('truetype');
}

@font-face {
font-family: 'ProximaNova-Regular';
src: url('../fonts/ProximaNova-Regular.otf') format('opentype'),
url('../fonts//Proximanova-Regular.ttf') format('opentype');
}

@font-face {
font-family: 'ProximaNova-Semibold';
src: url('../fonts/ProximaNova-Semibold.otf') format('opentype'),
url('../fonts/ProximaNova-Semibold.ttf') format('opentype');
}

@font-face {
font-family: 'D-DIN-PRO';
src: url('../fonts/D-DIN-PRO-500-Medium.otf') format('opentype'),
url('../fonts/D-DIN-PRO-500-Medium.ttf') format('opentype');
}

@font-face {
font-family: 'JetBrains Mono Medium';
src: url('../fonts/JetBrainsMonoNL-Medium.otf') format('opentype'),
url('../fonts/JetBrainsMonoNL-Medium.ttf') format('opentype');
}

@font-face {
font-family: 'JetBrains Mono';
src: url('../fonts/JetBrainsMonoNL-Regular.otf') format('opentype'),
url('../fonts/JetBrainsMonoNL-Regular.ttf') format('opentype');
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
8 changes: 4 additions & 4 deletions packages/neuron-ui/src/components/Addresses/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useCallback } from 'react'
import { clipboard } from 'electron'
import { useHistory } from 'react-router-dom'
import { useNavigate } from 'react-router-dom'
import { useTranslation } from 'react-i18next'
import { ReactComponent as Edit } from 'widgets/Icons/Edit.svg'
import TextField from 'widgets/TextField'
Expand Down Expand Up @@ -30,7 +30,7 @@ const Addresses = () => {
} = useGlobalState()
const dispatch = useDispatch()
const [t] = useTranslation()
const history = useHistory()
const navigate = useNavigate()

const isMainnet = isMainnetUtil(networks, networkID)
const breakcrum = [{ label: t('navbar.receive'), link: RoutePath.Receive }]
Expand All @@ -57,7 +57,7 @@ const Addresses = () => {
{
label: t('addresses.request-payment'),
click: () => {
history.push(`${RoutePath.Receive}/${item.address}`)
navigate(`${RoutePath.Receive}/${item.address}`)
},
},
{
Expand All @@ -71,7 +71,7 @@ const Addresses = () => {
openContextMenu(menuTemplate)
}
},
[t, isMainnet, history]
[t, isMainnet, navigate]
)

return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,55 +1,10 @@
$arrow: 10px;
@import '../../styles/animation.scss';

.container {
display: inline;
position: relative;
font-size: 0.75rem;
color: var(--nervos-green);
border-radius: 2px;
z-index: 1;
.confirm {
@include infinite-rotation;
margin-left: 4px;

svg {
width: 1rem;
height: 0.75rem;
pointer-events: none;
position: relative;
top: 1px;
}

&::after {
display: none;
content: attr(data-content);
position: absolute;
top: calc(100% + 7px);
left: 50%;
transform: translateX(-50%);
background: #fff;
font-size: 0.75rem;
color: #000000;
padding: 10px 15px;
box-shadow: 0 0 6px rgba(0, 0, 0, 0.22);
min-width: 150px;
pointer-events: none;
}

&::before {
z-index: 1;
display: none;
content: '';
top: 2px;
left: 50%;
transform: translateX(-50%);
position: absolute;
border: $arrow solid transparent;
border-bottom-color: #fff;
filter: drop-shadow(0 -2px 1px rgba(0, 0, 0, 0.12));
pointer-events: none;
}

&:hover {
&::after,
&::before {
display: block;
}
path {
fill: #FFFFFF;
}
}
Loading

0 comments on commit 3b9a06e

Please sign in to comment.