]> git.openstreetmap.org Git - nominatim-ui.git/blobdiff - src/components/DetailsOneRow.svelte
version 3.1.0 (#143)
[nominatim-ui.git] / src / components / DetailsOneRow.svelte
index 1ab566d57f70101595daa78bf8c84ad8f9ee1736..4c439070b1012b8e7ab30bdbe722b4bb078905f6 100644 (file)
@@ -1,19 +1,20 @@
 <script>
   import DetailsLink from '../components/DetailsLink.svelte';
 <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;
 
   export let addressLine;
   export let bDistanceInMeters;
+  export let bMarkUnusedLines = false;
 
   $: bAddressLineUsed = addressLine.isaddress;
 
 
   $: bAddressLineUsed = addressLine.isaddress;
 
-  import {
-    formatPlaceType, osmLink, formatAdminLevel, formatDistance
-  } from '../lib/helpers.js';
-
 </script>
 
 </script>
 
-<tr class:notused={!bAddressLineUsed}>
-  <td class="name">
+<tr class:notused={bMarkUnusedLines && !bAddressLineUsed}>
+  <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}<DetailsLink feature={addressLine}>details</DetailsLink>{/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;
+
+  td {
+    padding: 2px 8px;
+    font-size: 0.9em;
   }
 </style>
   }
 </style>