]> git.openstreetmap.org Git - nominatim-ui.git/blob - src/components/DetailsOneRow.svelte
Rebundle latest version
[nominatim-ui.git] / src / components / DetailsOneRow.svelte
1 <script>
2   import DetailsLink from '../components/DetailsLink.svelte';
3   import PageLink from '../components/PageLink.svelte';
4   import {
5     formatPlaceType, osmLink, formatAdminLevel, formatDistance
6   } from '../lib/helpers.js';
7
8   export let addressLine;
9   export let bDistanceInMeters;
10   export let bMarkUnusedLines = false;
11
12   $: bAddressLineUsed = addressLine.isaddress;
13   $: reverse_only = Nominatim_Config.Reverse_Only;
14 </script>
15
16 <tr class:notused={bMarkUnusedLines && !bAddressLineUsed}>
17   <td class="name fw-bold">
18     {#if addressLine.localname}
19       {addressLine.localname}
20     {:else}
21       <span class="noname">No Name</span>
22     {/if}
23   </td>
24   <td>{formatPlaceType(addressLine)}</td>
25   <!-- eslint-disable-next-line svelte/no-at-html-tags -->
26   <td>{@html osmLink(addressLine)}</td>
27   <td>{addressLine.rank_address}</td>
28   <td>{formatAdminLevel(addressLine.admin_level)}</td>
29   <!-- eslint-disable-next-line svelte/no-at-html-tags -->
30   <td>{@html formatDistance(addressLine.distance, bDistanceInMeters)}</td>
31   <td>
32     {#if addressLine.osm_id}
33       <DetailsLink feature={addressLine}>
34         details
35       </DetailsLink>
36     {:else if !reverse_only && addressLine.type.match(/^country/)}
37       <PageLink page='search' params_hash={{ country: addressLine.localname }}>
38         search by name
39       </PageLink>
40     {:else if !reverse_only && addressLine.type === 'postcode'}
41       <PageLink page='search' params_hash={{ postalcode: addressLine.localname }}>
42         search by name
43       </PageLink>
44     {/if}
45   </td>
46 </tr>
47
48 <style>
49   .notused td {
50     color: #ccc;
51   }
52
53   td {
54     padding: 2px 8px;
55     font-size: 0.9em;
56   }
57 </style>