PageSourceSearch

https://tradeintelx.com/assets/LibraryUploadModal-D0_lVndk.js

js tradeintelx.com collected 2026-09-24 14:56:20 UTC 6,984 bytes, 1 lines download raw bytes

1import{o as g}from"./rolldown-runtime-ChpBd9eV.js";import{La as j,Ta as y,da as v,tt as N}from"./chat-page-evUfHQgD.js";import{Ct as w,M as k,N as C,n as P}from"./education-page-vD6yUpCZ.js";var r=g(j(),1),e=y(),F=({onClose:c,onSuccess:m,user:o})=>{const[t,l]=(0,r.useState)({title:"",description:"",type:"article",topic:"patterns",content:"",tags:""}),[a,x]=(0,r.useState)(null),[i,u]=(0,r.useState)(!1),[p,b]=(0,r.useState)(0),h=async s=>{if(s.preventDefault(),!!t.title.trim()&&!((t.type==="document"||t.type==="presentation"||t.type==="video")&&!a))try{u(!0);const n={...t,tags:t.tags.split(",").map(d=>d.trim()).filter(Boolean),authorId:o?.uid,authorName:o?.displayName||o?.email||"Admin"};await C.createResource(n,a,d=>{b(d)}),m()}catch(n){P("library","Resource upload error:",n)}finally{u(!1)}},f=()=>{switch(t.type){case"document":return".pdf,.doc,.docx";case"presentation":return".ppt,.pptx,.key";case"video":return".mp4,.mov,.webm";default:return""}};return(0,e.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/70 backdrop-blur-sm",children:(0,e.jsxs)(v.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"bg-slate-900 rounded-2xl w-full max-w-2xl max-h-[90vh] overflow-y-auto border border-slate-700",children:[(0,e.jsxs)("div",{className:"sticky top-0 bg-slate-900 p-6 border-b border-slate-700 flex items-center justify-between",children:[(0,e.jsx)("h2",{className:"text-xl font-bold text-white",children:"Add Library Resource"}),(0,e.jsx)("button",{onClick:c,className:"p-2 hover:bg-slate-700 rounded-lg transition-colors",children:(0,e.jsx)(N,{className:"w-5 h-5 text-slate-400"})})]}),(0,e.jsxs)("form",{onSubmit:h,className:"p-6 space-y-6",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("label",{className:"block text-sm font-medium text-slate-300 mb-2",children:"Resource Type"}),(0,e.jsx)("div",{className:"grid grid-cols-4 gap-3",children:[{id:"article",label:"Article",icon:"📰"},{id:"document",label:"Document",icon:"📄"},{id:"presentation",label:"Presentation",icon:"📊"},{id:"video",label:"Video",icon:"🎬"}].map(s=>(0,e.jsxs)("button",{type:"button",onClick:()=>l({...t,type:s.id}),className:`p-3 rounded-xl border text-center transition-all ${t.type===s.id?"bg-purple-600/20 border-purple-500 text-white":"bg-slate-800/50 border-slate-700 text-slate-400 hover:border-slate-600"}`,children:[(0,e.jsx)("span",{className:"text-2xl",children:s.icon}),(0,e.jsx)("p",{className:"text-xs mt-1",children:s.label})]},s.id))})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("label",{className:"block text-sm font-medium text-slate-300 mb-2",children:"Trading Topic"}),(0,e.jsx)("select",{value:t.topic,onChange:s=>l({...t,topic:s.target.value}),className:"w-full px-4 py-3 bg-slate-800 border border-slate-700 rounded-xl text-white focus:outline-none focus:ring-2 focus:ring-purple-500",children:k.map(s=>(0,e.jsxs)("option",{value:s.id,children:[s.icon," ",s.name]},s.id))})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("label",{className:"block text-sm font-medium text-slate-300 mb-2",children:"Title"}),(0,e.jsx)("input",{type:"text",value:t.title,onChange:s=>l({...t,title:s.target.value}),placeholder:"Enter resource title",className:"w-full px-4 py-3 bg-slate-800 border border-slate-700 rounded-xl text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-purple-500"})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("label",{className:"block text-sm font-medium text-slate-300 mb-2",children:"Description"}),(0,e.jsx)("textarea",{value:t.description,onChange:s=>l({...t,description:s.target.value}),placeholder:"Brief description of the resource",rows:3,className:"w-full px-4 py-3 bg-slate-800 border border-slate-700 rounded-xl text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-purple-500 resize-none"})]}),t.type==="article"&&(0,e.jsxs)("div",{children:[(0,e.jsx)("label",{className:"block text-sm font-medium text-slate-300 mb-2",children:"Article Content"}),(0,e.jsx)("textarea",{value:t.content,onChange:s=>l({...t,content:s.target.value}),placeholder:"Write your article content here (supports markdown)",rows:10,className:"w-full px-4 py-3 bg-slate-800 border border-slate-700 rounded-xl text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-purple-500 resize-none font-mono text-sm"})]}),(t.type==="document"||t.type==="presentation"||t.type==="video")&&(0,e.jsxs)("div",{children:[(0,e.jsxs)("label",{className:"block text-sm font-medium text-slate-300 mb-2",children:["Upload ",t.type==="document"?"Document (PDF, Word)":t.type==="presentation"?"Presentation (PowerPoint)":"Video"]}),(0,e.jsxs)("div",{className:"border-2 border-dashed border-slate-700 rounded-xl p-6 text-center hover:border-purple-500/50 transition-colors",children:[(0,e.jsx)("input",{type:"file",accept:f(),onChange:s=>x(s.target.files[0]),className:"hidden",id:"file-upload"}),(0,e.jsxs)("label",{htmlFor:"file-upload",className:"cursor-pointer",children:[(0,e.jsx)(w,{className:"w-12 h-12 mx-auto text-slate-500 mb-3"}),a?(0,e.jsx)("p",{className:"text-white font-medium",children:a.name}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("p",{className:"text-slate-400 mb-1",children:"Click to upload or drag and drop"}),(0,e.jsxs)("p",{className:"text-xs text-slate-500",children:[t.type==="document"&&"PDF, DOC, DOCX up to 50MB",t.type==="presentation"&&"PPT, PPTX, KEY up to 100MB",t.type==="video"&&"MP4, MOV, WEBM up to 500MB"]}
1)]})]})]})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("label",{className:"block text-sm font-medium text-slate-300 mb-2",children:"Tags (comma separated)"}),(0,e.jsx)("input",{type:"text",value:t.tags,onChange:s=>l({...t,tags:s.target.value}),placeholder:"e.g., beginner, technical analysis, swing trading",className:"w-full px-4 py-3 bg-slate-800 border border-slate-700 rounded-xl text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-purple-500"})]}),i&&(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,e.jsx)("span",{className:"text-slate-400",children:"Uploading..."}),(0,e.jsxs)("span",{className:"text-purple-400",children:[Math.round(p),"%"]})]}),(0,e.jsx)("div",{className:"h-2 bg-slate-700 rounded-full overflow-hidden",children:(0,e.jsx)("div",{className:"h-full bg-gradient-to-r from-purple-600 to-blue-600 transition-all",style:{width:`${p}%`}})})]}),(0,e.jsxs)("div",{className:"flex gap-3 pt-4",children:[(0,e.jsx)("button",{type:"button",onClick:c,className:"flex-1 px-6 py-3 bg-slate-700 hover:bg-slate-600 text-white rounded-xl font-medium transition-colors",children:"Cancel"}),(0,e.jsx)("button",{type:"submit",disabled:i,className:"flex-1 px-6 py-3 bg-gradient-to-r from-purple-600 to-blue-600 hover:from-purple-500 hover:to-blue-500 text-white rounded-xl font-medium transition-all disabled:opacity-50 disabled:cursor-not-allowed",children:i?"Uploading...":"Publish Resource"})]})]})]})})};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.