Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
devchenyan committed Aug 16, 2023
1 parent d9fdce7 commit e89f913
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,19 @@
color: var(--primary-text-color);
}
}

.scriptTag {
line-height: 17px;
margin: auto 8px;
padding: 3px 8px;
background: var(--tag-background-color);
color: var(--script-tag-color);
cursor: auto;
@media (prefers-color-scheme: dark) {
color: var(--primary-color);
background: transparent;
}
}
}

.conciseData {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const Cell = React.memo(
{address.slice(0, 6)}...{address.slice(-6)}
<span className={`${cell.type ? styles.activity : ''} ${styles.tag}`}>Type</span>
<span className={`${cell.data && cell.data !== '0x' ? styles.activity : ''} ${styles.tag}`}>Data</span>
<ScriptTag script={cell.lock} isMainnet={isMainnet} />
<ScriptTag className={styles.scriptTag} script={cell.lock} isMainnet={isMainnet} />
</div>
<div>{`${shannonToCKBFormatter(cell.capacity ?? '0')} CKB`}</div>
</div>
Expand Down
12 changes: 10 additions & 2 deletions packages/neuron-wallet/src/controllers/multisig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ export default class MultisigController {
const json = fs.readFileSync(filePaths[0], 'utf-8')
const configOutput: MultisigConfigOutput = JSON.parse(json)
if (!validateImportConfig(configOutput)) {
dialog.showErrorBox(t('common.error'), t('messages.invalid-json'))
ShowGlobalDialogSubject.next({
type: 'failed',
title: t('common.error'),
message: t('messages.invalid-json'),
})
return
}
const saveConfigs = Object.values(configOutput.multisig_configs).map(config => ({
Expand Down Expand Up @@ -137,7 +141,11 @@ export default class MultisigController {
result: saveSuccessConfigs,
}
} catch {
dialog.showErrorBox(t('common.error'), t('messages.invalid-json'))
ShowGlobalDialogSubject.next({
type: 'failed',
title: t('common.error'),
message: t('messages.invalid-json'),
})
}
}

Expand Down
13 changes: 11 additions & 2 deletions packages/neuron-wallet/src/services/offline-sign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import path from 'path'
import { dialog } from 'electron'
import { t } from 'i18next'
import type { OfflineSignJSON } from '../models/offline-sign'
import ShowGlobalDialogSubject from '../models/subjects/show-global-dialog'

export default class OfflineSignService {
public static async loadTransactionJSON() {
Expand All @@ -28,15 +29,23 @@ export default class OfflineSignService {
try {
const json: OfflineSignJSON = JSON.parse(file)
if (!json.transaction) {
dialog.showErrorBox(t('common.error'), t('messages.invalid-json'))
ShowGlobalDialogSubject.next({
type: 'failed',
title: t('common.error'),
message: t('messages.invalid-json'),
})
return
}
return {
json,
filePath: path.basename(filePath),
}
} catch (err) {
dialog.showErrorBox(t('common.error'), t('messages.invalid-json'))
ShowGlobalDialogSubject.next({
type: 'failed',
title: t('common.error'),
message: t('messages.invalid-json'),
})
}
}
}

0 comments on commit e89f913

Please sign in to comment.