PageSourceSearch

https://wonnda.com/assets/_adminAuth.admin.link-juicer.keywords-M6xEwagf.js

js wonnda.com collected 2026-09-25 20:20:28 UTC 7,774 bytes, 2 lines download raw bytes

1import{aM as x,bF as q,r as d,bD as U,j as e,aL as D,bN as A}from"./index-Dz0Ir0TL.js";import{a as Q,b as W,c as z,t as F}from"./link-juicer.functions-foqjhrsl.js";import{T as O}from"./trash-2-C1aa_ceM.js";const $=["post","category","product_type","production_country","download","supplier","static","money-page"];function V(){const j=x(Q),v=x(W),f=x(z),N=x(F),w=q(),[m,_]=d.useState(""),[p,k]=d.useState(""),[o,T]=d.useState(""),[l,S]=d.useState(""),[h,C]=d.useState("keyword"),[a,n]=d.useState(1),{data:r,isLoading:y}=U({queryKey:["lj-keywords",m,p,o,l,h,a],queryFn:()=>j({data:{q:m||void 0,targetType:p||void 0,keywordEnabled:o===""?void 0:o==="true",targetEnabled:l===""?void 0:l==="true",sort:h,page:a,pageSize:100}})}),g=()=>w.invalidateQueries({queryKey:["lj-keywords"]}),c=r?.rows??[],u=r?Math.max(1,Math.ceil(r.total/r.pageSize)):1;async function K(t){await v({data:{id:t.id,target_id:t.target_id,keyword:t.keyword,match_mode:t.match_mode??"whole-word",case_sensitive:t.case_sensitive,anchor_variants:t.anchor_variants,is_enabled:!t.is_enabled}}),g()}async function E(t){confirm("Delete this keyword?")&&(await f({data:{id:t}}),g())}async function L(t){await N({data:{id:t.target_id,enabled:!t.target.is_enabled}}),g()}const R=d.useMemo(()=>{const t=["keyword","match_mode","case_sensitive","anchor_variants","kw_enabled","target_title","target_url","target_type","target_enabled","priority","cluster","inserts_30d"].join(","),i=c.map(s=>[s.keyword,s.match_mode,s.case_sensitive,s.anchor_variants.join("|"),s.is_enabled,s.target.target_title,s.target.target_url,s.target.target_type,s.target.is_enabled,s.target.priority,s.target.topical_cluster??"",s._inserts_30d].map(P=>{const b=String(P??"");return/[",\n]/.test(b)?`"${b.replace(/"/g,'""')}"`:b}).join(","));return[t,...i].join(`
2`)},[c]);function M(){const t=new Blob([R],{type:"text/csv;charset=utf-8"}),i=URL.createObjectURL(t),s=document.createElement("a");s.href=i,s.download=`link-juicer-keywords-page${a}.csv`,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(i)}return e.jsxs("div",{children:[e.jsxs("header",{className:"mb-6",children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Keywords"}),e.jsx("p",{className:"mt-1 text-sm text-fg-muted",children:"One row per keyword → target. Search, filter, edit enabled state, or jump to the target."})]}),e.jsxs("div",{className:"mb-4 flex flex-wrap items-center gap-2",children:[e.jsx("input",{value:m,onChange:t=>{_(t.target.value),n(1)},placeholder:"Search keyword text…",className:"w-80 rounded-md border border-border-strong bg-bg-elevated px-3 py-1.5 text-sm outline-none"}),e.jsxs("select",{value:p,onChange:t=>{k(t.target.value),n(1)},className:"rounded-md border border-border-strong bg-bg-elevated px-2 py-1.5 text-sm",children:[e.jsx("option",{value:"",children:"All target types"}),$.map(t=>e.jsx("option",{value:t,children:t},t))]}),e.jsxs("select",{value:o,onChange:t=>{T(t.target.value),n(1)},className:"rounded-md border border-border-strong bg-bg-elevated px-2 py-1.5 text-sm",children:[e.jsx("option",{value:"",children:"KW: all"}),e.jsx("option",{value:"true",children:"KW: enabled"}),e.jsx("option",{value:"false",children:"KW: disabled"})]}),e.jsxs("select",{value:l,onChange:t=>{S(t.target.value),n(1)},className:"rounded-md border border-border-strong bg-bg-elevated px-2 py-1.5 text-sm",children:[e.jsx("option",{value:"",children:"Target: all"}),e.jsx("option",{value:"true",children:"Target: enabled"}),e.jsx("option",{value:"false",children:"Target: disabled"})]}),e.jsxs("select",{value:h,onChange:t=>C(t.target.value),className:"rounded-md border border-border-strong bg-bg-elevated px-2 py-1.5 text-sm",children:[e.jsx("option",{value:"keyword",children:"Sort: keyword A→Z"}),e.jsx("option",{value:"inserts",children:"Sort: inserts 30d"}),e.jsx("option",{value:"target_url",children:"Sort: target URL"})]}),e.jsx("div",{className:"ml-auto flex items-center gap-2",children:e.jsxs("button",{onClick:M,className:"inline-flex items-center gap-1.5 rounded-md border border-border-strong px-3 py-1.5 text-sm hover:bg-bg-elevated",children:[e.jsx(D,{className:"h-3.5 w-3.5"}),"Export CSV (page)"]})})]}),e.jsx("div",{className:"overflow-x-auto rounded-md border border-border-strong",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-bg-elevated text-xs uppercase tracking-wide text-fg-muted",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Keyword"}),e.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Match"}),e.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Anchor variants"}),e.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Target"}),e.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"URL"}),e.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Type"}),e.jsx("th",{className:"px-3 py-2 text-right font-medium",children:"Prio"}),e.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Cluster"}),e.jsx("th",{className:"px-3 py-2 text-center font-medium",children:"KW on"}),e.jsx("th",{className:"px-3 py-2 text-center font-medium",children:"Target on"}),e.jsx("th",{className:"px-3 py-2 text-right font-medium",children:"Inserts 30d"}),e.jsx("th",{className:"px-3 py-2"})]})}),e.jsxs("tbody",{children:[y&&e.jsx("tr",{children:e.jsx("td",{colSpan:12,className:"px-3 py-8 text-center text-fg-muted",children:e.jsx(A,{className:"mx-auto h-4 w-4 animate-spin"})})}),!y&&c.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:12,className:"px-3 py-8 text-center text-fg-muted",children:"No keywords match these filters."})}),c.map(t=>e.jsxs("tr",{className:"border-t border-border-strong hover:bg-bg-elevated/50",children:[e.jsx("td",{className:"px-3 py-2 font-medium",children:t.keyword}),e.jsxs("td",{className:"px-3 py-2 text-xs text-fg-muted",children:[t.match_mode,t.case_sensitive?" · cs":""]}),e.jsx("td",{className:"px-3 py-2 text-xs text-fg-muted",children:t.anchor_variants.length>0?t.anchor_variants.join(", "):"-"}),e.jsx("td",{className:"px-3 py-2",children:e.jsx("a",{href:`/admin/link-juicer/?openTarget=${t.target_id}`,className:"text-accent hover:underline",children:t.target.target_title})}),e.jsx("td",{className:"px-3 py-2 font-mono text-xs text-fg-muted",children:t.target.target_url}),e.jsx("td",{className:"px-3 py-2 text-xs",children:t.target.target_type}),e.jsx("td",{className:"px-3 py-2 text-right",children:t.target.priority}),e.jsx("td",{className:"px-3 py-2 text-xs text-fg-muted",children:t.target.topical_cluster??"-"}),e.jsx("td",{className:"px-3 py-2 text-center",children:e.jsx("input",{type:"checkbox",checked:t.is_enabled,onChange:()=>K(t)})}),e.jsx("td",{className:"px-3 py-2 text-center",children:e.jsx("input",{type:"checkbox",checked:t.target.is_enabled,onChange:()=>L(t)})}),e.jsx("td",{className:"px-3 py-2 text-right",children:t._inserts_30d}),e.jsx("td",{className:"px-3 py-2 text-right",children:e.jsx("button",{onClick:()=>
2E(t.id),className:"text-fg-muted hover:text-red-600",title:"Delete keyword",children:e.jsx(O,{className:"h-3.5 w-3.5"})})})]},t.id))]})]})}),r&&r.total>r.pageSize&&e.jsxs("div",{className:"mt-3 flex items-center justify-between text-xs text-fg-muted",children:[e.jsxs("span",{children:[r.total," total • Page ",a,"/",u]}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{onClick:()=>n(Math.max(1,a-1)),disabled:a===1,className:"rounded border border-border-strong px-2 py-1 disabled:opacity-50",children:"Prev"}),e.jsx("button",{onClick:()=>n(Math.min(u,a+1)),disabled:a>=u,className:"rounded border border-border-strong px-2 py-1 disabled:opacity-50",children:"Next"})]})]})]})}export{V as component};

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.