From 7a7d7f95d7f56b2878efa5f1ee06a7d301c6ebad Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 30 Aug 2017 12:40:19 -0700 Subject: [PATCH 1/3] Polish transaction history and prepare for whatever new design --- .../qml/hifi/commerce/purchases/Purchases.qml | 2 + .../qml/hifi/commerce/wallet/WalletHome.qml | 62 +++++++++++++++---- 2 files changed, 52 insertions(+), 12 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml index 3cf8eb9b29..bc843a140d 100644 --- a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml +++ b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml @@ -74,7 +74,9 @@ Rectangle { if (result.status !== 'success') { console.log("Failed to get purchases", result.message); } else { + purchasesModel.clear(); purchasesModel.append(result.data.assets); + filteredPurchasesModel.clear(); filteredPurchasesModel.append(result.data.assets); } } diff --git a/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml b/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml index c69610d494..950220f8f4 100644 --- a/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml +++ b/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml @@ -24,6 +24,7 @@ Item { HifiConstants { id: hifi; } id: root; + property bool historyReceived: false; Hifi.QmlCommerce { id: commerce; @@ -41,9 +42,9 @@ Item { } onHistoryResult : { + historyReceived = true; if (result.status === 'success') { - var txt = result.data.history.map(function (h) { return h.text; }).join("
"); - transactionHistoryText.text = txt; + transactionHistoryModel.append(result.data.history); } } } @@ -111,6 +112,7 @@ Item { onVisibleChanged: { if (visible) { + historyReceived = false; commerce.balance(); commerce.history(); } @@ -233,24 +235,60 @@ Item { // Style color: hifi.colors.faintGray; } - + ListModel { + id: transactionHistoryModel; + } Rectangle { - id: transactionHistory; anchors.top: recentActivityText.bottom; anchors.topMargin: 4; anchors.bottom: parent.bottom; anchors.left: parent.left; anchors.right: parent.right; + color: "white"; - // some placeholder stuff - TextArea { - id: transactionHistoryText; - text: "
history unavailable
"; - textFormat: TextEdit.AutoText; - font.pointSize: 10; + ListView { + id: transactionHistory; + anchors.centerIn: parent; + width: parent.width - 12; + height: parent.height - 12; + visible: transactionHistoryModel.count !== 0; + clip: true; + model: transactionHistoryModel; + delegate: Item { + width: parent.width; + height: transactionText.height + 30; + RalewayRegular { + id: transactionText; + text: model.text; + // Style + size: 18; + width: parent.width; + height: paintedHeight; + anchors.verticalCenter: parent.verticalCenter; + color: "black"; + wrapMode: Text.WordWrap; + // Alignment + horizontalAlignment: Text.AlignLeft; + verticalAlignment: Text.AlignVCenter; + } + + HifiControlsUit.Separator { + anchors.left: parent.left; + anchors.right: parent.right; + anchors.bottom: parent.bottom; + } + } + } + + // This should never be visible (since you immediately get 100 HFC) + RalewayRegular { + id: emptyTransationHistory; + size: 24; + visible: !transactionHistory.visible && root.historyReceived; + text: "Recent Activity Unavailable"; anchors.fill: parent; - horizontalAlignment: Text.AlignLeft; - verticalAlignment: Text.AlignTop; + horizontalAlignment: Text.AlignHCenter; + verticalAlignment: Text.AlignVCenter; } } } From 580865fa5aad9c78d7847d2c9d376ac1273e1c41 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 30 Aug 2017 12:54:26 -0700 Subject: [PATCH 2/3] Add skeleton for infinite scroll --- interface/resources/qml/hifi/commerce/wallet/WalletHome.qml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml b/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml index 950220f8f4..887028b49e 100644 --- a/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml +++ b/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml @@ -278,6 +278,12 @@ Item { anchors.bottom: parent.bottom; } } + onAtYEndChanged: { + if (transactionHistory.atYEnd) { + console.log("User scrolled to the bottom of 'Recent Activity'."); + // Grab next page of results and append to model + } + } } // This should never be visible (since you immediately get 100 HFC) From 17d999e7214927914ffbf0088b94b5d70bfe5623 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 30 Aug 2017 13:25:34 -0700 Subject: [PATCH 3/3] Fixes --- .../resources/qml/hifi/commerce/wallet/WalletHome.qml | 1 + .../qml/hifi/commerce/wallet/WalletSetupLightbox.qml | 9 +-------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml b/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml index 887028b49e..b55f7f800a 100644 --- a/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml +++ b/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml @@ -44,6 +44,7 @@ Item { onHistoryResult : { historyReceived = true; if (result.status === 'success') { + transactionHistoryModel.clear(); transactionHistoryModel.append(result.data.history); } } diff --git a/interface/resources/qml/hifi/commerce/wallet/WalletSetupLightbox.qml b/interface/resources/qml/hifi/commerce/wallet/WalletSetupLightbox.qml index f36529e6c1..4470ec7a75 100644 --- a/interface/resources/qml/hifi/commerce/wallet/WalletSetupLightbox.qml +++ b/interface/resources/qml/hifi/commerce/wallet/WalletSetupLightbox.qml @@ -24,7 +24,7 @@ Rectangle { HifiConstants { id: hifi; } id: root; - property string lastPage: "securityImage"; + property string lastPage: "initialize"; // Style color: hifi.colors.baseGray; @@ -58,16 +58,9 @@ Rectangle { // Item { id: securityImageContainer; - visible: false; // Anchors anchors.fill: parent; - onVisibleChanged: { - if (visible) { - commerce.getSecurityImage(); - } - } - Item { id: securityImageTitle; // Size