]> git.openstreetmap.org Git - nominatim-ui.git/blobdiff - src/components/DetailsOneRow.svelte
Error section (#90)
[nominatim-ui.git] / src / components / DetailsOneRow.svelte
index cde2ac2411f83d44ac8267735bc3e2b47a6cf50d..cd74d93ecdb65ccfef42f4fe9f0c287d3ba6a262 100644 (file)
@@ -1,18 +1,19 @@
 <script>
 <script>
+  import DetailsLink from '../components/DetailsLink.svelte';
+  import PageLink from '../components/PageLink.svelte';
+  import {
+    formatPlaceType, osmLink, formatAdminLevel, formatDistance
+  } from '../lib/helpers.js';
 
   export let addressLine;
   export let bDistanceInMeters;
 
   $: bAddressLineUsed = addressLine.isaddress;
 
 
   export let addressLine;
   export let bDistanceInMeters;
 
   $: bAddressLineUsed = addressLine.isaddress;
 
-  import {
-    formatPlaceType, osmLink, formatAdminLevel, formatDistance, detailsURL
-  } from '../lib/helpers.js';
-
 </script>
 
 <tr class:notused={!bAddressLineUsed}>
 </script>
 
 <tr class:notused={!bAddressLineUsed}>
-  <td class="name">
+  <td class="name font-weight-bold">
     {#if addressLine.localname}
       {addressLine.localname}
     {:else}
     {#if addressLine.localname}
       {addressLine.localname}
     {:else}
   <td>{addressLine.rank_address}</td>
   <td>{formatAdminLevel(addressLine.admin_level)}</td>
   <td>{@html formatDistance(addressLine.distance, bDistanceInMeters)}</td>
   <td>{addressLine.rank_address}</td>
   <td>{formatAdminLevel(addressLine.admin_level)}</td>
   <td>{@html formatDistance(addressLine.distance, bDistanceInMeters)}</td>
-  <td>{#if addressLine.osm_id}<a href="{detailsURL(addressLine)}">details</a>{/if}</td>
+  <td>
+    {#if addressLine.osm_id}
+      <DetailsLink feature={addressLine}>details</DetailsLink>
+    {:else if addressLine.type.match(/^country/)}
+      <PageLink page='search', params_hash={{ country: addressLine.localname }}>search by name</PageLink>
+    {:else if addressLine.type === 'postcode'}
+      <PageLink page='search', params_hash={{ postalcode: addressLine.localname }}>search by name</PageLink>
+    {/if}
+  </td>
 </tr>
 
 <style>
   .notused {
     color:#ddd;
   }
 </tr>
 
 <style>
   .notused {
     color:#ddd;
   }
-  .name{
-    font-weight: bold;
-  }
   .noname{
     color:#800;
   }
   .noname{
     color:#800;
   }