X-Git-Url: https://git.openstreetmap.org/nominatim-ui.git/blobdiff_plain/f9ae81bddd61b9749df987e6c8ee9263ae464705..93e26bcdb513375933713ad7fad61b30c14dc7ab:/src/components/Header.svelte?ds=sidebyside

diff --git a/src/components/Header.svelte b/src/components/Header.svelte
index a93d6c5..0d678bd 100644
--- a/src/components/Header.svelte
+++ b/src/components/Header.svelte
@@ -8,6 +8,7 @@
 
   $: view = $page.tab;
   $: page_title = Nominatim_Config.Page_Title;
+  $: reverse_only = Nominatim_Config.Reverse_Only;
 
   let map_lat;
   let map_lon;
@@ -16,8 +17,8 @@
     if (!map) return;
 
     map.on('move', function () {
-      map_lat = map.getCenter().lat;
-      map_lon = map.getCenter().lng;
+      map_lat = map.getCenter().lat.toFixed(5);
+      map_lon = map.getCenter().lng.toFixed(5);
     });
   });
 </script>
@@ -67,33 +68,54 @@
     <div class="container-fluid">
       <!-- Brand -->
       <div class="navbar-brand">
-        <PageLink page="search">
+        <PageLink page={reverse_only ? 'reverse' : 'search'}>
           <img alt="logo" id="theme-logo" src="theme/logo.png" />
           <h1>{page_title}</h1>
         </PageLink>
       </div>
       <!-- Toggler (hamburger button) -->
-      <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
+      <button class="navbar-toggler"
+              type="button"
+              data-bs-toggle="collapse"
+              data-bs-target="#navbarSupportedContent"
+              aria-controls="navbarSupportedContent"
+              aria-expanded="false"
+              aria-label="Toggle navigation">
         <span class="navbar-toggler-icon"></span>
       </button>
       <div class="collapse navbar-collapse" id="navbarSupportedContent">
         <!-- Left-aligned links -->
         <ul class="navbar-nav me-auto">
+          {#if !reverse_only}
+            <li class="nav-item">
+              <PageLink page="search"
+                        extra_classes="nav-link {view === 'search' ? 'active' : ''}">
+                Search
+              </PageLink>
+            </li>
+          {/if}
           <li class="nav-item">
-            <PageLink page="search" extra_classes="nav-link {view === 'search' ? 'active' : ''}">Search</PageLink>
+            <ReverseLink lat={map_lat}
+                         lon={map_lon}
+                         extra_classes="nav-link {view === 'reverse' ? 'active' : ''}">
+              Reverse
+            </ReverseLink>
           </li>
           <li class="nav-item">
-            <ReverseLink lat={map_lat} lon={map_lon} extra_classes="nav-link {view === 'reverse' ? 'active' : ''}">Reverse</ReverseLink>
-          </li>
-          <li class="nav-item">
-            <PageLink page="details" extra_classes="nav-link {view === 'details' ? 'active' : ''}">Search By ID</PageLink>
+            <PageLink page="details"
+                      extra_classes="nav-link {view === 'details' ? 'active' : ''}">
+              Search By ID
+            </PageLink>
           </li>
         </ul>
       </div>
       <!-- Right aligned links -->
       <ul class="navbar-nav">
         <li class="nav-item">
-          <PageLink page="about" extra_classes="nav-link {view === 'about' ? 'active' : ''}">About & Help</PageLink>
+          <PageLink page="about"
+                    extra_classes="nav-link {view === 'about' ? 'active' : ''}">
+            About & Help
+          </PageLink>
         </li>
       </ul>
     </div>
