PageSourceSearch

https://nfldrafthq.com/assets/EditableTeamNeeds2026-BUjNEquJ.js

js nfldrafthq.com collected 2026-10-05 19:58:27 UTC 16,235 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Ba4BgsO5.js","assets/index-B-lHBc3D.css"])))=>i.map(i=>d[i]);
2import{d as I,a as X,r as l,U as Y,j as e,B as E,e as w,D as Z,f as ee,g as re,h as se,a9 as te,a5 as ae,_ as oe}from"./index-Ba4BgsO5.js";import{u as ne}from"./useMutation-CYNnMthe.js";import{C as ie,a as le}from"./chevron-up-Do4Z_DWR.js";const de=({team:C,className:y="w-6 h-6"})=>{const a=C.toLowerCase();let t=a.replace(/\s+/g,"");return a==="raiders"?t="lv":a==="browns"?t="cle":a==="texans"?t="hou":a==="titans"?t="ten":a==="giants"?t="nyg":a==="jets"?t="nyj":a==="eagles"?t="phi":a==="commanders"?t="wsh":a==="cowboys"?t="dal":a==="packers"?t="gb":a==="lions"?t="det":a==="vikings"?t="min":a==="bears"?t="chi":a==="saints"?t="no":a==="buccaneers"?t="tb":a==="falcons"?t="atl":a==="panthers"?t="car":a==="49ers"?t="sf":a==="seahawks"?t="sea":a==="rams"?t="lar":a==="cardinals"?t="ari":a==="bills"?t="buf":a==="dolphins"?t="mia":a==="patriots"?t="ne":a==="chiefs"?t="kc":a==="chargers"?t="lac":a==="broncos"?t="den":a==="ravens"?t="bal":a==="bengals"?t="cin":a==="steelers"?t="pit":a==="colts"?t="ind":a==="jaguars"&&(t="jax"),e.jsx("img",{src:`https://a.espncdn.com/i/teamlogos/nfl/500/scoreboard/${t}.png`,alt:`${C} logo`,className:`${y} object-contain flex-shrink-0`,onError:j=>{j.target.style.display="none"}})}
2,M={"AFC East":["Bills","Dolphins","Patriots","Jets"],"AFC North":["Ravens","Bengals","Browns","Steelers"],"AFC South":["Texans","Colts","Jaguars","Titans"],"AFC West":["Broncos","Chiefs","Raiders","Chargers"],"NFC East":["Cowboys","Giants","Eagles","Commanders"],"NFC North":["Bears","Lions","Packers","Vikings"],"NFC South":["Falcons","Panthers","Saints","Buccaneers"],"NFC West":["Cardinals","Rams","49ers","Seahawks"]},ce={Bills:{primaryColor:"rgb(0, 51, 153)",secondaryColor:"rgb(204, 0, 0)",gradientStart:"rgb(0, 51, 153)",gradientEnd:"rgb(0, 31, 103)"},Dolphins:{primaryColor:"rgb(0, 142, 151)",secondaryColor:"rgb(252, 76, 2)",gradientStart:"rgb(0, 142, 151)",gradientEnd:"rgb(0, 112, 121)"},Patriots:{primaryColor:"rgb(0, 34, 68)",secondaryColor:"rgb(198, 12, 48)",gradientStart:"rgb(0, 34, 68)",gradientEnd:"rgb(0, 14, 48)"},Jets:{primaryColor:"rgb(18, 87, 64)",secondaryColor:"rgb(255, 255, 255)",gradientStart:"rgb(18, 87, 64)",gradientEnd:"rgb(8, 57, 44)"},Ravens:{primaryColor:"rgb(36, 23, 115)",secondaryColor:"rgb(255, 255, 255)",gradientStart:"rgb(36, 23, 115)",gradientEnd:"rgb(16, 3, 85)"},Bengals:{primaryColor:"rgb(251, 79, 20)",secondaryColor:"rgb(0, 0, 0)",gradientStart:"rgb(251, 79, 20)",gradientEnd:"rgb(201, 39, 0)"},Browns:{primaryColor:"rgb(49, 29, 0)",secondaryColor:"rgb(255, 60, 0)",gradientStart:"rgb(49, 29, 0)",gradientEnd:"rgb(29, 9, 0)"},Steelers:{primaryColor:"rgb(255, 182, 18)",secondaryColor:"rgb(16, 24, 32)",gradientStart:"rgb(255, 182, 18)",gradientEnd:"rgb(215, 142, 0)"},Texans:{primaryColor:"rgb(3, 32, 47)",secondaryColor:"rgb(167, 25, 48)",gradientStart:"rgb(3, 32, 47)",gradientEnd:"rgb(0, 12, 27)"},Colts:{primaryColor:"rgb(0, 44, 119)",secondaryColor:"rgb(255, 255, 255)",gradientStart:"rgb(0, 44, 119)",gradientEnd:"rgb(0, 14, 89)"},Jaguars:{primaryColor:"rgb(0, 103, 120)",secondaryColor:"rgb(215, 162, 42)",gradientStart:"rgb(0, 103, 120)",gradientEnd:"rgb(0, 73, 90)"},Titans:{primaryColor:"rgb(12, 35, 64)",secondaryColor:"rgb(75, 146, 219)",gradientStart:"rgb(12, 35, 64)",gradientEnd:"rgb(0, 5, 34)"},Broncos:{primaryColor:"rgb(251, 79, 20)",secondaryColor:"rgb(0, 34, 68)",gradientStart:"rgb(251, 79, 20)",gradientEnd:"rgb(201, 39, 0)"},Chiefs:{primaryColor:"rgb(227, 24, 55)",secondaryColor:"rgb(255, 184, 28)",gradientStart:"rgb(227, 24, 55)",gradientEnd:"rgb(187, 0, 15)"},Raiders:{primaryColor:"rgb(0, 0, 0)",secondaryColor:"rgb(165, 172, 175)",gradientStart:"rgb(40, 40, 40)",gradientEnd:"rgb(0, 0, 0)"},Chargers:{primaryColor:"rgb(0, 128, 198)",secondaryColor:"rgb(255, 194, 14)",gradientStart:"rgb(0, 128, 198)",gradientEnd:"rgb(0, 98, 168)"},Cowboys:{primaryColor:"rgb(0, 34, 68)",secondaryColor:"rgb(134, 147, 151)",gradientStart:"rgb(0, 34, 68)",gradientEnd:"rgb(0, 4, 38)"},Giants:{primaryColor:"rgb(1, 35, 117)",secondaryColor:"rgb(163, 13, 45)",gradientStart:"rgb(1, 35, 117)",gradientEnd:"rgb(0, 5, 87)"},Eagles:{primaryColor:"rgb(0, 76, 84)",secondaryColor:"rgb(165, 172, 175)",gradientStart:"rgb(0, 76, 84)",gradientEnd:"rgb(0, 46, 54)"},Commanders:{primaryColor:"rgb(90, 20, 20)",secondaryColor:"rgb(255, 182, 18)",gradientStart:"rgb(90, 20, 20)",gradientEnd:"rgb(60, 0, 0)"},Bears:{primaryColor:"rgb(11, 34, 64)",secondaryColor:"rgb(200, 56, 3)",gradientStart:"rgb(11, 34, 64)",gradientEnd:"rgb(0, 4, 34)"},Lions:{primaryColor:"rgb(0, 118, 182)",secondaryColor:"rgb(176, 183, 188)",gradientStart:"rgb(0, 118, 182)",gradientEnd:"rgb(0, 88, 152)"},Packers:{primaryColor:"rgb(24, 48, 40)",secondaryColor:"rgb(255, 184, 28)",gradientStart:"rgb(24, 48, 40)",gradientEnd:"rgb(4, 18, 10)"},Vikings:{primaryColor:"rgb(79, 38, 131)",secondaryColor:"rgb(255, 198, 47)",gradientStart:"rgb(79, 38, 131)",gradientEnd:"rgb(49, 8, 101)"},Falcons:{primaryColor:"rgb(167, 25, 48)",secondaryColor:"rgb(0, 0, 0)",gradientStart:"rgb(167, 25, 48)",gradientEnd:"rgb(127, 0, 18)"},Panthers:{primaryColor:"rgb(0, 133, 202)",secondaryColor:"rgb(16, 24, 32)",gradientStart:"rgb(0, 133, 202)",gradientEnd:"rgb(0, 103, 172)"},Saints:{primaryColor:"rgb(211, 188, 141)",secondaryColor:"rgb(16, 24, 31)",gradientStart:"rgb(211, 188, 141)",gradientEnd:"rgb(181, 158, 111)"},Buccaneers:{primaryColor:"rgb(213, 10, 10)",secondaryColor:"rgb(52, 53, 53)",gradientStart:"rgb(213, 10, 10)",gradientEnd:"rgb(173, 0, 0)"},Cardinals:{primaryColor:"rgb(151, 35, 63)",secondaryColor:"rgb(0, 0, 0)",gradientStart:"rgb(151, 35, 63)",gradientEnd:"rgb(111, 5, 33)"},Rams:{primaryColor:"rgb(0, 53, 148)",secondaryColor:"rgb(255, 209, 0)",gradientStart:"rgb(0, 53, 148)",gradientEnd:"rgb(0, 23, 118)"},"49ers":{primaryColor:"rgb(170, 0, 0)",secondaryColor:"rgb(173, 153, 93)",gradientStart:"rgb(170, 0, 0)",gradientEnd:"rgb(130, 0, 0)"},Seahawks:{primaryColor:"rgb(0, 34, 68)",secondaryColor:"rgb(105, 190, 40)",gradientStart:"rgb(0, 34, 68)",gradientEnd:"rgb(0, 4, 38)"}},he=()=>{const C=I(),{user:y,loadTeamNeeds:a}=C,{data:t,isLoading:j,error:$,refetch:ge}=X({queryKey:["/api/team-needs",!!y],queryFn:async()=>{const s=await fetch("/api/team-needs",{cache:"no-store"});if(!s.ok)throw new Error("Failed to fetch team needs");return s.json()},staleTime:0,refetchOnWindowFocus:!0}),[T,v]=l.useState({});l.useState(null);const[g,D]=l.useState(!1),[L,O]=l.useState(!1),[z,P]=l.useState(null),h=l.useRef(null),[be,S]=l.useState(!1),[o,N]=l.useState(null),[H,A]=l.useState(!1),[F,Q]=l.useState(Object.fromEntries(Object.keys(M).map(s=>[s,!0]))),{toast:U}=Y(),q=s=>{h.current&&clearTimeout(h.current),P(s),h.current=setTimeout(()=>{P(null),h.current=null},2e3)};l.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]),l.useEffect(()=>{a()},[a]),l.useEffect(()=>{const s=()=>{console.log("Team Needs: Logout event received, resetting state")};return document.addEventListener("globalLogout",s),document.addEventListener("userLoggedOut",s),()=>{document.removeEventListener("globalLogout",s),document.removeEventListener("userLoggedOut",s)}},[]);const V=ne({mutationFn:async s=>{if(!(await fetch("/api/auth/user",{credentials:"include"})).ok){console.error("User not authenticated when saving team needs");const r=new CustomEvent("showAuthRequired");throw document.dispatchEvent(r),new Error("Authentication required")}return te("POST","/api/team-needs/save",s)},onSuccess:()=>{ae.invalidateQueries({queryKey:["/api/team-needs"]})},onError:s=>{s.message}});l.useEffect(()=>{console.log("User authentication state from store:",y)},[y]),l.useEffect(()=>{if(t&&Array.isArray(t)&&t.length>0){console.log("EditableTeamNeeds2026: Team needs data loaded from API, count:",t.length);const s={};t.forEach(r=>{if(r.team&&r.team!=="Team"&&r.team!==""){const d=[...r.primaryNeeds||[],...r.secondaryNeeds||[]];s[r.team]=d}});const n=localStorage.getItem("customTeamNeeds2026");if(n)try{const r=JSON.parse(n);Object.assign(s,r)}catch(r){console.error("Error parsing saved team needs:",r)}console.log("EditableTeamNeeds2026: Processed Jets needs:",s.Jets),v(s)}},[t]),l.useEffect(()=>{const s=localStorage.getItem("customTeamNeeds2026");if(s)try{const n=JSON.parse(s);v(r=>({...r,...n}))}catch(n){console.error("Error parsing saved team needs:",n)}},[]);const k=s=>{const n=s.split(" (")[0],r=T[n]||[],d=r.slice(0,5),b=r.slice(5,12),m=[...d];for(;m.length<5;)m.push("");const u=[...b];for(;u.length<7;)u.push("");return{primary:m,secondary:u}},B=(s,n,r)=>
2{S(!0),N({team:s,index:n,type:r})},J=s=>{s.preventDefault()},_=(s,n,r,d)=>{if(s.preventDefault(),!o)return;if(o.team===n&&o.index===r&&o.type===d){S(!1),N(null);return}const{primary:b,secondary:m}=k(o.team);k(n);const p=(o.type==="primary"?b:m)[o.index];if(!p){S(!1),N(null);return}const i={...T};if(o.team===n){const c=[...i[n]||[]],x=o.type==="primary"?o.index:o.index+5,f=d==="primary"?r:r+5,[R]=c.splice(x,1);c.splice(f,0,R),i[n]=c.slice(0,12)}else{const c=[...i[o.team]||[]],x=o.type==="primary"?o.index:o.index+5;for(c.splice(x,1);c.length<12;)c.push("");i[o.team]=c;const f=[...i[n]||[]],R=d==="primary"?r:r+5;f.splice(R,0,p),i[n]=f.slice(0,12)}if(v(i),S(!1),N(null),localStorage.setItem("customTeamNeeds2026",JSON.stringify(i)),y){const c=i[n]||[],x=c.slice(0,5),f=c.slice(5,12);V.mutate({team:n,primaryNeeds:x,secondaryNeeds:f})}},W=async s=>{if(!s){D(!1);return}if(!I.getState().user){const r=new CustomEvent("showAuthRequired",{detail:{message:"Must be logged in to make edits"}});document.dispatchEvent(r);return}D(!0)},G=()=>{O(!0),q("Saving Team Needs..."),localStorage.setItem("customTeamNeeds2026",JSON.stringify(T)),setTimeout(()=>{O(!1),D(!1)},2e3)},K=async()=>{q("Resetting team needs...");try{if(y&&!(await fetch("/api/team-needs/reset",{method:"POST",credentials:"include"})).ok)throw new Error("Failed to clear user customizations");const{queryClient:s}=await oe(async()=>{const{queryClient:r}=await import("./index-Ba4BgsO5.js").then(d=>d.aP);return{queryClient:r}},__vite__mapDeps([0,1]));s.invalidateQueries({queryKey:["/api/team-needs"]});const n=await fetch("/api/team-needs",{credentials:"include"});if(n.ok){const r=await n.json();if(r&&Array.isArray(r)&&r.length>0){const d={};r.forEach(b=>{const m=[...b.primaryNeeds||[],...b.secondaryNeeds||[]];d[b.team]=m}),v(d),localStorage.removeItem("customTeamNeeds2026"),console.log("Team needs reset to Google Sheets data - silent reset completed")}}else throw new Error("Failed to fetch team needs data")}catch(s){console.error("Error resetting team needs:",s),U({title:"Reset failed",description:"Could not reset team needs. Please try again.",variant:"destructive"})}};return j?e.jsx("div",{className:"p-4",children:e.jsx("div",{className:"max-w-7xl mx-auto",children:e.jsx("div",{className:"text-center py-8 text-white",children:"Loading team needs..."})})}):$?e.jsx("div",{className:"p-4",children:e.jsx("div",{className:"max-w-7xl mx-auto",children:e.jsx("div",{className:"text-center py-8 text-red-400",children:"Error loading team needs"})})}):e.jsxs("div",{className:"p-4 bg-[#6b7280] min-h-screen",children:[e.jsxs("div",{className:"max-w-7xl mx-auto",children:[e.jsxs("div",{className:"flex h-8 items-start justify-between mb-6 max-w-4xl mx-auto",children:[e.jsx("div",{className:"relative translate-x-[30px] flex-1 flex justify-start",children:e.jsx(E,{variant:"outline",size:"sm",onClick:()=>A(!0),className:"h-8 px-3 text-xs font-bold border-2 transition-colors bg-gray-200 text-gray-800 border-gray-300 hover:bg-gray-300",children:"How to Edit"})}),e.jsx("h1",{className:"text-3xl font-bold text-white text-center px-4",children:"Team Needs"}),e.jsx("div",{className:"relative -translate-x-[30px] flex-1 flex items-start justify-end",children:e.jsx("div",{className:"relative flex flex-col items-center",children:g?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(E,{variant:"outline",size:"sm",onClick:G,disabled:L,className:"h-8 px-3 text-xs font-bold border-2 transition-colors bg-gray-200 text-gray-800 border-gray-300 hover:bg-gray-300 disabled:opacity-75",children:"Save"}),e.jsx(E,{variant:"outline",size:"sm",onClick:async()=>{await K()},disabled:L,className:"h-8 px-3 text-xs font-bold border-2 transition-colors bg-gray-200 text-gray-800 border-gray-300 hover:bg-gray-300",children:"Reset"})]}),e.jsx("div",{className:"absolute top-full right-0 mt-1 flex flex-col items-end gap-0.5 whitespace-nowrap",children:e.jsx("span",{className:"text-[11px] font-semibold text-yellow-300",children:z||"Click/Drag the team need badge to a new spot"})})]}):e.jsx(E,{variant:"outline",size:"sm",onClick:()=>W(!g),className:"h-8 px-3 text-xs font-bold border-2 transition-colors bg-gray-200 text-gray-800 border-gray-300 hover:bg-gray-300",children:"Edit Needs"})})})]}),e.jsx("div",{className:"space-y-4",children:Object.entries(M).map(([s,n])=>e.jsxs("div",{children:[e.jsxs("button",{className:"w-full flex items-center justify-between text-white text-xl font-bold border-b border-gray-600 pb-1 mb-3",onClick:()=>Q(r=>({...r,[s]:!r[s]})),children:[e.jsx("span",{children:s}),F[s]?e.jsx(ie,{className:"h-5 w-5"}):e.jsx(le,{className:"h-5 w-5"})]}),F[s]&&e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 gap-2",children:n.map(r=>{var u;const{primary:d,secondary:b}=k(r),m=((u=ce[r])==null?void 0:u.primaryColor)??"rgb(107, 114, 128)";return e.jsxs("div",{className:"bg-gray-800 p-2 rounded border border-white",style:{borderWidth:"1px"},children:[e.jsxs("div",{className:"flex items-center justify-center gap-1.5 mb-2",children:[e.jsx(de,{team:r,className:"w-6 h-6"}),e.jsx("h3",{className:"text-sm font-bold text-white",children:r})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("div",{className:"flex w-full rounded overflow-hidden border border-gray-400",children:d.map((p,i)=>e.jsx("div",{draggable:g,onDragStart:()=>g&&B(r,i,"primary"),onDragOver:J,onDrop:c=>_(c,r,i,"primary"),className:w("flex-1 text-xs font-bold text-center py-0.5 transition-colors",i!==d.length-1?"border-r border-gray-400":"",g?w("bg-yellow-100 text-gray-900 cursor-grab active:cursor-grabbing",(o==null?void 0:o.team)===r&&(o==null?void 0:o.index)===i&&(o==null?void 0:o.type)==="primary"?"bg-yellow-300":"hover:bg-[var(--team-primary-color)] hover:text-white"):"bg-gray-200 text-gray-900 cursor-default"),style:g?{"--team-primary-color":m}:void 0,children:p||"—"},`${r}-primary-${i}`))}),e.jsx("div",{className:"flex w-full rounded overflow-hidden border border-gray-600",children:b.map((p,i)=>e.jsx("div",{draggable:g,onDragStart:()=>g&&B(r,i,"secondary"),onDragOver:J,onDrop:c=>_(c,r,i,"secondary"),className:w("flex-1 text-xs font-bold text-center py-0.5 transition-colors",i!==b.length-1?"border-r border-gray-600":"",g?w("bg-yellow-50 text-gray-800 cursor-grab active:cursor-grabbing",(o==null?void 0:o.team)===r&&(o==null?void 0:o.index)===i&&(o==null?void 0:o.type)==="secondary"?"bg-yellow-200":"hover:bg-[var(--team-primary-color)] hover:text-white"):"bg-gray-800 text-gray-200 cursor-default"),style:g?{"--team-primary-color":m}:void 0,children:p||"—"},`${r}-secondary-${i}`))})]})]},r)})})]},s))})]}),e.jsx(Z,{open:H,onOpenChange:A,children:e.jsxs(ee,{className:"bg-gray-800 border-gray-600 text-white",children:[e.jsx(re,{children:e.jsx(se,{className:"text-white",children:"How to Edit Team Needs"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-sm text-gray-300",children:[e.jsxs("li",{children:["Click ",e.jsx("strong",{children:"'Edit Needs'"})," (requires login)"]}),e.jsx("li",{children:"Drag needs for any team to reorder"}),e.jsxs("li",{children:["Click ",e.jsx("strong",{children:"'Save'"})," when done"]}),e.jsxs("li",{children:["Click ",e.jsx("strong",{children:"'Reset'"})," to restore HQ defaults"]})]}),e.jsxs("p",{className:"text-sm text-gray-300",children:[e.jsx("strong",{children:"Primary Needs:"})," Top 5 priority positions for each team",e.jsx("br",{}),e.jsx("strong",{children:"Secondary Needs:"})," Next 7 positions the team could use"]})]})]})})]})};export{he 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.