From 9aecf3a523bcd379a5afc66bb26d181361154264 Mon Sep 17 00:00:00 2001 From: JeremyJamesL Date: Tue, 17 Dec 2024 20:02:52 +0000 Subject: readme --- src/main.js | 41 +++++++++++++---------------------------- 1 file changed, 13 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/main.js b/src/main.js index 1466b3f..ac19077 100644 --- a/src/main.js +++ b/src/main.js @@ -1,7 +1,7 @@ import { algoliasearch } from 'algoliasearch'; -const ALGOLIA_KEY = '9fb3db0222f7b5aef0e2b30791ee6201'; +import slugify from '@sindresorhus/slugify'; const INDEX_NAME = 'pubfinder'; -const client = algoliasearch('YSWWVAX5RB', ALGOLIA_KEY); +const client = algoliasearch('YSWWVAX5RB', '4203de3b08b981c149883b0af830db30'); const $ = document.querySelector.bind(document); const dataController = (function () { @@ -41,14 +41,9 @@ const dataController = (function () { geoParam = { insideBoundingBox: [bounds], }; - } else if (shape === 'polygon') { - geoParam = { - insidePolygon: [bounds], - }; } else { geoParam = { - aroundLatLng: bounds, - // aroundRadius: 1000, + insidePolygon: [bounds], }; } @@ -76,8 +71,6 @@ const interfaceController = (function () { const DOMStrings = { selectRect: '.select--rectangle', selectPoly: '.select--polygon', - ip: '.select--ip', - ipLoader: '.ip-loader', hits: '#hits', searchBar: '#searchbar', pubCount: '.pub-count', @@ -141,7 +134,13 @@ const interfaceController = (function () { }); const window = new InfoWindow({ - content: hit.name, + content: ` +

${hit.name}

+

${hit.address}

+ 📍 + `, }); marker.addListener('click', function () { @@ -164,7 +163,9 @@ const interfaceController = (function () { html += `
  • ${pub.name}

    ${pub.address}, ${pub.postcode}

    - + @@ -310,22 +311,6 @@ const controller = (function (dataCTRL, uiCTRL) { await setupMapListeners(); }); - // $(DOM.ip).addEventListener('click', async () => { - // $(DOM.ipLoader).classList.replace('hidden', 'inline-flex'); - // navigator.geolocation.getCurrentPosition(async (pos) => { - // const position = { lat: pos.coords.latitude, lng: pos.coords.longitude }; - // await uiCTRL.initMap('', centralPoint, position, '', 'ip', 8); - // const searchResults = await dataCTRL.getSearchResults( - // dataCTRL.getCurrentQuery(), - // 'ip', - // `${pos.coords.latitude}, ${pos.coords.longitude}`, - // 20 - // ); - // await uiCTRL.embedSearchResults(searchResults.hits); - // uiCTRL.updateHitsList(searchResults.hits); - // $(DOM.ipLoader).classList.replace('inline-flex', 'hidden'); - // }); - // }), $(DOM.searchBar).addEventListener('input', async (e) => { const q = dataCTRL.getCurrentQuery(); if (q > 0 && q < 3) return; -- cgit v1.2.3