PageSourceSearch

https://indyhackers.org/assets/EventDetailView-TZSnpL1d.js

js indyhackers.org collected 2026-10-08 10:53:41 UTC 10,193 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/leaflet-src-CwXL5LFX.js","assets/_commonjsHelpers-gnU0ypJ3.js"])))=>i.map(i=>d[i]);
2import{_ as z,s as q,z as g,u as U,r as I,c as i,F as h,a as n,b as C,w as A,e as w,L as B,ae as N,f as O,t as y,x as P,af as Y,i as L,o as s,G as Z,I as W,a7 as G,B as k,ag as R,ah as H,ai as J,p as K,aj as Q,k as X}from"./app-CNcGIC74.js";import{T as ee}from"./TopicBadge-DvA20DWK.js";const te={class:"reminder"},ae=["value"],ne=["disabled"],le=["value"],se=["disabled"],ie={key:3,class:"reminder__error"},oe={__name:"ReminderToggle",props:{series:{type:Object,required:!0}},setup(E){const m=E,r=q("pocketbase"),e=Y,p=g(!!(r.authStore&&r.authStore.isValid)),l=g(null),o=g(1440),u=g(!1),v=g("");function S(){var d;return r.authStore.record?r.authStore.record.id:(d=r.authStore.model)==null?void 0:d.id}async function T(){if(p.value)try{const d=await r.collection("subscriptions").getFirstListItem(`event_series="${m.series.id}" && user="${S()}"`);l.value=d,o.value=d.lead_time_minutes}catch{l.value=null}}async function $(){u.value=!0,v.value="";try{l.value=await r.collection("subscriptions").create({user:S(),event_series:m.series.id,lead_time_minutes:o.value})}catch(d){v.value=d.message||"Could not subscribe"}finally{u.value=!1}}async function D(){if(l.value){u.value=!0,v.value="";try{l.value=await r.collection("subscriptions").update(l.value.id,{lead_time_minutes:o.value})}catch(d){v.value=d.message||"Could not update reminder"}finally{u.value=!1}}}async function M(){if(l.value){u.value=!0,v.value="";try{await r.collection("subscriptions").delete(l.value.id),l.value=null}catch(d){v.value=d.message||"Could not unsubscribe"}finally{u.value=!1}}}return U(T),(d,c)=>{const V=I("router-link");return s(),i("div",te,[p.value?l.value?(s(),i(h,{key:1},[c[4]||(c[4]=n("p",{class:"reminder__active"},[n("span",{"aria-hidden":"true"},"✓"),w(" You're subscribed")],-1)),c[5]||(c[5]=n("label",{class:"reminder__label"},"Remind me",-1)),B(n("select",{"onUpdate:modelValue":c[0]||(c[0]=_=>o.value=_),class:"reminder__select",onChange:D},[(s(!0),i(h,null,O(P(e),_=>(s(),i("option",{key:_.minutes,value:_.minutes},y(_.label),9,ae))),128))],544),[[N,o.value,void 0,{number:!0}]]),n("button",{class:"reminder__off",disabled:u.value,onClick:M},"Turn off reminders",8,ne)],64)):(s(),i(h,{key:2},[c[6]||(c[6]=n("label",{class:"reminder__label"},"Remind me",-1)),B(n("select",{"onUpdate:modelValue":c[1]||(c[1]=_=>o.value=_),class:"reminder__select"},[(s(!0),i(h,null,O(P(e),_=>(s(),i("option",{key:_.minutes,value:_.minutes},y(_.label),9,le))),128))],512),[[N,o.value,void 0,{number:!0}]]),n("button",{class:"ih-btn-primary reminder__btn",disabled:u.value,onClick:$}," Subscribe to reminders ",8,se)],64)):(s(),i(h,{key:0},[c[3]||(c[3]=n("p",{class:"reminder__hint"},"Sign in to get an email reminder before each occurrence.",-1)),C(V,{to:"/login",class:"ih-btn-primary reminder__btn"},{default:A(()=>[...c[2]||(c[2]=[w("Sign in",-1)])]),_:1}
2)],64)),v.value?(s(),i("p",ie,y(v.value),1)):L("",!0)])}}},re=z(oe,[["__scopeId","data-v-7eecb3e7"]]),ue={key:0,class:"event-location-map"},ce=["aria-label"],j=11,de={__name:"EventLocationMap",props:{lat:{type:Number,default:null},lng:{type:Number,default:null},location:{type:String,default:""}},setup(E){let m=null;async function r(){return m||(m=(await H(async()=>{const{default:T}=await import("./leaflet-src-CwXL5LFX.js").then($=>$.l);return{default:T}},__vite__mapDeps([0,1]))).default),m}const e=E,p=g(null);let l=null,o=null;const u=k(()=>R({lat:e.lat,lng:e.lng}));function v(){return m.divIcon({className:"event-location-map__pin-wrap",html:'<span class="event-location-map__pin"></span>',iconSize:[26,26],iconAnchor:[13,13]})}async function S(){l||!p.value||!u.value||(await r(),!(l||!p.value)&&(l=m.map(p.value,{scrollWheelZoom:!1}).setView([e.lat,e.lng],j),m.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png",{maxZoom:19,attribution:'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}).addTo(l),o=m.marker([e.lat,e.lng],{icon:v(),title:e.location,alt:e.location}).addTo(l)))}return Z(()=>[e.lat,e.lng],async()=>{if(await W(),!!u.value){if(!l){await S();return}l.invalidateSize(),l.setView([e.lat,e.lng],j),o&&o.setLatLng([e.lat,e.lng])}}),U(async()=>{await W(),await S()}),G(()=>{l&&(l.remove(),l=null,o=null)}),(T,$)=>u.value?(s(),i("div",ue,[n("div",{ref_key:"mapEl",ref:p,class:"event-location-map__canvas",role:"application","aria-label":`Map showing ${E.location}`},null,8,ce)])):L("",!0)}},ve=z(de,[["__scopeId","data-v-d0583dd4"]]),_e={class:"event-detail"},me={class:"ih-container"},pe={class:"event-detail__back"},fe={key:0,class:"event-detail__state"},be={key:1,class:"event-detail__state event-detail__state--error"},ge={key:2,class:"event-detail__grid"},ye={class:"event-detail__main"},he=["src","alt"],ke={key:1,class:"event-detail__topics"},we={class:"event-detail__title"},Le={class:"event-detail__facts"},Se={class:"event-detail__fact"},Te={key:0,class:"event-detail__fact"},$e=["innerHTML"],Ce={class:"event-detail__aside"},Ee={class:"event-detail__card"},xe={class:"event-detail__card-sub"},Ae={class:"event-detail__card event-detail__card--own"},De={key:0,class:"event-detail__card-sub"},Me={key:1,class:"event-detail__card-sub"},Ve={key:2,class:"event-detail__card-sub"},Ie=["disabled"],Oe={key:0,class:"event-detail__card-error"},Re={__name:"EventDetailView",setup(E){const m=J(),r=q("pocketbase"),e=g(null),p=g(!0),l=g(null),o=g("idle"),u=g(""),v=k(()=>{var t;return((t=r.authStore.record)==null?void 0:t.id)||""}),S=k(()=>r.authStore.isValid),T=k(()=>!!e.value&&e.value.owner===v.value);async function $(){o.value="submitting",u.value="";try{await r.collection("event_ownership_requests").create({event:e.value.id,requested_by:v.value,status:"pending"}),o.value="done"}catch(t){console.error("Ownership claim failed:",t),o.value="error",u.value=(t==null?void 0:t.status)===401||(t==null?void 0:t.status)===403?"Please log in to claim this event.":"Could not submit your claim. Please try again."}}function D(t,a,f){try{return r.files.getURL(t,a,f)||""}catch{return""}}function M(t){const a=t.expand||{},f=a.event_series||null;return{id:t.id,title:t.title||"(untitled event)",description:t.description||"",location:t.location||"",url:t.url||"",start:t.starts_at,end:t.ends_at||null,isAllDay:!!t.all_day,image:t.image?D(t,t.image,{thumb:"1280x720f"}):"",lat:R(t)?t.lat:null,lng:R(t)?t.lng:null,owner:t.owner||"",series:f?{id:f.id,title:f.title,recurrence:f.recurrence||null}:null,topics:(a.topics||[]).map(b=>({id:b.id,name:b.name,slug:b.slug,color:b.color,kind:b.kind}))}}const d=k(()=>{var t;return(t=e.value)!=null&&t.series?Q(e.value.series.recurrence,e.value.start):""}),c=k(()=>{const t=d.value;return t?`This event repeats ${t.charAt(0).toLowerCase()}${t.slice(1)}.`:"This is a recurring event."}),V=k(()=>{if(!e.value)return"";const t=new Date(e.value.start),a=t.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"});if(e.value.isAllDay)return`All day · ${a}`;const f=x=>x.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"});let b=f(t);return e.value.end&&(b+=` – ${f(new Date(e.value.end))}`),`${a} · ${b}`}),_=k(()=>e.value?K.sanitize(e.value.description,{ALLOWED_TAGS:["b","i","em","strong","a","p","br","ul","ol","li"],ALLOWED_ATTR:["href","target"]}):"");async function F(){p.value=!0,l.value=null;try{const t=await r.collection("events").getOne(m.params.id,{expand:"topics,event_series"});e.value=M(t)}catch(t){console.error("Error loading event:",t),l.value="Event not found."}finally{p.value=!1}}return U(F),(t,a)=>{const f=I("router-link"),b=I("RouterLink");return s(),i("section",_e,[n("div",me,[n("div",pe,[C(f,{to:"/calendar",class:"event-detail__back-link"},{default:A(()=>[...a[0]||(a[0]=[w("← All events",-1)])]),_:1})]),p.value?(s(),i("p",fe,"Loading…")):l.value?(s(),i("p",be,y(l.value),1)):e.value?(s(),i("div",ge,[n("article",ye,[e.value.image?(s(),i("img",{key:0,class:"event-detail__c
2over",src:e.value.image,alt:`Cover image for ${e.value.title}`},null,8,he)):L("",!0),e.value.topics.length?(s(),i("div",ke,[(s(!0),i(h,null,O(e.value.topics,x=>(s(),X(ee,{key:x.id,topic:x},null,8,["topic"]))),128))])):L("",!0),n("h1",we,y(e.value.title),1),n("dl",Le,[n("div",Se,[a[1]||(a[1]=n("dt",null,"When",-1)),n("dd",null,y(V.value),1)]),e.value.location?(s(),i("div",Te,[a[2]||(a[2]=n("dt",null,"Where",-1)),n("dd",null,y(e.value.location),1)])):L("",!0)]),C(ve,{class:"event-detail__map",lat:e.value.lat,lng:e.value.lng,location:e.value.location},null,8,["lat","lng","location"]),e.value.description?(s(),i("div",{key:2,class:"event-detail__desc",innerHTML:_.value},null,8,$e)):L("",!0)]),n("aside",Ce,[n("div",Ee,[e.value.series?(s(),i(h,{key:0},[a[3]||(a[3]=n("h2",{class:"event-detail__card-title"},"Reminders",-1)),n("p",xe,y(c.value)+" Subscribe to get an email before each occurrence. ",1),C(re,{series:e.value.series},null,8,["series"])],64)):(s(),i(h,{key:1},[a[4]||(a[4]=n("h2",{class:"event-detail__card-title"},"One-off event",-1)),a[5]||(a[5]=n("p",{class:"event-detail__card-sub"},"Reminders are available for recurring events.",-1))],64))]),n("div",Ae,[a[12]||(a[12]=n("h2",{class:"event-detail__card-title"},"Organize this event?",-1)),S.value?T.value?(s(),i("p",Me,[a[9]||(a[9]=w(" You own this event. ",-1)),C(b,{to:"/events/mine"},{default:A(()=>[...a[8]||(a[8]=[w("Manage it",-1)])]),_:1}),a[10]||(a[10]=w(". ",-1))])):o.value==="done"?(s(),i("p",Ve," ✅ Your ownership claim was submitted. A board member will review it. ")):(s(),i(h,{key:3},[a[11]||(a[11]=n("p",{class:"event-detail__card-sub"}," Claim ownership and the board can hand you the keys to edit it. ",-1)),n("button",{class:"ih-btn-outline",disabled:o.value==="submitting",onClick:$},y(o.value==="submitting"?"Submitting…":"Claim ownership"),9,Ie),o.value==="error"?(s(),i("p",Oe,y(u.value),1)):L("",!0)],64)):(s(),i("p",De,[C(b,{to:"/login"},{default:A(()=>[...a[6]||(a[6]=[w("Log in",-1)])]),_:1}),a[7]||(a[7]=w(" to claim this event and keep its details up to date. ",-1))]))])])])):L("",!0)])])}}},Be=z(Re,[["__scopeId","data-v-3e43f3a9"]]);export{Be as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.