fix(wallet): expose shared QML module to UI hosts

Expose Logos.Wallet from the runtime QML import root while keeping the compiled module outside the builder-owned view tree. Bind the swap confirmation component to its declaring page theme.
This commit is contained in:
Ricardo Guilherme Schmidt 2026-07-15 14:11:00 -03:00
parent 051ba647fe
commit ebb1b87399
No known key found for this signature in database
GPG Key ID: 1396EA17DE132FFE
3 changed files with 27 additions and 16 deletions

View File

@ -26,13 +26,19 @@
cmakeFlagsArray+=("-DLOGOS_WALLET_SOURCE_DIR=${shared_wallet}") cmakeFlagsArray+=("-DLOGOS_WALLET_SOURCE_DIR=${shared_wallet}")
''; '';
postInstall = '' postInstall = ''
# The builder installs the view under lib/qml after this hook. Its
# import descriptor points back to this compiled shared QML module.
test -f ${./qml}/Logos/Wallet/qmldir
walletQmlDir="shared-wallet/qml/Logos/Wallet" walletQmlDir="shared-wallet/qml/Logos/Wallet"
if [ ! -d "$walletQmlDir" ]; then if [ ! -d "$walletQmlDir" ]; then
echo "Built Logos.Wallet QML module not found" echo "Built Logos.Wallet QML module not found"
exit 1 exit 1
fi fi
mkdir -p "$out/lib/Logos/Wallet" walletQmlInstallDir="$out/lib/Logos/Wallet"
cp -r "$walletQmlDir/." "$out/lib/Logos/Wallet/" mkdir -p "$walletQmlInstallDir"
cp -r "$walletQmlDir/." "$walletQmlInstallDir/"
test -f "$walletQmlInstallDir/qmldir"
''; '';
}; };
} }

View File

@ -0,0 +1,5 @@
module Logos.Wallet
optional plugin logos_wallet_qmlplugin ../../../Logos/Wallet
classname Logos_WalletPlugin
prefer :/qt/qml/Logos/Wallet/
depends QtQuick

View File

@ -1,10 +1,10 @@
pragma ComponentBehavior: Bound
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import Logos.Wallet import Logos.Wallet
import "../components/shared" import "../components/shared"
import "../components/swap" import "../components/swap"
import "../state"
Item { Item {
id: root id: root
@ -19,7 +19,7 @@ Item {
] ]
QtObject { QtObject {
id: theme id: pageTheme
property bool isDark: true property bool isDark: true
property var colors: isDark ? dark : light property var colors: isDark ? dark : light
@ -62,7 +62,7 @@ Item {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: theme.colors.background color: pageTheme.colors.background
Behavior on color { ColorAnimation { duration: 300 } } Behavior on color { ColorAnimation { duration: 300 } }
// Theme toggle // Theme toggle
@ -71,19 +71,19 @@ Item {
anchors.right: parent.right anchors.right: parent.right
anchors.margins: 16 anchors.margins: 16
width: 44; height: 24; radius: 12 width: 44; height: 24; radius: 12
color: theme.colors.panelBg color: pageTheme.colors.panelBg
border.color: theme.colors.border border.color: pageTheme.colors.border
border.width: 1 border.width: 1
Text { Text {
anchors.centerIn: parent anchors.centerIn: parent
text: theme.isDark ? "☀" : "☾" text: pageTheme.isDark ? "☀" : "☾"
font.pixelSize: 13 font.pixelSize: 13
color: theme.colors.textSecondary color: pageTheme.colors.textSecondary
} }
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: theme.isDark = !theme.isDark onClicked: pageTheme.isDark = !pageTheme.isDark
} }
} }
@ -94,7 +94,7 @@ Item {
SwapCard { SwapCard {
id: swapCard id: swapCard
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
theme: theme theme: pageTheme
tokens: root.tokens tokens: root.tokens
width: Math.min(480, root.width - 32) width: Math.min(480, root.width - 32)
@ -110,9 +110,9 @@ Item {
Text { Text {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
text: "Buy and sell crypto on <font color='" + theme.colors.textPrimary + "'>LEZ</font>." text: "Buy and sell crypto on <font color='" + pageTheme.colors.textPrimary + "'>LEZ</font>."
textFormat: Text.RichText textFormat: Text.RichText
color: theme.colors.textSecondary color: pageTheme.colors.textSecondary
font.pixelSize: 15 font.pixelSize: 15
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
} }
@ -122,7 +122,7 @@ Item {
id: tokenModal id: tokenModal
anchors.fill: parent anchors.fill: parent
z: 10 z: 10
theme: theme theme: pageTheme
tokens: root.tokens tokens: root.tokens
property string targetSide: "sell" property string targetSide: "sell"
@ -149,7 +149,7 @@ Item {
id: swapConfirmationSummary id: swapConfirmationSummary
SwapConfirmationSummary { SwapConfirmationSummary {
theme: theme theme: pageTheme
} }
} }