diff --git a/apps/amm/flake.nix b/apps/amm/flake.nix
index d6c51cc..7f345e1 100644
--- a/apps/amm/flake.nix
+++ b/apps/amm/flake.nix
@@ -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"
'';
};
}
diff --git a/apps/amm/qml/Logos/Wallet/qmldir b/apps/amm/qml/Logos/Wallet/qmldir
new file mode 100644
index 0000000..866351b
--- /dev/null
+++ b/apps/amm/qml/Logos/Wallet/qmldir
@@ -0,0 +1,5 @@
+module Logos.Wallet
+optional plugin logos_wallet_qmlplugin ../../../Logos/Wallet
+classname Logos_WalletPlugin
+prefer :/qt/qml/Logos/Wallet/
+depends QtQuick
diff --git a/apps/amm/qml/pages/SwapPage.qml b/apps/amm/qml/pages/SwapPage.qml
index 7b7b4af..f4aca1a 100644
--- a/apps/amm/qml/pages/SwapPage.qml
+++ b/apps/amm/qml/pages/SwapPage.qml
@@ -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 LEZ."
+ text: "Buy and sell crypto on LEZ."
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
}
}