From d58f61770463aab2c71464c11f902f0074b49b62 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Mon, 15 Jan 2024 15:50:43 +0100 Subject: http catch-up --- views/http/account.twig | 22 ++++++++++++ views/http/base.twig | 7 +++- views/http/components/timer.twig | 6 ++++ views/http/village.twig | 72 +++++++++++++++++++++++++++++++++++++--- 4 files changed, 101 insertions(+), 6 deletions(-) create mode 100644 views/http/account.twig (limited to 'views/http') diff --git a/views/http/account.twig b/views/http/account.twig new file mode 100644 index 0000000..8b32feb --- /dev/null +++ b/views/http/account.twig @@ -0,0 +1,22 @@ +{% extends 'base.twig' %} + +{% block main %} +

Account

+ +
+ + + + + +
+{% endblock %} diff --git a/views/http/base.twig b/views/http/base.twig index 15ddafd..bd59207 100644 --- a/views/http/base.twig +++ b/views/http/base.twig @@ -5,7 +5,12 @@
Logged in as {{ session.user.username }}
diff --git a/views/http/components/timer.twig b/views/http/components/timer.twig index ccb31a7..4898a2e 100644 --- a/views/http/components/timer.twig +++ b/views/http/components/timer.twig @@ -14,12 +14,18 @@ document.addEventListener('DOMContentLoaded', function (ev) { window.location.reload(); } + const dd = Math.floor(diff/1000/60/60/24); + diff -= dd*1000*60*60*24; const hh = Math.floor(diff/1000/60/60); diff -= hh*1000*60*60; const mm = Math.floor(diff/1000/60); diff -= mm*1000*60; const ss = Math.floor(diff/1000); + timer.innerHTML = `${('00' + hh).slice(-2)}:${('00' + mm).slice(-2)}:${('00' + ss).slice(-2)}`; + if (dd > 0) { + timer.innerHTML = `${('00' + dd).slice(-2)}:${timer.innerHTML}`; + } } setTime(); }); diff --git a/views/http/village.twig b/views/http/village.twig index c157a04..a498ea6 100644 --- a/views/http/village.twig +++ b/views/http/village.twig @@ -132,7 +132,7 @@ {% endif %} {% if events['SendUnits'] %} -

Send Resources / Units

+

Send Units

@@ -172,6 +172,68 @@
{% endif %} + + {% if events['SendResources'] %} +

Send Resources

+ + + + + + + + + + + + {% for event in events['SendResources'] %} + + + + + + + + {% endfor %} + +
SourceDestinationResourcesTime
{{ village.get(event.source).name }}{{ village.get(event.destination).name }}Resources + {% include 'components/timer.twig' with { 'time': event.event.time|date('c') } %} + + {% if event.isCanceled %} + Canceled + {% else %} + {% if event.event.villageId == village.id %} +
+ +
+ {% endif %} + {% endif %} +
+ {% endif %} + + {% if events['SendResourcesCarriers'] %} +

Send Resources Carriers

+ + + + + + + + + + {% for event in events['SendResourcesCarriers'] %} + + + + + + {% endfor %} + +
SourceDestinationTime
{{ village.get(event.source).name }}{{ village.get(event.destination).name }} + {% include 'components/timer.twig' with { 'time': event.event.time|date('c') } %} +
+ {% endif %}
@@ -344,10 +406,10 @@ {% if village.getBuilding(village.id, 'PostOffice') %}

Send Resources

- - - - + + + +