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 ReverseBar from '../components/ReverseBar.svelte';
7 import ResultsList from '../components/ResultsList.svelte';
8 import Map from '../components/Map.svelte';
10 let api_request_params;
12 let position_marker; // what the user searched for
14 function loaddata(search_params) {
17 api_request_params = {
18 lat: search_params.get('lat'),
19 lon: search_params.get('lon'),
20 zoom: (search_params.get('zoom') > 1
21 ? Number(search_params.get('zoom'))
22 : Number(get_config_value('Reverse_Default_Search_Zoom'))),
26 if (api_request_params.lat || api_request_params.lat) {
28 fetch_from_api('reverse', api_request_params, function (data) {
29 if (data && !data.error) {
30 position_marker = [api_request_params.lat, api_request_params.lon];
31 results_store.set([data]);
33 results_store.set([]);
36 update_html_title('Reverse result for '
37 + api_request_params.lat
39 + api_request_params.lon);
40 document.querySelector('input[name=lat]').focus();
43 results_store.set(undefined);
49 if (pageinfo.tab === 'reverse') {
50 loaddata(pageinfo.params);
55 <ReverseBar {...api_request_params} />
59 <ResultsList bind:current_result reverse_search={true} />
61 <div id="map-wrapper">
62 <Map {current_result} {position_marker} display_minimap={true} />
72 display: inline-block;
79 height: calc(100vh - 250pt);
82 display: inline-block;
86 @media (max-width: 768px) {