From fabc5d977909aed519ed11a281bba720abba28a3 Mon Sep 17 00:00:00 2001 From: mtmail Date: Wed, 10 Sep 2025 01:10:26 +0200 Subject: [PATCH] details page: HTML cleanup, use more tables (#304) --- src/components/DetailsTableHeader.svelte | 11 ++ src/pages/DetailsPage.svelte | 231 ++++++++++++----------- 2 files changed, 131 insertions(+), 111 deletions(-) create mode 100644 src/components/DetailsTableHeader.svelte diff --git a/src/components/DetailsTableHeader.svelte b/src/components/DetailsTableHeader.svelte new file mode 100644 index 0000000..8fc8a96 --- /dev/null +++ b/src/components/DetailsTableHeader.svelte @@ -0,0 +1,11 @@ + + + Local name + Type + OSM + Address rank + Admin level + Distance + + + \ No newline at end of file diff --git a/src/pages/DetailsPage.svelte b/src/pages/DetailsPage.svelte index 5e21553..d0d12af 100644 --- a/src/pages/DetailsPage.svelte +++ b/src/pages/DetailsPage.svelte @@ -10,6 +10,7 @@ import Header from '../components/Header.svelte'; import MapIcon from '../components/MapIcon.svelte'; import SearchSectionDetails from '../components/SearchSectionDetails.svelte'; + import DetailsTableHeader from '../components/DetailsTableHeader.svelte'; import DetailsOneRow from '../components/DetailsOneRow.svelte'; import DetailsLink from '../components/DetailsLink.svelte'; import DetailsPostcodeHint from '../components/DetailsPostcodeHint.svelte'; @@ -106,7 +107,7 @@
- - - + + {#if (isAdminBoundary(aPlace)) } - + {/if} - - + {#if aPlace.calculated_importance} - {/if} - - + - - {#if aPlace.calculated_wikipedia} - {/if} - - - @@ -170,48 +171,55 @@ + {:else if (window.location.search !== '' && api_request_finished)} + No such place found. + {/if} + + {#if aPlace}
+

Address

-
Name +
Name {#if aPlace.names && typeof (aPlace.names) === 'object' && Object.keys(aPlace.names).length} @@ -114,40 +115,40 @@ No Name {/if}
Type{aPlace.category}:{aPlace.type}
Last Updated{aPlace.indexed_date}
Type{aPlace.category}:{aPlace.type}
Last Updated{aPlace.indexed_date}
Admin Level{aPlace.admin_level}
Admin Level{aPlace.admin_level}
Search Rank{aPlace.rank_search}
Address Rank +
Search Rank{aPlace.rank_search}
Address Rank {aPlace.rank_address} ({formatAddressRank(aPlace.rank_address)})
Importance +
Importance {aPlace.calculated_importance} {#if !aPlace.importance} (estimated){/if}
Coverage{coverageType(aPlace)}
Centre Point (lat,lon) +
Coverage{coverageType(aPlace)}
Centre Point (lat,lon) {aPlace.centroid.coordinates[1]},{aPlace.centroid.coordinates[0]}
OSM +
OSM
Place Id +
Place Id {aPlace.place_id} ( on this server )
Wikipedia Calculated +
Wikipedia Calculated
Computed Postcode +
Computed Postcode {#if aPlace.calculated_postcode} {aPlace.calculated_postcode} {/if}
Address Tags +
Address Tags
Extra Tags +
Extra Tags
- - - - - - - - - - - - - {#if aPlace.address} + {#if aPlace.address} +
Local nameTypeOSMAddress rankAdmin levelDistance
+ + {#each aPlace.address as addressLine} {/each} - {/if} + +
+ {/if} - {#if aPlace.linked_places} -

Linked Places

+

Linked Places

+ {#if aPlace.linked_places} + + + {#each aPlace.linked_places as addressLine} {/each} - {/if} + +
+ {/if} -

Entrances

- {#if aPlace.entrances && aPlace.entrances.length} +

Entrances

+ {#if aPlace.entrances && aPlace.entrances.length} + + - - - - + + + + + + {#each aPlace.entrances as entrance, i} @@ -220,81 +228,81 @@ {/each} - {:else} - - {/if} + +
Entrance TypeOSMExtra TagsEntrance TypeOSMExtra Tags
{i + 1}
Place does not have entrances
+ {:else} +

Place does not have entrances

+ {/if} + + {#if !reverse_only} +

Keywords

+ {#if api_request_params.keywords} + {#if place_has_keywords(aPlace)} +

Name Keywords

- {#if !reverse_only} -

Keywords

- {#if api_request_params.keywords} + + + {#each aPlace.keywords.name as keyword} + + + {#if keyword.id} + + {/if} + + {/each} + +
{formatKeywordToken(keyword.token)}word id: {keyword.id}
+ {#if aPlace.keywords.address} +

Address Keywords

- {#if place_has_keywords(aPlace)} -

Name Keywords

- {#each aPlace.keywords.name as keyword} + + + {#each aPlace.keywords.address as keyword} - {#if keyword.id} - - {/if} + {/each} - - {#if aPlace.keywords.address} - - {#each aPlace.keywords.address as keyword} - - - {#if keyword.id} - - {/if} - - {/each} - {/if} - {:else} - - {/if} - {:else} - - - - {/if} + +
{formatKeywordToken(keyword.token)}word id: {keyword.id}word id: {keyword.id || '?'}

Address Keywords

{formatKeywordToken(keyword.token)}word id: {keyword.id}
Place has no keywords
- display keywords -
{/if} + {:else} +

Place has no keywords

+ {/if} + {:else} + display keywords + {/if} + {/if} -

Parent Of

- {#if api_request_params.hierarchy} - {#if aPlace.hierarchy && typeof (aPlace.hierarchy) === 'object' - && Object.keys(aPlace.hierarchy).length} - {#each Object.keys(aPlace.hierarchy) as type} -

{type}

- {#each aPlace.hierarchy[type] as line} - - {/each} - {/each} +

Parent Of

+ {#if api_request_params.hierarchy} + {#if aPlace.hierarchy && typeof (aPlace.hierarchy) === 'object' + && Object.keys(aPlace.hierarchy).length} - {#if Object.keys(aPlace.hierarchy) > 500} -

There are more child objects which are not shown.

- {/if} - {:else} - Place is not parent of other places - {/if} - {:else} - - - display child places - - - {/if} - - - -
+ {#each Object.keys(aPlace.hierarchy) as type} +

{type}

+ + + + {#each aPlace.hierarchy[type] as line} + + {/each} + +
+ {/each} + {#if Object.keys(aPlace.hierarchy) > 500} +

There are more child objects which are not shown.

+ {/if} + {:else} +

Place is not parent of other places

+ {/if} + {:else} + display child places + {/if} - {:else if (window.location.search !== '' && api_request_finished)} - No such place found. + {/if} @@ -313,12 +321,18 @@ h2 { font-size: 2em; - padding-left: 8px; background-color: var(--bs-body-bg); + border-bottom: 2px solid silver; + margin-top: 2em; + margin-bottom: 0.5em; } h3 { font-size: 1.5em; - padding-left: 8px; + } + + table#locationdetails td { + padding: 2px 8px; + font-size: 0.9em; } tr.all-columns { @@ -333,11 +347,6 @@ color: var(--bs-danger); } - tr.info-row td { - padding: 2px 8px; - font-size: 0.9em; - } - #map-wrapper { position: relative; width:100%; -- 2.39.5