]> git.openstreetmap.org Git - nominatim-ui.git/blobdiff - src/components/LastUpdated.svelte
Error section (#90)
[nominatim-ui.git] / src / components / LastUpdated.svelte
index f2699031779216696dd492b7536d0d746fcf1374..3f914cebffe9faa546097f8dbb643f5f50ebcb0d 100644 (file)
@@ -1,4 +1,5 @@
 <script>
+  import * as timeago from 'timeago.js';
   import { last_api_request_url_store } from '../lib/stores.js';
   import { fetch_from_api } from '../lib/api_utils.js';
 
 
 <style>
   #last-updated {
-    font-size: 0.7em;
-    white-space: nowrap;
-    text-align: center;
+    position: relative;
+    font-size: 0.8rem;
+    font-style: italic;
   }
   #loading {
     display: none;
     position: absolute;
+    padding: 0.5em 1em;
     top: 0;
+    left: 0;
     width: 100%;
     background-color: #eee;
     z-index: 100;
-    padding: 10px;
-    text-align: center;
   }
 </style>
 
-<div id="last-updated">
-  <div id="loading">loading...</div>
-  {#if last_updated_date}
-    {#if last_api_request_url}
-      <div id="api-request">
-        Data from <a href="{last_api_request_url}">API request</a>
-        <span id="api-request-debug">
-          (<a href="{last_api_request_url}&debug=1">debug output</a>)
-        </span>
-      </div>
-    {/if}
-    Data last updated: <span id="data-date">{last_updated_date}</span>
-  {/if}
+<div id="last-updated" class="container-fluid py-2 px-4 mb-3">
+  <div id="loading" class="py-2 px-4">
+    <div class="spinner-border spinner-border-sm text-primary mr-1" role="status"></div>
+    Loading data from API ...
+  </div>
+  <div class="row">
+    <div class="col-sm-6">
+      {#if last_api_request_url}
+        <div id="api-request">
+          Data from <a href="{last_api_request_url}">API request</a>
+          <span id="api-request-debug">
+            (<a href="{last_api_request_url}&debug=1">debug output</a>)
+          </span>
+        </div>
+      {/if}
+    </div>
+    <div class="col-sm-6 text-right">
+      {#if last_updated_date}
+        Data last updated:
+        <abbr id="data-date" title="{last_updated_date} (UTC timezone)">{timeago.format(new Date(last_updated_date))}</abbr>
+      {/if}
+    </div>
+  </div>
 </div>