add logic to display grouping labels appropriately
This commit is contained in:
parent
74a15b824a
commit
e41b46b42d
2 changed files with 18 additions and 1 deletions
|
|
@ -156,6 +156,23 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
||||||
return new Date(txCreated * 1000);
|
return new Date(txCreated * 1000);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.showGroupHeader = function(index) {
|
||||||
|
if(index === 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
var curTx = $scope.txHistory[index];
|
||||||
|
var prevTx = $scope.txHistory[index - 1];
|
||||||
|
return !createdDuringSameMonth(curTx, prevTx);
|
||||||
|
};
|
||||||
|
|
||||||
|
function createdDuringSameMonth(tx1, tx2) {
|
||||||
|
var date1 = new Date(tx1.time * 1000);
|
||||||
|
var date2 = new Date(tx2.time * 1000);
|
||||||
|
var date1MonthYear = date1.getMonth() + date1.getFullYear();
|
||||||
|
var date2MonthYear = date2.getMonth() + date2.getFullYear();
|
||||||
|
return date1MonthYear === date2MonthYear;
|
||||||
|
}
|
||||||
|
|
||||||
$scope.showMore = function() {
|
$scope.showMore = function() {
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
currentTxHistoryPage++;
|
currentTxHistoryPage++;
|
||||||
|
|
|
||||||
|
|
@ -176,7 +176,7 @@
|
||||||
|
|
||||||
<div class="wallet-details__list" ng-show="txHistory[0]">
|
<div class="wallet-details__list" ng-show="txHistory[0]">
|
||||||
<div ng-repeat="btx in txHistory track by $index" ng-click="openTxModal(btx)">
|
<div ng-repeat="btx in txHistory track by $index" ng-click="openTxModal(btx)">
|
||||||
<div class="wallet-details__group-label">{{getDate(btx.time) | date:'MMMM'}}</div>
|
<div class="wallet-details__group-label" ng-if="showGroupHeader($index)">{{getDate(btx.time) | date:'MMMM'}}</div>
|
||||||
|
|
||||||
<div class="wallet-details__item">
|
<div class="wallet-details__item">
|
||||||
<img class="wallet-details__tx-icon" src="img/icon-tx-received.svg" width="40" ng-if="btx.action == 'received'">
|
<img class="wallet-details__tx-icon" src="img/icon-tx-received.svg" width="40" ng-if="btx.action == 'received'">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue