Show last update time

This commit is contained in:
Thomas Wade 2018-10-06 22:19:45 +09:30
parent f99b8d57c2
commit b05c75fae4
3 changed files with 20 additions and 2 deletions

View File

@ -21,6 +21,7 @@
<div class="timeRemainingBar" ng-style="countdownStyle"></div> <div class="timeRemainingBar" ng-style="countdownStyle"></div>
</div> </div>
<div class="below">{{matesText()}}</div> <div class="below">{{matesText()}}</div>
<div class="lastAdded" ng-show="lastMate">Last mate: {{lastMate | date:'medium'}}</div>
</div> </div>
</body> </body>
</html> </html>

View File

@ -16,12 +16,15 @@ app.controller("mates", ["$scope", "$http", "$interval", function($scope, $http,
}; };
$scope.cooldown = false; $scope.cooldown = false;
$scope.lastMate = "";
$http.get("/mates") $http.get("/mates")
.then((r) => .then((r) =>
{ {
var json = angular.fromJson(r.data); var json = angular.fromJson(r.data);
$scope.mates = json.mates; $scope.mates = json.mates;
$scope.lastMate = json.lastUpdate;
animateCountdown($scope, $interval, json.lastUpdate, json.cooldown); animateCountdown($scope, $interval, json.lastUpdate, json.cooldown);
}); });
@ -39,8 +42,8 @@ app.controller("mates", ["$scope", "$http", "$interval", function($scope, $http,
if (json.error || r.status != 200) return; if (json.error || r.status != 200) return;
$scope.mates = json.mates; $scope.mates = json.mates;
$scope.lastMate = json.lastUpdate;
animateCountdown($scope, $interval, json.lastUpdate, json.cooldown); animateCountdown($scope, $interval, json.lastUpdate, json.cooldown);
}); });
}; };
}]); }]);

View File

@ -10,7 +10,7 @@ body
font-family: 'Arial', sans-serif; font-family: 'Arial', sans-serif;
font-size: 40pt; font-size: 40pt;
width: 300px; width: 400px;
height: 400px; height: 400px;
margin-top: calc(50vh - 200px); margin-top: calc(50vh - 200px);
margin-right: auto; margin-right: auto;
@ -70,3 +70,17 @@ body
background-color: #0009; background-color: #0009;
} }
.lastAdded
{
font-size: 15pt;
line-height: 50px;
width: 100%;
height: 50px;
text-align: center;
vertical-align: middle;
color: #444;
}