X-Git-Url: https://git.openstreetmap.org/nominatim-ui.git/blobdiff_plain/71b9066d9eed97aee7eff27a25d5c317b6f89595..72012a070dc88cf6b6ce393a6698a3aa6df10a3c:/src/components/Header.svelte?ds=sidebyside

diff --git a/src/components/Header.svelte b/src/components/Header.svelte
index 06f3bd4..514fe20 100644
--- a/src/components/Header.svelte
+++ b/src/components/Header.svelte
@@ -2,11 +2,24 @@
   import PageLink from './PageLink.svelte';
   import ReverseLink from './ReverseLink.svelte';
   import LastUpdated from './LastUpdated.svelte';
+  import Error from './Error.svelte';
 
-  import { page } from '../lib/stores.js';
-  import { get_config_value } from '../lib/config_reader.js';
+  import { map_store, page } from '../lib/stores.js';
 
   $: view = $page.tab;
+  $: page_title = Nominatim_Config.Page_Title;
+
+  let map_lat;
+  let map_lon;
+
+  map_store.subscribe(map => {
+    if (!map) return;
+
+    map.on('move', function () {
+      map_lat = map.getCenter().lat;
+      map_lon = map.getCenter().lng;
+    });
+  });
 </script>
 
 <style>
@@ -55,7 +68,7 @@
     <div class="navbar-brand">
       <PageLink page="search">
         <img alt="logo" id="theme-logo" src="theme/logo.png" />
-        <h1>{get_config_value('Page_Title')}</h1>
+        <h1>{page_title}</h1>
       </PageLink>
     </div>
     <!-- Toggler (hamburger button) -->
@@ -66,20 +79,20 @@
       <!-- Left-aligned links -->
       <ul class="navbar-nav mr-auto">
         <li class="nav-item {view === 'search' ? 'active' : ''}">
-          <PageLink page="search" extra_classes="nav-link ">Search</PageLink>
+          <PageLink page="search" extra_classes="nav-link">Search</PageLink>
         </li>
         <li class="nav-item {view === 'reverse' ? 'active' : ''}">
-          <ReverseLink extra_classes="nav-link ">Reverse</ReverseLink>
+          <ReverseLink lat={map_lat} lon={map_lon} extra_classes="nav-link">Reverse</ReverseLink>
         </li>
         <li class="nav-item {view === 'details' ? 'active' : ''}">
-          <PageLink page="details" extra_classes="nav-link ">Search By ID</PageLink>
+          <PageLink page="details" extra_classes="nav-link">Search By ID</PageLink>
         </li>
       </ul>
     </div>
     <!-- Right aligned links -->
     <ul class="navbar-nav">
       <li class="nav-item {view === 'about' ? 'active' : ''}">
-        <PageLink page="about" extra_classes="nav-link ">About & Help</PageLink>
+        <PageLink page="about" extra_classes="nav-link">About & Help</PageLink>
       </li>
     </ul>
   </nav>
@@ -90,4 +103,5 @@
 <section class="search-section">
   <slot/>
 </section>
+<Error/>
 <LastUpdated/>
