-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a screen to allow entering you mnemonic when the wallet is used for the first time. closes #3
- Loading branch information
Showing
6 changed files
with
194 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
const { | ||
QMainWindow, | ||
QStackedWidget, | ||
QIcon, | ||
QPushButton, | ||
AlignmentFlag, | ||
QGridLayout, | ||
Direction, | ||
QLabel | ||
} = require("@nodegui/nodegui") | ||
const View = require('../components/view') | ||
|
||
class MnemonicChoice extends View { | ||
constructor (viewManager) { | ||
super() | ||
|
||
const layout = new QGridLayout() | ||
|
||
this.buttonNewWallet = new QPushButton() | ||
this.buttonNewWallet.setText('New Wallet') | ||
this.buttonNewWallet.setInlineStyle('padding: 5px; background-color: white; border-radius: 30%; color: #131620;') | ||
this.buttonNewWallet.setFixedSize(240, 60) | ||
|
||
const orText = new QLabel() | ||
orText.setText('Or') | ||
|
||
this.buttonEnterMnemonic = new QPushButton() | ||
this.buttonEnterMnemonic.setText('Enter Mnemonic') | ||
this.buttonEnterMnemonic.setInlineStyle('padding: 5px; background-color: white; border-radius: 30%; color: #131620;') | ||
this.buttonEnterMnemonic.setFixedSize(240, 60) | ||
|
||
layout.addWidget(this.buttonNewWallet, 0, 0, 3, 0, AlignmentFlag.AlignCenter) | ||
layout.addWidget(orText, 1, 0, 3, 0, AlignmentFlag.AlignCenter) | ||
layout.addWidget(this.buttonEnterMnemonic, 2, 0, 3, 0, AlignmentFlag.AlignCenter) | ||
|
||
this.buttonNewWallet.addEventListener('clicked', () => { | ||
console.log('New Wallet clicked') | ||
viewManager.emit('changeView', 'new') | ||
}) | ||
|
||
this.buttonEnterMnemonic.addEventListener('clicked', () => { | ||
console.log('Enter Mnemonic clicked') | ||
viewManager.emit('changeView', 'enter') | ||
}) | ||
|
||
this.setLayout(layout) | ||
} | ||
} | ||
|
||
module.exports = MnemonicChoice |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
const { | ||
QPushButton, | ||
AlignmentFlag, | ||
QGridLayout, | ||
Direction, | ||
QLabel, | ||
QTextEdit, | ||
} = require("@nodegui/nodegui") | ||
const View = require('../components/view') | ||
|
||
class MnemonicEnter extends View { | ||
constructor (viewManager) { | ||
super() | ||
|
||
const layout = new QGridLayout() | ||
|
||
const enterLabel = new QLabel() | ||
enterLabel.setText('Enter your mnemonic :') | ||
enterLabel.setFixedHeight(80) | ||
|
||
this.edit = new QTextEdit() | ||
this.edit.setInlineStyle('padding: 15px; background-color: white; border-radius: 2%; color: #131620;') | ||
this.edit.setFixedWidth(320) | ||
|
||
this.buttonValidate = new QPushButton() | ||
this.buttonValidate.setText('Validate') | ||
this.buttonValidate.setInlineStyle('padding: 5px; background-color: white; border-radius: 30%; color: #131620;') | ||
this.buttonValidate.setFixedSize(240, 60) | ||
|
||
// TODO: fix the layout so it doesn't look so weird | ||
layout.addWidget(enterLabel, 1, 0, 1, 0, AlignmentFlag.AlignCenter) | ||
layout.addWidget(this.edit, 2, 0, 1, 0, AlignmentFlag.AlignCenter) | ||
layout.addWidget(this.buttonValidate, 3, 0, 3, 0, AlignmentFlag.AlignCenter) | ||
|
||
this.buttonValidate.addEventListener('clicked', () => { | ||
// TODO: validate the mnemonic here | ||
const mnemonic = this.edit.toPlainText() | ||
viewManager.emit('completed', mnemonic) | ||
}) | ||
|
||
this.setLayout(layout) | ||
} | ||
} | ||
|
||
module.exports = MnemonicEnter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
const { | ||
QGridLayout, | ||
AlignmentFlag, | ||
QPushButton, | ||
QFrame, | ||
QPlainTextEdit, | ||
} = require("@nodegui/nodegui") | ||
const View = require('../components/view') | ||
|
||
class MnemonicShow extends View { | ||
constructor (viewManager, mnemonic) { | ||
super() | ||
|
||
const layout = new QGridLayout() | ||
|
||
/* Text edit widget */ | ||
const plainTextEdit = new QPlainTextEdit() | ||
plainTextEdit.setPlainText(mnemonic) | ||
plainTextEdit.setDisabled(true) | ||
plainTextEdit.setInlineStyle('margin: 180px 20px; border: none; font-size: 2em;') | ||
|
||
|
||
this.button = new QPushButton() | ||
this.button.setText('I have saved my mnemonic') | ||
this.button.setInlineStyle('padding: 5px; background-color: white; border-radius: 30%; color: #131620;') | ||
this.button.setFixedSize(240, 60) | ||
|
||
layout.addWidget(plainTextEdit, 0, 0, 1, 0, AlignmentFlag.AlignTop) | ||
layout.addWidget(this.button, 1, 0, 1, 0, AlignmentFlag.AlignCenter) | ||
|
||
// frame.setInlineStyle('border: none;') | ||
this.setInlineStyle('margin: 20px;') | ||
|
||
this.setLayout(layout) | ||
|
||
this.button.addEventListener('clicked', () => { | ||
viewManager.emit('completed', mnemonic) | ||
}) | ||
|
||
} | ||
} | ||
|
||
module.exports = MnemonicShow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters