chore(storybook) add ConnectDappModal to story book

Also:

- mock FeatureFlags nim to silence `Global.qml` warnings

Updates: #14556
This commit is contained in:
Stefan 2024-05-10 14:42:54 +02:00 committed by Stefan Dunca
parent 1f60410db8
commit 4dfa0a1b05
6 changed files with 61 additions and 12 deletions

View File

@ -0,0 +1,13 @@
import QtQuick 2.15
import shared.popups.walletconnect 1.0
Item {
id: root
ConnectDappModal {
id: dappModal
visible: true
}
}

View File

@ -18,7 +18,10 @@ import AppLayouts.Wallet.controls 1.0
import SortFilterProxyModel 0.2
import shared.popups.walletconnect 1.0
import utils 1.0
import shared.stores 1.0
Item {
id: root
@ -46,7 +49,7 @@ Item {
spacing: 8
onConnectDapp: {
console.warn("TODO: run ConnectDappPopup...")
console.warn("TODO: run ConnectDappModal...")
}
}
}
@ -56,10 +59,33 @@ Item {
ColumnLayout {
id: optionsSpace
RowLayout {
Text { text: "projectId" }
Text {
id: projectIdText
readonly property string projectId: SystemUtils.getEnvVar("WALLET_CONNECT_PROJECT_ID")
text: projectId.substring(0, 3) + "..." + projectId.substring(projectId.length - 3)
font.bold: true
}
}
// spacer
ColumnLayout {}
}
}
DAppsStore {
wCSDK: WalletConnectSDK {
active: true
projectId: projectIdText.projectId
onSessionRequestEvent: (details) => {
// TODO #14556
console.debug(`@dd onSessionRequestEvent: ${JSON.stringify(details)}`)
}
}
}
}
// category: Popups

View File

@ -1,10 +0,0 @@
<!-- Keep in sync with mock of: ui/app/AppLayouts/Wallet/views/walletconnect/sdk/src/index.html to avoid trying to load from app qrc -->
<!DOCTYPE html>
<html>
<head>
<script src="qrc:/StatusQ/Components/private/qwebchannel/qwebchannel.js" defer></script>
<script src="qrc:/StatusQ/Components/private/qwebchannel/helpers.js" defer></script>
<script src="../../../../../../../ui/imports/shared/popups/walletconnect/sdk/generated/bundle.js" defer></script>
</head>
<body></body>
</html>

View File

@ -0,0 +1,10 @@
// Mock of src/app/global/feature_flags.nim
import QtQuick 2.15
QtObject {
readonly property string contextPropertyName: "featureFlagsRootContextProperty"
//
// Silence warnings
readonly property bool dappsEnabled: true
}

View File

@ -0,0 +1,9 @@
import QtQuick 2.15
import shared.popups.walletconnect 1.0
QtObject {
id: root
required property WalletConnectSDK wCSDK
}

View File

@ -4,3 +4,4 @@ NetworkConnectionStore 1.0 NetworkConnectionStore.qml
singleton RootStore 1.0 RootStore.qml
TokenBalanceHistoryStore 1.0 TokenBalanceHistoryStore.qml
BIP39_en 1.0 BIP39_en.qml
DAppsStore 1.0 DAppsStore.qml