2 import { page, results_store } from '../lib/stores.js';
3 import { get_config_value } from '../lib/config_reader.js';
4 import { fetch_from_api, update_html_title } from '../lib/api_utils.js';
6 import Header from '../components/Header.svelte';
7 import SearchSectionReverse from '../components/SearchSectionReverse.svelte';
8 import ResultsList from '../components/ResultsList.svelte';
9 import Map from '../components/Map.svelte';
11 let api_request_params;
13 let position_marker; // what the user searched for
15 function loaddata(search_params) {
18 api_request_params = {
19 lat: search_params.get('lat'),
20 lon: search_params.get('lon'),
21 zoom: (search_params.get('zoom') > 1
22 ? Number(search_params.get('zoom'))
23 : Number(get_config_value('Reverse_Default_Search_Zoom'))),
27 if (api_request_params.lat || api_request_params.lat) {
29 fetch_from_api('reverse', api_request_params, function (data) {
30 if (data && !data.error) {
31 position_marker = [api_request_params.lat, api_request_params.lon];
32 results_store.set([data]);
34 results_store.set([]);
37 update_html_title('Reverse result for '
38 + api_request_params.lat
40 + api_request_params.lon);
41 document.querySelector('input[name=lat]').focus();
44 results_store.set(undefined);
50 if (pageinfo.tab === 'reverse') {
51 loaddata(pageinfo.params);
57 <SearchSectionReverse {...api_request_params} />
62 <ResultsList bind:current_result reverse_search={true} />
64 <div id="map-wrapper">
65 <Map {current_result} {position_marker} display_minimap={true} />
75 display: inline-block;
82 height: calc(100vh - 250pt);
85 display: inline-block;
89 @media (max-width: 768px) {