PageSourceSearch

https://sonic-moonshine-band.web.app/assets/SongDetail-DZSDByKK.js

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

1import{f as $,u as Y,h as q,i as H,r as d,as as K,az as P,aA as F,K as V,d as _,j as e,P as G,e as J,F as y,at as Q,B as X,aB as Z,aC as ee,aD as M,aE as se}from"./index-JR75wn-F.js";import{c as te}from"./tuning-BDS3YJpd.js";import"./vendor-firebase-DNzSL88b.js";const ne=({value:g,interactive:i,onRate:n})=>{const[p,u]=d.useState(0);return e.jsx("div",{className:"d-flex",style:{gap:2},children:[1,2,3,4,5].map(l=>i?e.jsx("button",{className:"star-btn",onMouseEnter:()=>u(l),onMouseLeave:()=>u(0),onClick:()=>n==null?void 0:n(l),title:`${l} star${l!==1?"s":""}`,children:e.jsx("span",{style:{color:(p||g)>=l?"#cc0000":"#2e2e2e",fontSize:"1.1rem"},children:"★"})},l):e.jsx("span",{style:{color:g>=l?"#cc0000":"#2e2e2e",fontSize:"1.1rem"},children:"★"},l))})},re=()=>{const g=$(),{id:i}=Y(),{user:n}=q(),{canEdit:p,canEditAnySongRating:u,canEditOwnSongRating:l}=H(),[t,T]=d.useState(null),[C,S]=d.useState([]),[D,N]=d.useState([]),[v,x]=d.useState({}),[b,z]=d.useState(null),[m,L]=d.useState([]),[W,w]=d.useState(!0),[E,B]=d.useState(null);d.useEffect(()=>{i&&Promise.all([K(i),P(i),F(i),V()]).then(([s,r,o,a])=>{T(s),S(r),N(o),x(Object.fromEntries(o.map(c=>[c.userId,c.notes]))),L(a),B(null),w(!1)}).catch(s=>{console.error("Song detail load failed:",s),B(_(s,"this song")),w(!1)})},[i]);const A=async(s,r,o)=>{if(!i||!n)return;await ee(i,s,r,o);const a=await P(i);S(a)},R=s=>s.uid?!!(u||l&&s.uid===(n==null?void 0:n.uid)):!1,I=s=>!s.uid||!n?!1:M(n,s.uid),k=async s=>{if(!i||!s.uid||!n||!M(n,s.uid))return;const r=v[s.uid]??"";z(s.uid);try{await se(i,s.uid,s.name,r);const o=await F(i);N(o),x(Object.fromEntries(o.map(a=>[a.userId,a.notes])))}finally{z(null)}};return W?e.jsx(G,{label:"Loading song…"}):E?e.jsx(J,{title:"Song",message:E}):t?e.jsxs("div",{children:[e.jsxs("div",{className:"page-header",children:[e.jsxs("div",{className:"d-flex align-items-center gap-3",children:[e.jsx("button",{className:"btn btn-secondary btn-sm",onClick:()=>g("/songs"),children:e.jsx(y,{icon:Q})}),e.jsxs("div",{children:[e.jsx("h1",{style:{marginBottom:"0.1rem"},children:t.title}),e.jsx("p",{style:{color:"#a0a0a0",fontSize:"0.9rem",marginBottom:0},children:t.originalArtist})]})]}),p&&e.jsxs("button",{className:"btn btn-secondary d-flex align-items-center gap-2",onClick:()=>g(`/songs/${i}/edit`),children:[e.jsx(y,{icon:X}),"Edit"]})]}),t.tuningName&&e.jsxs("div",{style:{background:"rgba(204,0,0,0.1)",border:"1px solid rgba(204,0,0,0.3)",borderRadius:10,padding:"1rem 1.25rem",marginBottom:"1.25rem"},children:[e.jsx("p",{className:"stat-label mb-1",children:"Tuning"}),e.jsx("p",{style:{color:"#f0f0f0",fontWeight:700,fontSize:"1.1rem",marginBottom:t.tuningNotes?"0.25rem":0},children:t.tuningName}),t.tuningNotes&&e.jsx("p",{style:{color:"#a0a0a0",fontSize:"0.85rem",marginBottom:t.dropPedalSetting?"0.75rem":0},children:t.tuningNotes}),t.dropPedalSetting&&e.jsxs("div",{style:{marginTop:t.tuningNotes?0:"0.5rem",paddingTop:"0.6rem",borderTop:"1px solid rgba(204,0,0,0.2)",display:"flex",alignItems:"center",gap:"0.5rem",flexWrap:"wrap"},children:[e.jsxs("span",{style:{color:"#606060",fontSize:"0.8rem"},children:["Drop Pedal — Setting ",t.dropPedalSetting]}),e.jsx("span",{style:{color:"#606060",fontSize:"0.8rem"},children:"→"}),e.jsx("span",{style:{color:"#cc0000",fontWeight:700,fontSize:"0.95rem"},children:te(t.tuningName,t.dropPedalSetting)})]})]}),t.duration&&e.jsx("div",{className:"row g-2 mb-3",children:e.jsx("div",{className:"col-6 col-sm-3",children:e.jsxs("div",{className:"card",style:{padding:"0.75rem 1rem"},children:[e.jsx("p",{className:"stat-label mb-1",children:"Duration"}),e.jsx("p",{style:{color:"#f0f0f0",fontWeight:600,marginBottom:0},children:t.duration})]})})}),t.youtubeUrl&&e.jsxs("a",{href:t.youtubeUrl,target:"_blank",rel:"noopener noreferrer",className:"btn btn-secondary d-inline-flex align-items-center gap-2 mb-3",style:{color:"#ff4444"},children:[e.jsx(y,{icon:Z}),"Watch Reference Video"]}),t.notes&&e.jsxs("div",{className:"card mb-3",style:{padding:"1rem 1.25rem"},children:[e.jsx("p",{className:"stat-label mb-1",children:"Notes / Cues"}),e.jsx("p",{style:{color:"#f0f0f0",fontSize:"0.9rem",marginBottom:0,whiteSpace:"pre-wrap"},children:t.notes})]}),m.length>0&&e.jsxs("div",{className:"card mb-3",style:{padding:"1rem 1.25rem"},children:[e.jsx("p",{className:"stat-label mb-3",children:"Difficulty Ratings"}),e.jsx("div",{className:"d-flex flex-column",style:{gap:"0.75rem"},children:m.map((s,r)=>{const o=s.uid===(n==null?void 0:n.uid),a=C.find(f=>f.userId===s.uid),c=(a==null?void 0:a.difficulty)??0;return e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"1rem",paddingTop:r>0?"0.75rem":0,borderTop:r>0?"1px solid #1f1f1f":"none"},children:[e.jsxs("div",{style:{minWidth:0},children:[e.jsx("span",{style:{fontSize:"0.875rem",color:o?"#f0f0f0":"#a0a0a0",fontWeight:o?600:400},children:s.name}),s.bandRole&&e.jsx("span",{style:{fontSize:"0.7rem",color:"#606060",marginLeft:8},children:s.bandRole}),o&&e.jsx("span",{style:{fontSize:"0.7rem",color:"#606060",marginLeft:6},children:"you"}),!a&&e.jsx("span",{style:{fontSize:"0.7rem",color:"#404040",marginLeft:8},children:"not rated"})]}),e.jsx(ne,{value:c,interactive:R(s),onRate:R(s)?f=>A(s.uid,s.name,f):void 0})]},s.email)})})]}),m.length>0&&e.jsxs("div",{className:"card",style:{padding:"1rem 1.25rem"},children:[e.jsx("p",{className:"stat-label mb-1",children:"Band Notes"}),e.jsx("p",{style:{color:"#606060",fontSize:"0.8rem",marginBottom:"1rem"},children:"Personal notes for each band member. You can edit your own; admins can edit any."}),e.jsx("div",{className:"d-flex flex-column",style:{gap:"1rem"},children:m.map((s,r)=>{const o=s.uid===(n==null?void 0:n.uid),a=D.find(j=>j.userId===s.uid),c=I(s),f=s.uid?v[s.uid]??(a==null?void 0:a.notes)??"":"",h=(a==null?void 0:a.notes)??"",O=c&&f!==h;return e.jsxs("div",{style:{paddingTop:r>0?"1rem":0,borderTop:r>0?"1px solid #1f1f1f":"none"},children:[e.jsxs("div",{className:"d-flex align-items-center gap-2 mb-2 flex-wrap",children:[e.jsx("span",{style:{fontSize:"0.875rem",color:o?"#f0f0f0":"#a0a0a0",fontWeight:o?600:400},children:s.name}),s.bandRole&&e.jsx("span",{style:{fontSize:"0.7rem",color:"#606060"},children:s.bandRole}),o&&e.jsx("span",{style:{fontSize:"0.7rem",color:"#606060"},children:"you"})]}),c?e.jsxs(e.Fragment,{children:[e.jsx("textarea",{className:"form-control",rows:3,placeholder:"Your cues, reminders, or part-specific notes…",value:f,onChange:j=>{s.uid&&x(U=>({...U,[s.uid]:j.target.value}))}}),e.jsx("div",{className:"d-flex justify-content-end mt-2",children:e.jsx("button",{type:"button",className:"btn btn-sm btn-primary",disabled:!O||b===s.uid,onClick:()=>void k(s),children:b===s.uid?"Saving…":"Save Notes"})})]}):h?e.jsx("p",{style:{color:"#f0f0f0",fontSize:"0.875rem",marginBottom:0,whiteSpace:"pre-wrap"},children:h}):e.jsx("p",{style:{color:"#404040",fontSize:"0.8rem",marginBottom:0},children:"No notes"})]},s.email)})})]})]}):e.jsx("p",{className:"text-secondary",children:"Song not found."})};export{re 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.