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}")
'';
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"
if [ ! -d "$walletQmlDir" ]; then
echo "Built Logos.Wallet QML module not found"
exit 1
fi
mkdir -p "$out/lib/Logos/Wallet"
cp -r "$walletQmlDir/." "$out/lib/Logos/Wallet/"
walletQmlInstallDir="$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.Controls 2.15
import QtQuick.Layouts 1.15
import Logos.Wallet
import "../components/shared"
import "../components/swap"
import "../state"
Item {
id: root
@ -19,7 +19,7 @@ Item {
]
QtObject {
id: theme
id: pageTheme
property bool isDark: true
property var colors: isDark ? dark : light
@ -62,7 +62,7 @@ Item {
Rectangle {
anchors.fill: parent
color: theme.colors.background
color: pageTheme.colors.background
Behavior on color { ColorAnimation { duration: 300 } }
// Theme toggle
@ -71,19 +71,19 @@ Item {
anchors.right: parent.right
anchors.margins: 16
width: 44; height: 24; radius: 12
color: theme.colors.panelBg
border.color: theme.colors.border
color: pageTheme.colors.panelBg
border.color: pageTheme.colors.border
border.width: 1
Text {
anchors.centerIn: parent
text: theme.isDark ? "☀" : "☾"
text: pageTheme.isDark ? "☀" : "☾"
font.pixelSize: 13
color: theme.colors.textSecondary
color: pageTheme.colors.textSecondary
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: theme.isDark = !theme.isDark
onClicked: pageTheme.isDark = !pageTheme.isDark
}
}
@ -94,7 +94,7 @@ Item {
SwapCard {
id: swapCard
Layout.alignment: Qt.AlignHCenter
theme: theme
theme: pageTheme
tokens: root.tokens
width: Math.min(480, root.width - 32)
@ -110,9 +110,9 @@ Item {
Text {
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
color: theme.colors.textSecondary
color: pageTheme.colors.textSecondary
font.pixelSize: 15
horizontalAlignment: Text.AlignHCenter
}
@ -122,7 +122,7 @@ Item {
id: tokenModal
anchors.fill: parent
z: 10
theme: theme
theme: pageTheme
tokens: root.tokens
property string targetSide: "sell"
@ -149,7 +149,7 @@ Item {
id: swapConfirmationSummary
SwapConfirmationSummary {
theme: theme
theme: pageTheme
}
}