Fixed layout, relative time. Standardize on use of timeService.

This commit is contained in:
Andy Phillipson 2017-06-08 10:38:58 -04:00
commit ae777d6639
No known key found for this signature in database
GPG key ID: D813A67D567D6C88
10 changed files with 40 additions and 34 deletions

View file

@ -163,7 +163,7 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
runningBalance -= parseFloat(tx.amount);
};
this.withinPastDay = function(tx) {
$scope.createdWithinPastDay = function(tx) {
var result = false;
if (tx.timestamp) {
result = timeService.withinPastDay(tx.timestamp);

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('proposalsController',
function($timeout, $scope, profileService, $log, txpModalService, addressbookService) {
function($timeout, $scope, profileService, $log, txpModalService, addressbookService, timeService) {
$scope.fetchingProposals = true;
@ -27,8 +27,6 @@ angular.module('copayApp.controllers').controller('proposalsController',
$scope.openTxpModal = txpModalService.open;
$scope.createdWithinPastDay = function(time) {
var now = new Date();
var date = new Date(time * 1000);
return (now.getTime() - date.getTime()) < (1000 * 60 * 60 * 24);
return timeService.withinPastDay(time);
};
});

View file

@ -131,9 +131,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
});
$scope.createdWithinPastDay = function(time) {
var now = new Date();
var date = new Date(time * 1000);
return (now.getTime() - date.getTime()) < (1000 * 60 * 60 * 24);
return timeService.withinPastDay(time);
};
$scope.openExternalLink = function() {

View file

@ -201,7 +201,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
};
$scope.createdDuringSameMonth = function(curTx, prevTx) {
return timeService.withinSameMonth(curTx.time, prevTx.time);
return timeService.withinSameMonth(curTx.time * 1000, prevTx.time * 1000);
};
$scope.createdWithinPastDay = function(time) {

View file

@ -5,20 +5,20 @@ angular.module('copayApp.services').factory('timeService', function() {
root.withinSameMonth = function(time1, time2) {
if (!time1 || !time2) return false;
var date1 = new Date(time1 * 1000);
var date2 = new Date(time2 * 1000);
return getMonthYear(date1) === getMonthYear(date2);
var date1 = new Date(time1);
var date2 = new Date(time2);
return root.getMonthYear(date1) === root.getMonthYear(date2);
}
root.withinPastDay = function(time) {
var now = new Date();
var date = new Date(time * 1000);
var date = new Date(time);
return (now.getTime() - date.getTime()) < (1000 * 60 * 60 * 24);
};
root.isDateInCurrentMonth = function(date) {
var now = new Date();
return getMonthYear(now) === getMonthYear(date);
return root.getMonthYear(now) === root.getMonthYear(date);
};
root.getMonthYear = function(date) {

View file

@ -70,23 +70,33 @@
}
}
.item {
display: flex;
align-items: center;
background: #fff;
padding: 0 0 0 1rem;
margin: 0;
border: 0;
border-color: $item-border-color;
&.activity-header {
z-index: 3;
border: 0;
border-bottom: 1px solid #EFEFEF;
}
&.activity {
display: flex;
align-items: center;
background: #fff;
padding: 0 0 0 1rem;
margin: 0;
border: 0;
&.send .svg #-Transaction-icons {
}
&.receive .svg #-Transaction-icons {
stroke: #09C286;
}
&.pending .svg #-Transaction-icons {
stroke: $v-bitcoin-orange;
&.send .svg #-Transaction-icons {
}
&.receive .svg #-Transaction-icons {
stroke: #09C286;
}
&.pending .svg #-Transaction-icons {
stroke: $v-bitcoin-orange;
}
}
}
.tx-icon {
width: 36px;
height: 36px;
float: left;
margin-right: 25px;
}