status-desktop/ui/app/AppLayouts/Profile/views/keycard/MainView.qml

195 lines
5.2 KiB
QML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import QtQuick 2.14
import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
import StatusQ.Components 0.1
import StatusQ.Popups 0.1
import utils 1.0
import shared.panels 1.0
import shared.controls 1.0
import shared.status 1.0
import shared.popups.keycard.helpers 1.0
import "../../stores"
ColumnLayout {
id: root
property KeycardStore keycardStore
signal displayKeycardsForKeypair(string keyUid, string keypairName)
spacing: Constants.settingsSection.itemSpacing
QtObject {
id: d
readonly property bool noKeycardsSet: root.keycardStore.keycardModule.keycardModel.count === 0
}
Image {
visible: d.noKeycardsSet
Layout.alignment: Qt.AlignCenter
Layout.preferredHeight: sourceSize.height
Layout.preferredWidth: sourceSize.width
fillMode: Image.PreserveAspectFit
antialiasing: true
source: Style.png("keycard/security-keycard@2x")
mipmap: true
}
Item {
visible: d.noKeycardsSet
Layout.fillWidth: true
Layout.preferredHeight: Style.current.halfPadding
}
StyledText {
visible: d.noKeycardsSet
Layout.alignment: Qt.AlignCenter
font.pixelSize: Constants.settingsSection.importantInfoFontSize
color: Theme.palette.directColor1
text: qsTr("Secure your funds. Keep your profile safe.")
}
Item {
visible: d.noKeycardsSet
Layout.fillWidth: true
Layout.preferredHeight: Style.current.halfPadding
}
StatusSectionHeadline {
visible: !d.noKeycardsSet
Layout.fillWidth: true
Layout.leftMargin: Style.current.padding
Layout.rightMargin: Style.current.padding
text: qsTr("Your Keycard(s)")
}
StatusListView {
visible: !d.noKeycardsSet
Layout.fillWidth: true
Layout.preferredHeight: 250
spacing: Style.current.padding
model: root.keycardStore.keycardModule.keycardModel
delegate: KeycardItem {
width: ListView.view.width
keycardName: model.keycard.name
keycardLocked: model.keycard.locked
keyPairType: model.keycard.pairType
keyPairIcon: model.keycard.icon
keyPairImage: model.keycard.image
keyPairAccounts: model.keycard.accounts
onKeycardSelected: {
root.displayKeycardsForKeypair(model.keycard.keyUid, model.keycard.name)
}
}
}
StatusListItem {
Layout.fillWidth: true
title: d.noKeycardsSet? qsTr("Setup a new Keycard with an existing account")
: qsTr("Migrate an existing account from Status Desktop to Keycard")
components: [
StatusIcon {
icon: "tiny/chevron-right"
color: Theme.palette.baseColor1
}
]
onClicked: {
root.keycardStore.runSetupKeycardPopup()
}
}
StatusSectionHeadline {
Layout.fillWidth: true
Layout.leftMargin: Style.current.padding
Layout.rightMargin: Style.current.padding
text: qsTr("Create, import or restore a Keycard account")
}
StatusListItem {
Layout.fillWidth: true
title: qsTr("Create a new Keycard account with a new seed phrase")
components: [
StatusIcon {
icon: "tiny/chevron-right"
color: Theme.palette.baseColor1
}
]
onClicked: {
root.keycardStore.runCreateNewKeycardWithNewSeedPhrasePopup()
}
}
StatusListItem {
Layout.fillWidth: true
title: qsTr("Import or restore via a seed phrase")
components: [
StatusIcon {
icon: "tiny/chevron-right"
color: Theme.palette.baseColor1
}
]
onClicked: {
root.keycardStore.runImportOrRestoreViaSeedPhrasePopup()
}
}
StatusListItem {
Layout.fillWidth: true
title: qsTr("Import from Keycard to Status Desktop")
components: [
StatusIcon {
icon: "tiny/chevron-right"
color: Theme.palette.baseColor1
}
]
onClicked: {
root.keycardStore.runImportFromKeycardToAppPopup()
}
}
StatusSectionHeadline {
Layout.fillWidth: true
Layout.leftMargin: Style.current.padding
Layout.rightMargin: Style.current.padding
text: qsTr("Other")
}
StatusListItem {
Layout.fillWidth: true
title: qsTr("Check whats on a Keycard")
components: [
StatusIcon {
icon: "tiny/chevron-right"
color: Theme.palette.baseColor1
}
]
onClicked: {
root.keycardStore.runDisplayKeycardContentPopup()
}
}
StatusListItem {
Layout.fillWidth: true
title: qsTr("Factory reset a Keycard")
components: [
StatusIcon {
icon: "tiny/chevron-right"
color: Theme.palette.baseColor1
}
]
onClicked: {
root.keycardStore.runFactoryResetPopup()
}
}
}