X-Git-Url: https://git.openstreetmap.org./nominatim-ui.git/blobdiff_plain/163775c3501257af8f62601b0bb3565133c3bebb..c061d3fd3d4c9135fdbda0af273d9fc0dc5b5535:/src/pages/DetailsPage.svelte

diff --git a/src/pages/DetailsPage.svelte b/src/pages/DetailsPage.svelte
index 5d6e663..d480050 100644
--- a/src/pages/DetailsPage.svelte
+++ b/src/pages/DetailsPage.svelte
@@ -1,25 +1,26 @@
 <script>
-  import { onMount } from 'svelte';
   import { fetch_from_api, update_html_title } from '../lib/api_utils.js';
+  import { page } from '../lib/stores.js';
 
   import {
-    osmLink, detailsURL, wikipediaLink, coverageType, isAdminBoundary,
+    osmLink, wikipediaLink, coverageType, isAdminBoundary,
     formatAddressRank, formatKeywordToken
   } from '../lib/helpers.js';
+  import Header from '../components/Header.svelte';
   import MapIcon from '../components/MapIcon.svelte';
-  import DetailsIndex from '../components/DetailsIndex.svelte';
+  import SearchSectionDetails from '../components/SearchSectionDetails.svelte';
   import DetailsOneRow from '../components/DetailsOneRow.svelte';
+  import DetailsLink from '../components/DetailsLink.svelte';
   import Map from '../components/Map.svelte';
 
   let aPlace;
   let errorResponse;
   let base_url = window.location.search;
   let current_result;
+  let api_request_params;
 
-  function loaddata() {
-    var search_params = new URLSearchParams(window.location.search);
-
-    var api_request_params = {
+  function loaddata(search_params) {
+    api_request_params = {
       place_id: search_params.get('place_id'),
       osmtype: search_params.get('osmtype'),
       osmid: search_params.get('osmid'),
@@ -41,6 +42,7 @@
       }
 
       fetch_from_api('details', api_request_params, function (data) {
+        window.scrollTo(0, 0);
         if (data.error) {
           errorResponse = data;
           current_result = undefined;
@@ -54,10 +56,18 @@
       aPlace = undefined;
     }
   }
-  onMount(loaddata);
 
+  $: {
+    let pageinfo = $page;
+    if (pageinfo.tab === 'details') {
+      loaddata(pageinfo.params);
+    }
+  }
 </script>
 
+<Header>
+  <SearchSectionDetails api_request_params={api_request_params}/>
+</Header>
 {#if errorResponse}
   {errorResponse.error.message}
 {/if}
@@ -67,7 +77,7 @@
       <div class="col-sm-10">
         <h1>
           {aPlace.localname}
-          <small><a href="{detailsURL(aPlace)}">link to this page</a></small>
+          <small><DetailsLink feature={aPlace}>link to this page</DetailsLink></small>
         </h1>
       </div>
       <div class="col-sm-2 text-right">
@@ -265,7 +275,7 @@
     </div>
   </div>
 {:else if (window.location.search === '')}
-  <DetailsIndex/>
+  <!-- <DetailsIndex/> -->
 {:else}
   No such place found.
 {/if}
@@ -278,7 +288,7 @@
     padding-left: 8px;
   }
 
-  h1 small a {
+  h1 small :global(a) {
     font-size: 0.5em;
     white-space: nowrap;
   }
