chore(EnterSeedPhrase): improve the SB page

- add a convenience Paste button
- make it possible to validate the seedphrase
This commit is contained in:
Lukáš Tinkl 2025-02-03 12:26:30 +01:00 committed by Lukáš Tinkl
parent c20662e6a4
commit 2c0bcd67af

View File

@ -1,14 +1,53 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import shared.panels 1.0
import Storybook 1.0
Item {
QtObject {
id: mockDriver
readonly property var seedWords: ["apple", "banana", "cat", "cow", "catalog", "catch", "category", "cattle", "dog", "elephant", "fish", "grape"]
function isSeedPhraseValid(mnemonic: string) {
return mnemonic === seedWords.join(" ")
}
}
EnterSeedPhrase {
id: panel
anchors.centerIn: parent
isSeedPhraseValid: mockDriver.isSeedPhraseValid
}
Row {
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.margins: 10
spacing: 8
Label {
anchors.verticalCenter: parent.verticalCenter
text: "Valid: %1".arg(panel.seedPhraseIsValid ? "yes" : "no")
}
Button {
text: "Paste seed phrase"
focusPolicy: Qt.NoFocus
onClicked: {
for (let i = 1;; i++) {
const input = StorybookUtils.findChild(panel, `enterSeedPhraseInputField${i}`)
if (input === null)
break
input.text = mockDriver.seedWords[i-1]
}
}
}
}
}
// category: Panels
// category: Panels
// status: good