PageSourceSearch

https://nfldrafthq.com/assets/AddCustomNews-DIDdTmTQ.js

js nfldrafthq.com collected 2026-10-05 19:58:19 UTC 6,189 bytes, 1 lines download raw bytes

1import{U as w,r as u,j as e,aa as f,B as d,K as p,$ as v,a0 as y,ab as L,M as g,L as o,I as c}from"./index-Ba4BgsO5.js";import{A as k}from"./arrow-left-CDhENZt7.js";import{T as C,E as R}from"./trash-2-CtRWVB9q.js";import{P as $}from"./plus-BbQBPcW1.js";function F(){const{toast:h}=w(),[r,l]=u.useState([{url:"",headline:"",source:"",date:""}]),[m,x]=u.useState(!1),j=()=>{l([...r,{url:"",headline:"",source:"",date:""}])},b=a=>{l(r.filter((s,t)=>t!==a))},i=(a,s,t)=>{const n=[...r];n[a]={...n[a],[s]:t},l(n)},N=async a=>{a.preventDefault();const s=r.filter(t=>t.url);if(s.length===0){h({title:"No valid links",description:"Please add at least one URL",variant:"destructive"});return}x(!0);try{const t=await fetch("/api/add-custom-news",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({links:s})});if(!t.ok)throw new Error("Failed to add news links");const n=await t.json();h({title:"Success!",description:`Added ${s.length} news link(s) to scrolling header, news columns, and HTML files for SEO`}),l([{url:"",headline:"",source:"",date:""}])}catch(t){h({title:"Error",description:t instanceof Error?t.message:"Failed to add news links",variant:"destructive"})}finally{x(!1)}};return e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-blue-900 to-slate-900 py-8",children:e.jsxs("div",{className:"container mx-auto px-4 max-w-4xl",children:[e.jsx(f,{href:"/",children:e.jsxs(d,{variant:"ghost",className:"mb-6 text-white hover:text-blue-300",children:[e.jsx(k,{className:"mr-2 h-4 w-4"}),"Back to Home"]})}),e.jsxs(p,{className:"bg-slate-800 border-blue-500",children:[e.jsxs(v,{children:[e.jsx(y,{className:"text-white text-3xl",children:"Add Custom News Links"}),e.jsx(L,{className:"text-gray-300",children:"Add news links from any sports site. They'll appear in the scrolling header, news columns, and HTML for SEO."})]}),e.jsxs(g,{children:[e.jsxs("form",{onSubmit:N,className:"space-y-6",children:[r.map((a,s)=>e.jsx(p,{className:"bg-slate-700 border-slate-600",children:e.jsxs(g,{className:"pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"text-white font-semibold",children:["News Link #",s+1]}),r.length>1&&e.jsxs(d,{type:"button",variant:"ghost",size:"sm",onClick:()=>b(s),className:"text-red-400 hover:text-red-300 hover:bg-red-900/20","data-testid":`button-remove-news-${s}`,children:[e.jsx(C,{className:"h-4 w-4 mr-1"}),"Remove"]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs(o,{htmlFor:`url-${s}`,className:"text-white",children:["News URL ",e.jsx("span",{className:"text-red-400",children:"*"})]}),e.jsx(c,{id:`url-${s}`,type:"url",placeholder:"https://example.com/article",value:a.url,onChange:t=>i(s,"url",t.target.value),className:"bg-slate-600 text-white border-slate-500",required:!0,"data-testid":`input-url-${s}`})]}),e.jsxs("div",{children:[e.jsxs(o,{htmlFor:`headline-${s}`,className:"text-white",children:["Custom Prefix ",e.jsx("span",{className:"text-gray-400",children:"(Optional)"})]}),e.jsx(c,{id:`headline-${s}`,type:"text",placeholder:'e.g., "Bucs Nuts:" or "Breaking:" (we add the rest from URL)',value:a.headline,onChange:t=>i(s,"headline",t.target.value),className:"bg-slate-600 text-white border-slate-500","data-testid":`input-headline-${s}`}),e.jsxs("p",{className:"text-xs text-gray-400 mt-1",children:["If provided, appears as: ",e.jsx("span",{className:"text-blue-300",children:"Your Prefix + Auto-extracted headline from URL"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(o,{htmlFor:`source-${s}`,className:"text-white",children:"Source (Optional)"}),e.jsx(c,{id:`source-${s}`,type:"text",placeholder:"e.g., NFL.com",value:a.source,onChange:t=>i(s,"source",t.target.value),className:"bg-slate-600 text-white border-slate-500","data-testid":`input-source-${s}`})]}),e.jsxs("div",{children:[e.jsx(o,{htmlFor:`date-${s}`,className:"text-white",children:"Date (Optional)"}),e.jsx(c,{id:`date-${s}`,type:"date",value:a.date,onChange:t=>i(s,"date",t.target.value),className:"bg-slate-600 text-white border-slate-500","data-testid":`input-date-${s}`})]})]}),a.url&&e.jsx("div",{className:"pt-2",children:e.jsxs("a",{href:a.url,target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 hover:text-blue-300 text-sm flex items-center gap-1",children:[e.jsx(R,{className:"h-3 w-3"}),"Preview link"]})})]})]})},s)),e.jsxs("div",{className:"flex gap-4",children:[e.jsxs(d,{type:"button",variant:"outline",onClick:j,className:"flex-1 bg-slate-700 text-white border-blue-500 hover:bg-slate-600","data-testid":"button-add-another",children:[e.jsx($,{className:"mr-2 h-4 w-4"}),"Add Another Link"]}),e.jsx(d,{type:"submit",disabled:m,className:"flex-1 bg-blue-600 hover:bg-blue-700 text-white","data-testid":"button-submit",children:m?"Adding...":`Add ${r.filter(a=>a.url).length} Link(s)`})]})]}),e.jsxs("div",{className:"mt-8 p-4 bg-blue-900/30 rounded-lg border border-blue-500",children:[e.jsx("h4",{className:"text-white font-semibold mb-2",children:"💡 How This Works"}),e.jsxs("ul",{className:"text-gray-300 text-sm space-y-1",children:[e.jsxs("li",{children:["• ",e.jsx("strong",{children:"Scrolling Header:"})," Your news appears in the live ticker at the top"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"News Columns:"})," Shows in Draft News, NFL Latest, or Fantasy Insights"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"SEO Boost:"})," Added to 3 HTML files for search engines"]}),e.jsxs("li",{children:["• ",e.jsx("strong",{children:"Custom Prefix:"})," Add a custom headline and we extract the rest from the URL!"]})]}),e.jsxs("div",{className:"mt-3 p-3 bg-slate-700 rounded text-xs",children:[e.jsx("p",{className:"text-blue-300 font-semibold mb-1",children:"Example:"}),e.jsx("p",{className:"text-gray-300",children:"URL: https://example.com/article"}),e.jsx("p",{className:"text-gray-300",children:'Prefix: "Rodgers Rocks:"'}),e.jsx("p",{className:"text-green-400 mt-2",children:'Result: "Rodgers Rocks: Aaron Rodgers leads Jets to victory"'})]})]})]})]})]})})}export{F 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.