]> git.openstreetmap.org Git - nominatim-ui.git/blobdiff - src/components/DetailsOneRow.svelte
replace httpbin with beeceptor for mocking HTTP error codes
[nominatim-ui.git] / src / components / DetailsOneRow.svelte
index b03831390e5bead3b36563a15db84639d2ddd8fd..67c5152be865481d5b7b3119103b07bd8e24a332 100644 (file)
@@ -1,16 +1,20 @@
 <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;
 
   export let addressLine;
   export let bDistanceInMeters;
+  export let bMarkUnusedLines = false;
 
 
-  $: bAddressLineUsed = addressLine.isaddress
-
-  import { formatPlaceType, osmLink, formatAdminLevel, formatDistance, detailsURL } from '../lib/helpers.js';
-
+  $: bAddressLineUsed = addressLine.isaddress;
+  $: reverse_only = Nominatim_Config.Reverse_Only;
 </script>
 
 </script>
 
-<tr class:notused={!bAddressLineUsed}>
-  <td class="name">
+<tr class:notused={bMarkUnusedLines && !bAddressLineUsed}>
+  <td class="name fw-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 !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 }}>search by name</PageLink>
+    {/if}
+  </td>
 </tr>
 
 <style>
 </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>
   }
 </style>