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