PageSourceSearch

https://scholar.0xpi.com/assets/AdminArticles-BWij857Q.js

js 0xpi.com collected 2026-09-28 06:12:31 UTC 11,175 bytes, 18 lines download raw bytes

1import{j as e}from"./vendor-three-Bmn2g83e.js";import{r as i,u as k}from"./vendor-react-kRHgybFd.js";import{a as m}from"./adminAxios-ByTPVtHS.js";import"./main-D9e5nRIT.js";/* empty css                    */import{az as W,F as y,A as T,B,i as N,f as b,a2 as E,ba as P,a9 as _}from"./vendor-misc-DSUDoLcJ.js";function q(){const[c,u]=i.useState([]),[a,j]=i.useState(null),[g,x]=i.useState(!0),[l,f]=i.useState(""),[o,v]=i.useState(""),[s,d]=i.useState(1),[n,S]=i.useState({}),z=k();i.useEffect(()=>{p()},[s,o]);const p=async()=>{try{x(!0);const t=new URLSearchParams({page:s,limit:20,sortBy:"created_at",sortOrder:"DESC"});l&&t.append("search",l),o&&t.append("category",o);const[r,w]=await Promise.all([m.get(`/api/admin/articles?${t}`),m.get("/api/admin/articles-stats")]);u(r.data.articles||[]),S(r.data.pagination||{}),j(r.data.stats||w.data.stats),x(!1)}catch(t){console.error("Error loading articles:",t),x(!1)}},A=t=>{t.preventDefault(),d(1),p()},C=t=>{z(`/admin/articles/${t}`)},h=t=>({Science:"#3b82f6",Technology:"#8b5cf6","Social Sciences":"#ec4899",Health:"#10b981",Business:"#f59e0b",Education:"#06b6d4"})[t]||"#6b7280";return g&&c.length===0?e.jsx("div",{className:"admin-content",children:e.jsxs("div",{style:{textAlign:"center",padding:"4rem"},children:[e.jsx("div",{className:"spinner"}),e.jsx("p",{style:{color:"rgba(255,255,255,0.6)",marginTop:"1rem"},children:"Loading articles..."})]})}):e.jsxs("div",{className:"admin-content",children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"2rem"},children:[e.jsxs("div",{children:[e.jsx("h1",{style:{fontSize:"32px",fontWeight:"800",background:"linear-gradient(135deg, #3E1A61 0%, #D41041 100%)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",marginBottom:"0.5rem"},children:"📝 Generated Articles"}),e.jsx("p",{style:{color:"rgba(255,255,255,0.6)",margin:0},children:"AI-generated content library from autonomous engine"})]}),e.jsxs("button",{onClick:p,className:"admin-button",disabled:g,children:[e.jsx(W,{size:18,className:g?"spinning":""}),"Refresh"]})]}),a&&e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:"1.5rem",marginBottom:"2rem"},children:[e.jsx("div",{className:"admin-card",style:{background:"linear-gradient(135deg, rgba(62, 26, 97, 0.1) 0%, rgba(212, 16, 65, 0.1) 100%)",border:"1px solid rgba(62, 26, 97, 0.3)"},children:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{color:"rgba(255,255,255,0.6)",fontSize:"14px",marginBottom:"0.5rem"},children:"Total Articles"}),e.jsx("div",{style:{fontSize:"36px",fontWeight:"800",color:"white"},children:parseInt(a.total_articles||0).toLocaleString()})]}),e.jsx(y,{size:40,color:"rgba(62, 26, 97, 0.3)"})]})}),e.jsx("div",{className:"admin-card",style:{background:"linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.1) 100%)",border:"1px solid rgba(16, 185, 129, 0.3)"},children:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{color:"rgba(255,255,255,0.6)",fontSize:"14px",marginBottom:"0.5rem"},children:"Avg Quality Score"}),e.jsxs("div",{style:{fontSize:"36px",fontWeight:"800",color:"#10b981"},children:[parseFloat(a.avg_quality||0).toFixed(1),"%"]})]}),e.jsx(T,{size:40,color:"rgba(16, 185, 129, 0.3)"})]})}),e.jsx("div",{className:"admin-card",style:{background:"linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(37, 99, 235, 0.1) 100%)",border:"1px solid rgba(59, 130, 246, 0.3)"},children:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{color:"rgba(255,255,255,0.6)",fontSize:"14px",marginBottom:"0.5rem"},children:"Avg Word Count"}),e.jsx("div",{style:{fontSize:"36px",fontWeight:"800",color:"#3b82f6"},children:parseInt(a.avg_words||0).toLocaleString()})]}),e.jsx(B,{size:40,color:"rgba(59, 130, 246, 0.3)"})]})}),e.jsx("div",{className:"admin-card",style:{background:"linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(217, 119, 6, 0.1) 100%)",border:"1px solid rgba(245, 158, 11, 0.3)"},children:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{color:"rgba(255,255,255,0.6)",fontSize:"14px",marginBottom:"0.5rem"},children:"Today"}),e.jsx("div",{style:{fontSize:"36px",fontWeight:"800",color:"#f59e0b"}
1,children:parseInt(a.today_count||0).toLocaleString()}),e.jsxs("div",{style:{color:"rgba(255,255,255,0.5)",fontSize:"14px",marginTop:"0.5rem"},children:["Week: ",parseInt(a.week_count||0).toLocaleString()]})]}),e.jsx(N,{size:40,color:"rgba(245, 158, 11, 0.3)"})]})})]}),e.jsx("div",{className:"admin-card",style:{marginBottom:"2rem"},children:e.jsxs("form",{onSubmit:A,style:{display:"flex",gap:"1rem",flexWrap:"wrap"},children:[e.jsxs("div",{style:{flex:"1 1 300px",position:"relative"},children:[e.jsx(b,{size:18,style:{position:"absolute",left:"12px",top:"50%",transform:"translateY(-50%)",color:"rgba(255,255,255,0.4)"}}),e.jsx("input",{type:"text",placeholder:"Search articles by title or content...",value:l,onChange:t=>f(t.target.value),style:{width:"100%",padding:"10px 10px 10px 40px",background:"rgba(255,255,255,0.05)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:"8px",color:"white",fontSize:"14px"}})]}),e.jsxs("select",{value:o,onChange:t=>{v(t.target.value),d(1)},style:{padding:"10px 16px",background:"rgba(255,255,255,0.05)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:"8px",color:"white",fontSize:"14px",cursor:"pointer"},children:[e.jsx("option",{value:"",children:"All Categories"}),e.jsx("option",{value:"Science",children:"Science"}),e.jsx("option",{value:"Technology",children:"Technology"}),e.jsx("option",{value:"Social Sciences",children:"Social Sciences"}),e.jsx("option",{value:"Health",children:"Health"}),e.jsx("option",{value:"Business",children:"Business"}),e.jsx("option",{value:"Education",children:"Education"})]}),e.jsxs("button",{type:"submit",className:"admin-button",children:[e.jsx(b,{size:18}),"Search"]})]})}),e.jsxs("div",{className:"admin-card",children:[e.jsxs("h2",{style:{fontSize:"20px",fontWeight:"700",color:"white",marginBottom:"1.5rem"},children:["Articles (",n.total||0,")"]}),c.length===0?e.jsxs("div",{style:{textAlign:"center",padding:"3rem",color:"rgba(255,255,255,0.6)"},children:[e.jsx(y,{size:48,style:{margin:"0 auto 1rem",opacity:.3}}),e.jsx("p",{style:{fontSize:"18px",marginBottom:"0.5rem"},children:"No articles found"}),e.jsx("p",{style:{fontSize:"14px"},children:l||o?"Try adjusting your search filters":"Articles will appear here once the autonomous engine generates them"})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{overflowX:"auto"},children:e.jsxs("table",{style:{width:"100%",borderCollapse:"collapse"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{borderBottom:"1px solid rgba(255,255,255,0.1)"},children:[e.jsx("th",{style:{padding:"1rem",textAlign:"left",color:"rgba(255,255,255,0.6)",fontWeight:"600"},children:"Title"}),e.jsx("th",{style:{padding:"1rem",textAlign:"left",color:"rgba(255,255,255,0.6)",fontWeight:"600"},children:"Category"}),e.jsx("th",{style:{padding:"1rem",textAlign:"right",color:"rgba(255,255,255,0.6)",fontWeight:"600"},children:"Words"}),e.jsx("th",{style:{padding:"1rem",textAlign:"right",color:"rgba(255,255,255,0.6)",fontWeight:"600"},children:"Quality"}),e.jsx("th",{style:{padding:"1rem",textAlign:"right",color:"rgba(255,255,255,0.6)",fontWeight:"600"},children:"SEO"}),e.jsx("th",{style:{padding:"1rem",textAlign:"left",color:"rgba(255,255,255,0.6)",fontWeight:"600"},children:"Created"}),e.jsx("th",{style:{padding:"1rem",textAlign:"center",color:"rgba(255,255,255,0.6)",fontWeight:"600"},children:"Action"})]})}),e.jsx("tbody",{children:c.map(t=>e.jsxs("tr",{style:{borderBottom:"1px solid rgba(255,255,255,0.05)",transition:"background 0.2s"},onMouseEnter:r=>r.currentTarget.style.background="rgba(255,255,255,0.02)",onMouseLeave:r=>r.currentTarget.style.background="transparent",children:[e.jsxs("td",{style:{padding:"1rem"},children:[e.jsx("div",{style:{color:"white",fontWeight:"600",marginBottom:"0.25rem"},children:t.title}),e.jsxs("div",{style:{color:"rgba(255,255,255,0.5)",fontSize:"13px"},children:[t.excerpt,"..."]})]}),e.jsx("td",{style:{padding:"1rem"},children:e.jsx("span",{style:{background:`${h(t.category)}20`,color:h(t.category),padding:"4px 12px",borderRadius:"12px",fontSize:"12px",fontWeight:"600"},children:t.category})}),e.jsx("td",{style:{padding:"1rem",textAlign:"right",color:"white"}
1,children:(t.word_count||0).toLocaleString()}),e.jsx("td",{style:{padding:"1rem",textAlign:"right"},children:e.jsxs("span",{style:{color:t.quality_score>=90?"#10b981":t.quality_score>=80?"#f59e0b":"#ef4444",fontWeight:"600"},children:[t.quality_score||0,"%"]})}),e.jsx("td",{style:{padding:"1rem",textAlign:"right"},children:t.seo_optimized?e.jsxs("span",{style:{color:"#10b981",fontSize:"12px"},children:["✓ ",t.seo_score||0,"%"]}):e.jsx("span",{style:{color:"rgba(255,255,255,0.3)",fontSize:"12px"},children:"Pending"})}),e.jsx("td",{style:{padding:"1rem",color:"rgba(255,255,255,0.6)",fontSize:"14px"},children:new Date(t.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),e.jsx("td",{style:{padding:"1rem",textAlign:"center"},children:e.jsxs("button",{onClick:()=>C(t.id),style:{background:"linear-gradient(135deg, #3E1A61 0%, #D41041 100%)",color:"white",border:"none",padding:"6px 12px",borderRadius:"6px",cursor:"pointer",fontSize:"13px",fontWeight:"600",display:"inline-flex",alignItems:"center",gap:"6px",transition:"opacity 0.2s"},onMouseEnter:r=>r.currentTarget.style.opacity="0.8",onMouseLeave:r=>r.currentTarget.style.opacity="1",children:[e.jsx(E,{size:14}),"View"]}
1)})]},t.id))})]})}),n.totalPages>1&&e.jsxs("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",gap:"1rem",marginTop:"2rem",paddingTop:"2rem",borderTop:"1px solid rgba(255,255,255,0.1)"},children:[e.jsxs("button",{onClick:()=>d(Math.max(1,s-1)),disabled:s===1,className:"admin-button",style:{opacity:s===1?.5:1},children:[e.jsx(P,{size:18}),"Previous"]}),e.jsxs("div",{style:{color:"rgba(255,255,255,0.6)",fontSize:"14px"},children:["Page ",n.page," of ",n.totalPages]}),e.jsxs("button",{onClick:()=>d(Math.min(n.totalPages,s+1)),disabled:s===n.totalPages,className:"admin-button",style:{opacity:s===n.totalPages?.5:1},children:["Next",e.jsx(_,{size:18})]})]})]})]}),e.jsx("style",{children:`
2        .spinner {
3          border: 4px solid rgba(255, 255, 255, 0.1);
4          border-top: 4px solid #3E1A61;
5          border-radius: 50%;
6          width: 40px;
7          height: 40px;
8          animation: spin 1s linear infinite;
9          margin: 0 auto;
10        }
11        .spinning {
12          animation: spin 1s linear infinite;
13        }
14        @keyframes spin {
15          0% { transform: rotate(0deg); }
16          100% { transform: rotate(360deg); }
17        }
18      `})]})}export{q 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.