PageSourceSearch

https://sonic-moonshine-band.web.app/assets/ShowList-DJDEM9ES.js

js sonic-moonshine-band.web.app collected 2026-10-03 12:36:27 UTC 10,172 bytes, 1 lines download raw bytes

1import{f as W,i as K,h as se,r as n,aG as te,aH as _,K as ae,aI as G,aJ as ne,aK as le,aL as oe,aM as re,aN as ie,d as U,aO as H,j as e,P as q,aP as T,F as c,aQ as J,aR as Q,aS as X,aT as Y,aU as ce,aF as V,aV as de,aW as me,aX as pe,a as fe,aY as ge,e as he,o as xe,aZ as Z,a_ as ue,a$ as be,b0 as ye,b1 as je,b2 as Se,b3 as ve,b4 as Ne,b5 as Be,aB as ke,b6 as we,b7 as Pe}from"./index-JR75wn-F.js";import{f as Me,h as Ee}from"./showPay-B3nagkcX.js";import{f as De}from"./showAdmission-DfNeHaeW.js";import{A as ze}from"./AddToCalendarMenu-CpvdKc3h.js";import"./vendor-firebase-DNzSL88b.js";import"./addMilliseconds-BMRP0m0t.js";const Ae={open:"Open",promoted:"Booked",cancelled:"Cancelled",archived:"Archived"},Fe=()=>{const x=W(),{canEdit:y,canManageUsers:j,canRespondToProposedShow:S}=K(),r=se(s=>s.user),[u,P]=n.useState([]),[M,O]=n.useState([]),[E,I]=n.useState([]),[D,v]=n.useState(!0),[N,C]=n.useState(null),[f,z]=n.useState(null),[B,k]=n.useState(null);n.useEffect(()=>{Promise.all([te(),_(),ae(),G()]).then(async([s,a,g,b])=>{O(a),I(b);const l=ne(g),p=s.filter(o=>o.status!=="archived"),i=await Promise.all(p.map(async o=>{let F=0,$=[];const ee=o.status==="open"?await le(o.id):[],R=oe(ee);return r!=null&&r.uid&&o.status==="open"&&S&&(F=re(o,r.uid,R).length),o.status==="open"&&o.dateOptions.length>0&&($=ie(o,l,R)),{proposedShow:o,pendingCount:F,tallies:$}}));P(i),C(null),v(!1)}).catch(s=>{console.error("Proposed show list load failed:",s),C(U(s,"proposed shows")),v(!1)})},[r==null?void 0:r.uid,S]);const w=n.useMemo(()=>Object.fromEntries(M.map(s=>[s.id,s.name])),[M]),L=n.useMemo(()=>H(E),[E]),A=async s=>{if(s.status==="cancelled"){z(s.id),k(null);try{await pe(s.id,s.title),P(a=>a.filter(g=>g.proposedShow.id!==s.id))}catch(a){console.error("Archive failed:",a),k(U(a,"archiving this proposal"))}finally{z(null)}}};if(D)return e.jsx(q,{label:"Loading proposals…"});if(N)return e.jsx("p",{className:"text-danger",style:{fontSize:"0.875rem"},children:N});const t=u.filter(s=>s.proposedShow.status==="open").sort((s,a)=>T(s.proposedShow,a.proposedShow)),d=u.filter(s=>s.proposedShow.status==="promoted").sort((s,a)=>T(s.proposedShow,a.proposedShow)),h=u.filter(s=>s.proposedShow.status==="cancelled").sort((s,a)=>T(s.proposedShow,a.proposedShow)),m=({proposedShow:s,pendingCount:a,tallies:g})=>{const b=s.dateOptions.flatMap(l=>L[Q(l.date)]??[]).filter((l,p,i)=>i.findIndex(o=>o.memberUid===l.memberUid)===p);return e.jsx("div",{className:"card",style:{cursor:"pointer",marginBottom:"0.75rem"},onClick:()=>x(`/shows/proposals/${s.id}`),children:e.jsx("div",{className:"card-body",style:{padding:"1rem 1.25rem"},children:e.jsxs("div",{className:"d-flex align-items-start justify-content-between gap-2",children:[e.jsxs("div",{className:"flex-grow-1",children:[e.jsxs("div",{className:"d-flex align-items-center gap-2 mb-1",children:[e.jsxs("p",{style:{fontFamily:"'Bebas Neue', sans-serif",fontSize:"1.25rem",letterSpacing:"0.04em",color:"#f0f0f0",marginBottom:0},children:[s.title," ",e.jsx(X,{blocks:b,compact:!0})]}),e.jsx("span",{className:`proposed-show-status proposed-show-status--${s.status}`,children:Ae[s.status]})]}),e.jsxs("p",{style:{fontSize:"0.82rem",color:"#a0a0a0",marginBottom:"0.25rem"},children:[s.dateOptions.length," date option",s.dateOptions.length===1?"":"s"]}),s.venueId&&w[s.venueId]&&e.jsxs("div",{className:"d-flex align-items-center gap-1",children:[e.jsx(c,{icon:Y,style:{color:"#606060",fontSize:"0.75rem"}}),e.jsx("span",{style:{fontSize:"0.8rem",color:"#606060"},children:w[s.venueId]})]}),s.dateOptions.length>0&&e.jsx("ul",{className:"proposed-show-dates",children:ce(s).map(l=>{const p=g.find(i=>i.dateOptionId===l.id);return e.jsxs("li",{className:"proposed-show-date",children:[e.jsx("span",{className:"proposed-show-date-label",children:V(l.date.toDate(),"EEE, MMM d · h:mm a")}),p&&e.jsx("span",{className:`proposed-show-date-tally${p.isUnanimous?" proposed-show-date-tally--unanimous":""}`,children:de(p)})]},l.id)})})]}),(a>0||j&&s.status==="cancelled")&&e.jsxs("div",{className:"d-flex flex-column align-items-end gap-2",children:[a>
10&&e.jsxs("span",{className:"proposed-show-pending-badge",children:[a," pending"]}),j&&s.status==="cancelled"&&e.jsxs("button",{type:"button",className:"btn btn-secondary btn-sm d-flex align-items-center gap-1",disabled:f===s.id,onClick:l=>{l.stopPropagation(),A(s)},children:[f===s.id?e.jsx("span",{className:"spinner-border spinner-border-sm"}):e.jsx(c,{icon:me}),"Archive"]})]})]})})},s.id)};return u.length===0?e.jsxs("div",{className:"d-flex flex-column align-items-center justify-content-center",style:{padding:"3rem 2rem",gap:"0.75rem"},children:[e.jsx(c,{icon:J,style:{fontSize:"2rem",color:"#2e2e2e"}}),e.jsx("p",{style:{color:"#606060",marginBottom:0},children:"No proposed shows yet"}),y&&e.jsx("button",{className:"btn btn-primary mt-1",onClick:()=>x("/shows/proposals/new"),children:"New Proposal"})]}):e.jsxs(e.Fragment,{children:[B&&e.jsx("div",{className:"alert alert-danger mb-3",style:{fontSize:"0.85rem"},children:B}),t.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"stat-label mb-2",children:"Open"}),t.map(m)]}),d.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"stat-label mb-2 mt-3",children:"Booked"}),d.map(m)]}),h.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"stat-label mb-2 mt-3",children:"Closed"}),h.map(m)]})]})},Oe=[{key:"booked",label:"Booked",icon:Z},{key:"proposals",label:"Proposals",icon:J}],$e=()=>{const x=W(),[y,j]=fe(),{canEdit:S}=K(),[r,u]=n.useState([]),[P,M]=n.useState(new Map),[O,E]=n.useState([]),[I,D]=n.useState(!0),[v,N]=n.useState(null),f=y.get("tab")==="proposals"?"proposals":"booked",z=t=>{t==="booked"?(y.delete("tab"),j(y,{replace:!0})):j({tab:t},{replace:!0})};if(n.useEffect(()=>{Promise.all([ge(),_(),G()]).then(([t,d,h])=>{u(t),M(new Map(d.map(m=>[m.id,m]))),E(h),N(null),D(!1)}).catch(t=>{console.error("Show list load failed:",t),N(U(t,"shows")),D(!1)})},[]),I)return e.jsx(q,{label:"Loading shows…"});if(v)return e.jsx(he,{title:"Shows",message:v});const B=new Date,k=r.filter(t=>t.date.toDate()>=B).reverse(),w=r.filter(t=>t.date.toDate()<B),L=H(O),A=t=>{const d=ue(t).startTime.toDate(),m=be(t).length>1,s=Me(t.pay),a=De(t.admission),g=ye(t.ageRestriction),b=je(t.facebookEventUrl),l=Se(t.setlist),p=ve(l),i=t.venueId?P.get(t.venueId)??null:null,o=L[Q(t.date)]??[];return e.jsx("div",{className:"card",style:{cursor:"pointer",marginBottom:"0.75rem"},onClick:()=>x(`/shows/${t.id}`),children:e.jsx("div",{className:"card-body",style:{padding:"1rem 1.25rem"},children:e.jsxs("div",{className:"d-flex align-items-start justify-content-between gap-2",children:[e.jsxs("div",{className:"flex-grow-1",children:[e.jsxs("p",{style:{fontFamily:"'Bebas Neue', sans-serif",fontSize:"1.25rem",letterSpacing:"0.04em",color:"#f0f0f0",marginBottom:"0.35rem"},children:[Ne(t,i)," ",e.jsx(X,{blocks:o,compact:!0})]}),e.jsx("p",{style:{fontSize:"0.82rem",color:"#a0a0a0",marginBottom:"0.25rem"},children:m?V(d,"EEE, MMMM d, yyyy"):V(d,"EEE, MMMM d, yyyy · h:mm a")}),m&&e.jsx("p",{style:{fontSize:"0.8rem",color:"#606060",marginBottom:"0.25rem"},children:Be(t)}),(i==null?void 0:i.name)&&e.jsxs("div",{className:"d-flex align-items-center gap-1",children:[e.jsx(c,{icon:Y,style:{color:"#606060",fontSize:"0.75rem"}}),e.jsx("span",{style:{fontSize:"0.8rem",color:"#606060"},children:i.name})]}),(g||a)&&e.jsx("p",{style:{fontSize:"0.8rem",color:"#a0a0a0",marginTop:"0.25rem",marginBottom:0},children:[g,a].filter(Boolean).join(" · ")}),b&&e.jsxs("a",{href:b,target:"_blank",rel:"noopener noreferrer",onClick:F=>F.stopPropagation(),style:{display:"inline-flex",alignItems:"center",gap:6,marginTop:"0.35rem",color:"#cc0000",fontSize:"0.8rem",textDecoration:"none"},children:["Facebook event",e.jsx(c,{icon:ke,style:{fontSize:"0.65rem"}})]}),l.hasSetlist?e.jsxs("div",{className:"d-flex align-items-center gap-1 mt-1",children:[e.jsx(c,{icon:we,style:{color:"#606060",fontSize:"0.75rem"}}),e.jsx("span",{style:{fontSize:"0.8rem",color:"#a0a0a0"},children:p})]}):e.jsxs("div",{className:"d-flex align-items-center gap-1 mt-1",children:[e.jsx(c,{icon:Pe,style:{color:"#fbbf24",fontSize:"0.75rem"}}),e.jsx("span",{style:{fontSize:"0.8rem",color:"#fbbf24"},children:"Setlist missing"})]})]}),e.jsxs("div",{className:"d-flex flex-column align-items-end gap-2",style:{flexShrink:0},children:[e.jsx(ze,{show:t,venue:i,compact:!0}),Ee(t)&&s&&e.jsx("div",{style:{color:"#4ade80",fontSize:"0.85rem",fontWeight:700,maxWidth:140,textAlign:"right"},children:e.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block"},children:s})})]})]})})},t.id)};return e.jsxs("div",{children:[e.jsxs("div",{className:"page-header",children:[e.jsxs("div",{children:[e.jsx("h1",{children:"Shows"}),e.jsx("p",{className:"text-secondary mb-0",style:{fontSize:"0.85rem"},children:f==="booked"?`${r.length} booked`:"Vote on dates before a show is confirmed"})]}),S&&e.jsxs("button",{className:"btn btn-primary d-flex align-items-center gap-2",onClick:()=>x(f==="proposals"?"/shows/proposals/new":"/shows/new"),children:[e.jsx(c,{icon:xe}),f==="proposals"?"New Proposal":"Add New"]})]}),e.jsx("div",{className:"d-flex gap-2 mb-4",children:Oe.map(({key:t,label:d,icon:h})=>e.jsxs("button",{type:"button",className:`btn btn-sm d-flex align-items-center gap-2 ${f===t?"btn-primary":"btn-secondary"}`,onClick:()=>z(t),children:[e.jsx(c,{icon:h}),d]},t))}),f==="proposals"?e.jsx(Fe,{}):r.length===0?e.jsxs("div",{className:"d-flex flex-column align-items-center justify-content-center",style:{padding:"4rem 2rem",gap:"0.75rem"},children:[e.jsx(c,{icon:Z,style:{fontSize:"2rem",color:"#2e2e2e"}}),e.jsx("p",{style:{color:"#606060",marginBottom:0},children:"No shows yet — add your first gig!"}),S&&e.jsx("button",{className:"btn btn-primary mt-1",onClick:()=>x("/shows/new"),children:"Add New"})]}):e.jsxs(e.Fragment,{children:[k.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"stat-label mb-2",children:"Upcoming"}),k.map(A)]}),w.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"stat-label mb-2 mt-3",children:"Past"}),w.map(A)]})]})]})};export{$e 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.