X-Git-Url: https://git.openstreetmap.org./nominatim-ui.git/blobdiff_plain/c9687b102bb6f544a034dc4d508bf0ae4a5fc221..2ba00544d30017ad30570011b1a2bcc6a8da73a7:/src/components/DetailsOneRow.svelte

diff --git a/src/components/DetailsOneRow.svelte b/src/components/DetailsOneRow.svelte
index b038313..8ba3769 100644
--- a/src/components/DetailsOneRow.svelte
+++ b/src/components/DetailsOneRow.svelte
@@ -1,16 +1,21 @@
 <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 bMarkUnusedLines = false;
+  export let sCountryCode;
 
-  $: bAddressLineUsed = addressLine.isaddress
-
-  import { formatPlaceType, osmLink, formatAdminLevel, formatDistance, detailsURL } from '../lib/helpers.js';
-
+  $: bAddressLineUsed = addressLine.isaddress;
+  $: reverse_only = Nominatim_Config.Reverse_Only;
 </script>
 
-<tr class:notused={!bAddressLineUsed}>
-  <td class="name">
+<tr class:notused={bMarkUnusedLines && !bAddressLineUsed}>
+  <td class="name fw-bold">
     {#if addressLine.localname}
       {addressLine.localname}
     {:else}
@@ -18,21 +23,37 @@
     {/if}
   </td>
   <td>{formatPlaceType(addressLine)}</td>
+  <!-- eslint-disable-next-line svelte/no-at-html-tags -->
   <td>{@html osmLink(addressLine)}</td>
   <td>{addressLine.rank_address}</td>
   <td>{formatAdminLevel(addressLine.admin_level)}</td>
+  <!-- eslint-disable-next-line svelte/no-at-html-tags -->
   <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 !reverse_only && addressLine.type.match(/^country/)}
+      <PageLink page='search' params_hash={{ country: addressLine.localname }}>
+        search by name
+      </PageLink>
+    {:else if !reverse_only && addressLine.type === 'postcode'}
+      <PageLink page='search'
+                params_hash={{ postalcode: addressLine.localname, country: sCountryCode }}>
+        search by name
+      </PageLink>
+    {/if}
+  </td>
 </tr>
 
 <style>
-  .notused {
-    color:#ddd;
-  }
-  .name{
-    font-weight: bold;
+  .notused td {
+    color: #ccc;
   }
-  .noname{
-    color:#800;
+
+  td {
+    padding: 2px 8px;
+    font-size: 0.9em;
   }
 </style>
