SPB Git forge

spb/ora-ka

Public

Ora-Ka — cinq agrégateurs Ka, une barre de recherche hybride (exact + sémantique)

4commits 1branches 0releases
13.4 MBsize
maindefault branch
22 days agolast push
Python 80% TypeScript 12.9% CSS 6.8%
1.8 KB · 5 lines javascript
Raw Blame History
1import{r as d,j as o}from"./index-DKrZ0X1u.js";import{m as c,s as m,b as u}from"./pills-Dduvidoh.js";function p(t,r,i){const s=[],n=i/111e3,e=i/(111e3*Math.cos(r*Math.PI/180));for(let a=0;a<=72;a++){const l=a/72*2*Math.PI;s.push([t+e*Math.cos(l),r+n*Math.sin(l)])}return{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[s]}}}function v({lat:t,lng:r,price:i,deal:s}){const n=d.useRef(null);return d.useEffect(()=>{if(!n.current)return;const e=new c.Map({container:n.current,style:m,center:[r,t],zoom:14.6,attributionControl:!1,scrollZoom:!1,dragRotate:!1});e.addControl(new c.NavigationControl({showCompass:!1}),"top-right"),e.touchZoomRotate.disableRotation(),e.on("load",()=>{e.addSource("rings",{type:"geojson",data:{type:"FeatureCollection",features:[p(r,t,400),p(r,t,1200)]}}),e.addLayer({id:"rings-fill",type:"fill",source:"rings",paint:{"fill-color":"#e23744","fill-opacity":.035}}),e.addLayer({id:"rings-line",type:"line",source:"rings",paint:{"line-color":"#b3202b","line-opacity":.55,"line-width":1.4,"line-dasharray":[3,3]}})});const a=document.createElement("div");a.className="pm-marker",a.innerHTML=`2      <div class="pm-pill${s?" pm-pill-deal":""}">${u(i)}${s?" ↓":""}</div>3      <div class="pm-pulse"></div>4      <div class="pm-dot"></div>`;const l=new c.Marker({element:a,anchor:"bottom"}).setLngLat([r,t]).addTo(e);return()=>{l.remove(),e.remove()}},[t,r,i,s]),o.jsxs("div",{className:"pm-wrap",children:[o.jsx("div",{ref:n,className:"mapview",role:"img","aria-label":"Emplacement de la propriété"}),o.jsxs("div",{className:"pm-rings-legend","aria-hidden":"true",children:[o.jsx("span",{children:"◌ 5 min à pied"}),o.jsx("span",{children:"◌ 15 min à pied"})]}),o.jsxs("div",{className:"mv-credit","aria-hidden":"true",children:["Cartographie ",o.jsx("b",{children:"Groupe Ka"})]})]})}export{v as default};5