-
Notifications
You must be signed in to change notification settings - Fork 88
Enter seed phrase component refactored according to new design #19004
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
ca9d6c9
72de90c
f2d536e
746b57f
36f0ac7
6f41a11
f4e9f2b
f51c1c1
6d61393
a892871
4fb95ca
b4d95da
3384a45
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| import QtQuick | ||
| import QtQuick.Controls | ||
| import QtQuick.Layouts | ||
| import QtQml | ||
|
|
||
| import StatusQ | ||
| import StatusQ.Core | ||
| import StatusQ.Core.Utils | ||
| import StatusQ.Controls | ||
| import StatusQ.Components | ||
| import StatusQ.Core.Theme | ||
|
|
||
| import Models | ||
| import Storybook | ||
|
|
||
| import SortFilterProxyModel | ||
| import QtModelsToolkit | ||
|
|
||
| import shared | ||
| import shared.panels | ||
| import utils | ||
|
|
||
| Item { | ||
| id: root | ||
|
|
||
| MouseArea { | ||
| anchors.fill: parent | ||
|
|
||
| onClicked: root.focus = true | ||
| } | ||
|
|
||
| function isValid(mnemonic) { | ||
| return mnemonic === sampleValidPhrase | ||
| } | ||
|
|
||
| readonly property string sampleValidPhrase: | ||
| "abandon baby cat dad eager fabric gadget habit ice jacket kangaroo lab" | ||
|
|
||
| Rectangle { | ||
| anchors.fill: parent | ||
| anchors.margins: 150 | ||
| border.width: 1 | ||
| color: "transparent" | ||
|
|
||
| StatusScrollView { | ||
| id: scrollView | ||
|
|
||
| anchors.fill: parent | ||
| contentWidth: availableWidth | ||
|
|
||
| EnterSeedPhraseNew { | ||
| id: enterSeedPhrase | ||
|
|
||
| property var validSeedPhrase: [] | ||
|
|
||
| width: scrollView.availableWidth | ||
| dictionary: BIP39_en {} | ||
|
|
||
| onSeedPhraseProvided: seedPhrase => { | ||
| const valid = seedPhrase.join(" ") === sampleValidPhrase | ||
| setError(valid ? "" : "Invalid seed phrase!") | ||
| } | ||
|
|
||
| onSeedPhraseAccepted: validSeedPhrase = seedPhrase | ||
| } | ||
| } | ||
| } | ||
|
|
||
| ColumnLayout { | ||
| anchors.bottom: parent.bottom | ||
|
|
||
| Button { | ||
| text: "Copy valid seed phrase to keyboard: " + root.sampleValidPhrase | ||
|
|
||
| onClicked: ClipboardUtils.setText(root.sampleValidPhrase) | ||
| } | ||
|
|
||
| Label { | ||
| text: "is seedphrase valid: " + enterSeedPhrase.seedPhraseIsValid | ||
| } | ||
|
|
||
| Label { | ||
| text: "valid seed phrase provided: " + enterSeedPhrase.validSeedPhrase.toString() | ||
| } | ||
|
|
||
| Label { | ||
| text: JSON.stringify(enterSeedPhrase.seedPhrase) | ||
|
|
||
| Layout.bottomMargin: 20 | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // category: Panels | ||
| // status: good |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| import QtQuick | ||
| import QtQuick.Controls | ||
|
|
||
| import StatusQ.Core | ||
| import StatusQ.Core.Theme | ||
| import StatusQ.Core.Utils | ||
|
|
||
| TextField { | ||
| id: root | ||
|
|
||
| property int displayIndex | ||
| property bool valid: true | ||
|
|
||
| leftPadding: fontMetrics.advanceWidth("24") + Theme.bigPadding | ||
| rightPadding: Theme.halfPadding | ||
|
|
||
| verticalAlignment: TextInput.AlignVCenter | ||
|
|
||
| selectionColor: Theme.palette.primaryColor2 | ||
| selectedTextColor: color | ||
| focus: !Utils.isMobile | ||
| font.pixelSize: Theme.primaryTextFontSize | ||
| font.family: Theme.baseFont.name | ||
| color: root.enabled ? Theme.palette.directColor1 : Theme.palette.baseColor1 | ||
|
|
||
| inputMethodHints: Qt.ImhSensitiveData | Qt.ImhNoPredictiveText | | ||
| Qt.ImhNoAutoUppercase | Qt.ImhPreferLowercase | ||
|
|
||
| background: Rectangle { | ||
| id: background | ||
|
|
||
| color: Theme.palette.statusAppNavBar.backgroundColor | ||
| radius: Theme.radius | ||
|
|
||
| StatusBaseText { | ||
| id: text | ||
|
|
||
| FontMetrics { | ||
| id: fontMetrics | ||
| font: text.font | ||
| } | ||
|
|
||
| anchors.fill: parent | ||
| anchors.rightMargin: root.width - root.leftPadding | ||
|
|
||
| text: "" + root.displayIndex | ||
| font.family: Theme.monoFont.name | ||
|
|
||
| horizontalAlignment: Qt.AlignHCenter | ||
| verticalAlignment: Qt.AlignVCenter | ||
|
|
||
| color: !root.valid ? Theme.palette.dangerColor1 | ||
| : root.activeFocus ? Theme.palette.primaryColor1 | ||
| : Theme.palette.baseColor1 | ||
| } | ||
|
|
||
| border.width: 1 | ||
| border.color: { | ||
| if (!root.valid) | ||
| return Theme.palette.dangerColor1 | ||
|
|
||
| if (root.activeFocus) | ||
| return Theme.palette.primaryColor1 | ||
|
|
||
| return root.hovered ? Theme.palette.primaryColor2 : "transparent" | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import StatusQ.Controls | ||
|
|
||
| StatusSwitchTabBar { | ||
| id: root | ||
|
|
||
| padding: 0 | ||
|
|
||
| readonly property var lengths: [12, 18, 24] | ||
| readonly property int selectedLength: { | ||
| if (v12.checked) | ||
| return 12 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor: Maybe you could use constants instead everywhere here for 12, 18 and 14 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As it's local thing I would just keep as it is. Those constants would have those number in its name as well... |
||
| if (v18.checked) | ||
| return 18 | ||
| return 24 | ||
| } | ||
|
|
||
| function selectLength(length: int) { | ||
| if (length === 12) | ||
| v12.checked = true | ||
| else if(length === 18) | ||
| v18.checked = true | ||
| else | ||
| v24.checked = true | ||
| } | ||
|
|
||
| StatusSwitchTabButton { | ||
| id: v12 | ||
|
|
||
| verticalPadding: 0 | ||
| text: qsTr("12 word") | ||
| objectName: "12SeedButton" | ||
| } | ||
|
|
||
| StatusSwitchTabButton { | ||
| id: v18 | ||
|
|
||
| verticalPadding: 0 | ||
| text: qsTr("18 word") | ||
| objectName: "18SeedButton" | ||
| } | ||
|
|
||
| StatusSwitchTabButton { | ||
| id: v24 | ||
|
|
||
| verticalPadding: 0 | ||
| text: qsTr("24 word") | ||
| objectName: "24SeedButton" | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.