Skip to content

Commit

Permalink
Merge branch 'develop' into fix-offline
Browse files Browse the repository at this point in the history
  • Loading branch information
devchenyan committed Jul 21, 2023
2 parents a4c849e + b4f9a26 commit 85c646d
Show file tree
Hide file tree
Showing 32 changed files with 474 additions and 277 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-code-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
id: changed-files
uses: tj-actions/changed-files@v37
with:
files: "**/*.{js,cjs,mjs,jsx,ts,tsx,css,scss}"
files: "packages/**/*.{js,cjs,mjs,jsx,ts,tsx,css,scss}"

- name: Prettier Check
if: steps.changed-files.outputs.any_changed == 'true'
Expand Down
29 changes: 2 additions & 27 deletions .github/workflows/package_for_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,8 @@ on:
push:

jobs:
check_command:
runs-on: ubuntu-latest
## skip if trigger by issue comment but not pr comment
if: ${{ (github.event_name == 'issue_comment' && github.event.issue.pull_request) || github.event_name == 'push' }}
permissions:
pull-requests: write
steps:
- name: Check for package command
uses: xt0rted/slash-command-action@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
command: package
reaction: "true"
reaction-type: "eyes"
allow-edits: "true"
permission-level: write

packaging:
needs: [check_command]
if: ${{ (github.event_name == 'issue_comment' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/package')) || github.event_name == 'push' }}

strategy:
matrix:
Expand Down Expand Up @@ -53,19 +36,11 @@ jobs:
uses: actions/checkout@v3
if: ${{ github.event_name == 'push' }}

- name: Get PR Branch
if: github.event_name == 'issue_comment'
id: comment-branch
uses: yanguoyu/[email protected]
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout for PR
uses: actions/checkout@v3
if: ${{ github.event_name == 'issue_comment' }}
with:
repository: ${{ steps.comment-branch.outputs.head_owner }}/${{ steps.comment-branch.outputs.head_repo }}
ref: ${{ steps.comment-branch.outputs.head_ref }}
ref: refs/pull/${{ github.event.issue.number }}/merge

- name: Setup Node
uses: actions/setup-node@v3
Expand Down
87 changes: 87 additions & 0 deletions .github/workflows/update_valid_target.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Update ckb node assume valid target

on:
pull_request:
types: [ready_for_review]
branches:
- master

jobs:
ready-for-release:
name: Update ckb node assume valid target
runs-on: ubuntu-latest
steps:
- name: Create Branch
uses: peterjgrainger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: 'chore-update-valid-target/${{github.head_ref}}'
sha: '${{ github.event.pull_request.head.sha }}'

- name: Checkout
uses: actions/checkout@v3
with:
ref: 'chore-update-valid-target/${{github.head_ref}}'

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.12.0

- name: Write env file
run: |
npm run update:valid-target
- name: Commit env file
uses: actions/github-script@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BASE: ${{ github.head_ref }}
with:
script: |
const fs = require('node:fs')
const { BASE, HEAD } = process.env
const envFilePath = 'packages/neuron-wallet/.env'
const destinationBranch = `chore-update-valid-target/${BASE}`
const { data } = await github.rest.repos.getContent({
owner: context.repo.owner,
repo: context.repo.repo,
path: envFilePath,
ref: destinationBranch,
})
await github.rest.repos.createOrUpdateFileContents({
owner: context.repo.owner,
repo: context.repo.repo,
path: envFilePath,
message: `chore: Update ckb node assume valid target for ${BASE}.`,
content: fs.readFileSync(envFilePath).toString('base64'),
sha: data.sha,
branch: destinationBranch,
})
- name: Create PR
uses: actions/github-script@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BASE: ${{github.head_ref}}
HEAD: chore-update-valid-target/${{github.head_ref}}
REPO: ${{github.repository}}
with:
script: |
const { BASE, HEAD, REPO } = process.env
const { data: pulls } = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
})
if (pulls.some(pull => pull.head.ref === HEAD)) {
return
}
github.rest.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
head: HEAD,
base: BASE,
title: 'chore: Update ckb node assume valid target',
body: `This PR uses to update ckb node assume valid target for PR https://github.com/${REPO}/pull/${context.issue.number}`,
})
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"test:ci": "yarn build:main && yarn test",
"lint": "lerna run --stream lint",
"postinstall": "husky install",
"db:chain": "node ./node_modules/.bin/typeorm"
"db:chain": "node ./node_modules/.bin/typeorm",
"update:valid-target": "node ./scripts/update-valid-target.js"
},
"devDependencies": {
"@babel/core": "7.22.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ import LockInfoDialog from 'components/LockInfoDialog'
import { useState as useGlobalState } from 'states'
import styles from './cellsCard.module.scss'

const TabsVariantWithCellsCard: FC<VariantProps<{
title: string
cells: (State.DetailedInput | State.DetailedOutput)[]
}>> = ({ tabs, selectedTab, onTabChange }) => {
const TabsVariantWithCellsCard: FC<
VariantProps<{
title: string
cells: (State.DetailedInput | State.DetailedOutput)[]
}>
> = ({ tabs, selectedTab, onTabChange }) => {
const [t] = useTranslation()
const {
chain: { networkID },
Expand Down
10 changes: 6 additions & 4 deletions packages/neuron-ui/src/components/NervosDAODetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ import styles from './nervosDAODetail.module.scss'
import hooks from './hooks'
import CellsCard from './CellsCard'

const TabsVariantWithTxTypes: FC<VariantProps<{
title: string
hash: string
}>> = ({ tabs, selectedTab, onTabChange }) => {
const TabsVariantWithTxTypes: FC<
VariantProps<{
title: string
hash: string
}>
> = ({ tabs, selectedTab, onTabChange }) => {
const [t] = useTranslation()
const [transaction, setTransaction] = useState(transactionState)
const [error, setError] = useState<string>()
Expand Down
31 changes: 18 additions & 13 deletions packages/neuron-ui/src/components/PricePanel/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-console */
import React, { useCallback, useEffect, useMemo, useState } from 'react'
import { localNumberFormatter, shannonToCKBFormatter } from 'utils'
import RingProgressBar from 'widgets/RingProgressBar'
Expand All @@ -10,6 +9,7 @@ import { useTranslation } from 'react-i18next'
import { appState, useState as useGlobalState } from 'states'
import { FeeRateValueArrayItemType, useGetBatchGeneratedTx } from 'components/Send/hooks'
import { batchGenerateExperimental } from 'components/SUDTSend/hooks'
import Tooltip from 'widgets/Tooltip'

import styles from './pricePanel.module.scss'

Expand Down Expand Up @@ -144,19 +144,24 @@ const PricePanel: React.FunctionComponent<PricePanelProps> = ({
<label htmlFor={field} aria-label={label} title={label}>
{label}
</label>
<button
data-content={isStandard ? t('price-switch.switchToCustomPrice') : t('price-switch.switchToPrice')}
className={styles.transferWrap}
onClick={() =>
setType(currentType =>
currentType === PriceTypeEnum.Standard ? PriceTypeEnum.Custom : PriceTypeEnum.Standard
)
}
onKeyDown={() => {}}
type="button"
<Tooltip
tip={<>{isStandard ? t('price-switch.switchToCustomPrice') : t('price-switch.switchToPrice')}</>}
placement="top"
showTriangle
>
<Change />
</button>
<button
className={styles.transferWrap}
onClick={() =>
setType(currentType =>
currentType === PriceTypeEnum.Standard ? PriceTypeEnum.Custom : PriceTypeEnum.Standard
)
}
onKeyDown={() => {}}
type="button"
>
<Change />
</button>
</Tooltip>
</div>
{isStandard ? (
<div className={styles.timeoutWrap}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

.transferSwitch {
display: flex;
align-items: center;
color: var(--secondary-text-color);
}
}
Expand All @@ -29,46 +30,18 @@
svg > path {
fill: var(--primary-color);
}

&::after {
position: absolute;
display: inline-block;
left: 50%;
transform: translate(-50%, -99%);
padding: 12px;
border-radius: 8px;
overflow-wrap: break-word;
background-color: var(--tooltip-background-color);
color: var(--tooltip-font-color);
user-select: text;
white-space: nowrap;
text-align: center;
content: attr(data-content);
}
&::before {
content: '';
user-select: text;
border-width: 9px;
border-style: solid;
border-color: transparent;
display: inline-block;
border-top-color: var(--tooltip-background-color);
transform: translate(-50%, -70%);
left: 50%;
position: absolute;
}
}
}

.dropdownBox {
margin: 4px 0px 19px 0px;
--tag-red-bg-color: #FFE8E8;
--tag-green-bg-color: #EFFAF7;
--tag-blue-bg-color: #E8FAFF;
--tag-red-bg-color: #ffe8e8;
--tag-green-bg-color: #effaf7;
--tag-blue-bg-color: #e8faff;
@media (prefers-color-scheme: dark) {
--tag-red-bg-color: #322929;
--tag-green-bg-color: #2E3735;
--tag-blue-bg-color: #2D3638;
--tag-green-bg-color: #2e3735;
--tag-blue-bg-color: #2d3638;
}
}
.suffix {
Expand Down Expand Up @@ -104,15 +77,15 @@
line-height: 17px;
}
.green {
color: #00C891;
color: #00c891;
background: var(--tag-green-bg-color);
}
.blue {
color: #23BFF0;
color: #23bff0;
background: var(--tag-blue-bg-color);
}
.red {
color: #FF5656;
color: #ff5656;
background: var(--tag-red-bg-color);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,22 +88,22 @@ const MultiAddressReceive = ({
title: t('addresses.address'),
dataIndex: 'address',
align: 'left',
render(v: string) {
render(itemAddress: string) {
return (
<Tooltip
tip={
<CopyZone content={v} className={styles.copyTableAddress}>
{v}
<CopyZone content={itemAddress} className={styles.copyTableAddress}>
{itemAddress}
<Copy />
</CopyZone>
}
showTriangle
isTriggerNextToChild
>
<div className={styles.address}>
<span className={styles.overflow}>{address.slice(0, -6)}</span>
<span className={styles.overflow}>{itemAddress.slice(0, -6)}</span>
<span>...</span>
<span>{address.slice(-6)}</span>
<span>{itemAddress.slice(-6)}</span>
</div>
</Tooltip>
)
Expand Down
9 changes: 9 additions & 0 deletions packages/neuron-ui/src/components/Send/send.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ $headerHeight: 104px;

.content {
padding: 16px;
/**
These styles are for showing the full tips, because of content needs to scroll on the y-axis.
Then the overflow property that is set as scroll will truncate the tips overflow of the content.
So I need to expand the content's left to show the full tips.
*/
position: relative;
left: -48px;
padding-left: 64px;
width: calc(100% - 32px);
}

.rightFooter {
Expand Down
1 change: 1 addition & 0 deletions packages/neuron-wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
},
"dependencies": {
"@ckb-lumos/base": "0.20.0-alpha.3",
"@ckb-lumos/bi": "0.20.0-alpha.3",
"@ckb-lumos/ckb-indexer": "0.20.0-alpha.3",
"@ckb-lumos/codec": "0.20.0-alpha.3",
"@ckb-lumos/rpc": "0.20.0-alpha.3",
Expand Down
Loading

0 comments on commit 85c646d

Please sign in to comment.