PageSourceSearch

https://careerplatform.io/assets/admin_.user-history-UAFHS8tQ.js

js careerplatform.io collected 2026-09-24 15:05:57 UTC 15,781 bytes, 1 lines download raw bytes

1import{r as v,a as b,f as _,t as y,j as e,a9 as k,E as C,B as S,be as R}from"./index-DNidg_Qc.js";import{I as $}from"./input-70YvsUaZ.js";import{L as A}from"./label-Bhudjdxi.js";import{J as F,d as P,K as U,L as O}from"./admin.functions-D2EedA8Q.js";function G(){const[r,t]=v.useState(""),[i,l]=v.useState(null),[a,d]=v.useState(""),[n,o]=v.useState({}),[x,u]=v.useState({}),h=b(F),p=b(P),j=b(U),L=b(O),N=_({mutationFn:async()=>{const s=r.trim(),m=a.trim();if(!s)throw new Error("Enter the user's email address.");if(m.length<3)throw new Error("Enter a reason (at least 3 characters) - it's logged for audit.");const f=await p({data:{email:s}});if(!f.user)throw new Error(`No account found for ${s}.`);return l(f.user.id),j({data:{userId:f.user.id,reason:m,limit:15}})},onError:s=>y.error(s.message),onSuccess:()=>y.success("Loaded user history - view logged.")}),g=_({mutationFn:()=>L({data:{limit:50}}),onError:s=>y.error(s.message)}),c=N.data,I=c?[{title:"ATS Scores",rows:c.ats,render:s=>e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"text-sm font-medium",children:["Score: ",s.score," - ",s.title??"(no title)"]}),e.jsx(V,{id:`ats-${s.id}`,reveal:n,setReveal:o,feedback:s.feedback})]})},{title:"Cover Letters",rows:c.coverLetters,render:s=>e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"text-sm font-medium",children:[s.job_title," @ ",s.company," ",e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",s.tone,")"]})]}),e.jsx(E,{id:s.id,reveal:n,setReveal:o,content:s.content})]})},{title:"Resumes",rows:c.resumes,render:s=>e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm font-medium",children:s.title??"Resume"}),e.jsx(E,{id:`resume-${s.id}`,reveal:n,setReveal:o,content:s.enhanced_content??s.original_content,label:"Contains PII - click to reveal"})]})},{title:"LinkedIn Optimizations",rows:c.linkedin,render:s=>e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm font-medium",children:s.target_role??"(no role)"}),e.jsx(w,{id:`li-${s.id}`,reveal:n,setReveal:o,label:"LinkedIn rewrite - click to reveal",children:e.jsx(H,{data:s.optimized_profile})})]})},{title:"Interview Prep",rows:c.interviewPrep,render:s=>e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"text-sm font-medium",children:[s.role," ",s.company?`@ ${s.company}`:""," ",typeof s.rating=="number"?`· ${s.rating}/10`:""]}),s.summary?e.jsx("div",{className:"text-xs text-muted-foreground",children:s.summary}):null,e.jsx(w,{id:`prep-${s.id}`,reveal:n,setReveal:o,label:"Prep questions - click to reveal",children:e.jsx(J,{questions:s.questions,strengths:s.strengths,areasToImprove:s.areas_to_improve})})]})},{title:"Mock Interviews",rows:c.mockInterviews,render:s=>e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"text-sm font-medium",children:[s.role??"(untitled)"," ",e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",s.session_type,")"]})]}),e.jsx(w,{id:`mock-${s.id}`,reveal:n,setReveal:o,label:"Transcript - click to reveal",children:e.jsx(T,{messages:s.messages})})]})},{title:"Headshots",rows:c.headshots,render:s=>e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-sm",children:s.style??"(no style)"}),s.expires_at?e.jsxs("div",{className:"text-[10px] text-muted-foreground",children:["Expires ",new Date(s.expires_at).toLocaleString()]}):null,x[s.id]?e.jsx("img",{src:x[s.id],alt:`Headshot ${s.style??""}`,className:"mt-2 rounded max-h-64 border"}):e.jsx("button",{type:"button",className:"text-xs text-blue-600 hover:underline",onClick:async()=>{try{const m=await h({data:{headshotId:s.id,reason:a.trim()||"Admin review"}});u(f=>({...f,[s.id]:m.url}))}catch(m){y.error(m instanceof Error?m.message:"Failed to load image")}},children:"View image - click to reveal (logged)"}),e.jsx("div",{className:"text-[10px] text-muted-foreground break-all",children:s.storage_path})]})},{title:"Salary Negotiations",rows:c.salaryNegotiations,render:s=>e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"text-sm font-medium",children:[s.job_title," ",s.location?`· ${s.location}`:""]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Offer: ",s.offer_amount??" - "," ",s.currency," · Counter: ",s.counter_low??" - ","/",s.counter_target??" - ","/",s.counter_high??" - "]}),e.jsx(w,{id:`sal-${s.id}`,reveal:n,setReveal:o,label:"Negotiation script - click to reveal",children:e.jsx(D,{result:s.result})})]})}]:[];return e.jsxs("div",{className:"max-w-5xl mx-auto p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"User tool history"}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["Support / abuse-review lens over a user's saved tool outputs. Every view is logged to",e.jsx("code",{className:"mx-1 px-1 rounded bg-muted",children:"admin_access_log"}),"with your ID, the target user, and the reason you entered. Only look at content when a user has raised a support request about it."]})]}),e.jsxs(k,{className:"p-4 space-y-3",children:[e.jsxs("ol",{className:"text-xs text-muted-foreground list-decimal list-inside space-y-0.5",children:[e.jsx("li",{children:"Enter the user's email address."}),e.jsx("li",{children:"Enter a reason (min 3 chars) - this is logged for audit."}),e.jsxs("li",{children:["Click ",e.jsx("span",{className:"font-medium",children:"Load user history"}),"."]})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"email",children:"1. User email"}),e.jsx($,{id:"email",type:"email",value:r,onChange:s=>t(s.target.value),placeholder:"[email protected]"})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"reason",children:"2. Reason for viewing (required, logged)"}),e.jsx(C,{id:"reason",value:a,onChange:s=>d(s.target.value),rows:2,placeholder:"e.g. Support ticket #123 - user reports cover letter output was mangled"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(S,{onClick:()=>N.mutate(),disabled:N.isPending,children:N.isPending?"Loading…":"3. Load user history"}),e.jsx(S,{variant:"outline",onClick:()=>g.mutate(),disabled:g.isPending,children:g.isPending?"Loading…":"Recent admin views"})]}),i?e.jsx("div",{className:"text-xs",children:e.jsxs(R,{variant:"secondary",children:["User ID: ",i]})}):null]}),c?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["Showing ",c.user.fullName," 
1(",c.user.email??"no email",") - most recent 15 rows per tool."]}),I.map(s=>e.jsxs(k,{className:"p-4",children:[e.jsxs("div",{className:"flex items-baseline justify-between mb-2",children:[e.jsx("h2",{className:"font-semibold",children:s.title}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[s.rows.length," rows"]})]}),s.rows.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:"No entries."}):e.jsx("ul",{className:"space-y-3",children:s.rows.map(m=>e.jsxs("li",{className:"border-t pt-2 first:border-t-0 first:pt-0",children:[e.jsx("div",{className:"text-[10px] text-muted-foreground mb-1",children:new Date(m.created_at??m.updated_at).toLocaleString()}),s.render(m)]},m.id))})]},s.title))]}):null,g.data?e.jsxs(k,{className:"p-4",children:[e.jsx("h2",{className:"font-semibold mb-2",children:"Recent admin access log"}),e.jsx("ul",{className:"space-y-2 text-sm",children:g.data.entries.map(s=>e.jsxs("li",{className:"border-t pt-2 first:border-t-0 first:pt-0",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:new Date(s.created_at).toLocaleString()}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:s.admin_email??s.admin_id})," viewed ",e.jsx("span",{className:"font-medium",children:s.viewed_user_email??s.viewed_user_id})," · ",s.resource]}),s.reason?e.jsxs("div",{className:"text-xs text-muted-foreground italic",children:['"',s.reason,'"']}):null]},s.id))})]}):null]})}function w({id:r,reveal:t,setReveal:i,label:l,children:a}){return t[r]?e.jsx("div",{className:"mt-2 bg-muted/40 p-3 rounded space-y-3",children:a}):e.jsx("button",{type:"button",onClick:()=>i({...t,[r]:!0}),className:"text-xs text-blue-600 hover:underline",children:l})}function H({data:r}){if(!r||typeof r!="object")return e.jsx("p",{className:"text-xs text-muted-foreground",children:"(empty)"});const t=r;return e.jsxs("div",{className:"text-xs space-y-3",children:[t.headline?e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold",children:"Headline"}),e.jsx("div",{children:t.headline})]}):null,t.headlines?.length?e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold",children:"Headline options"}),e.jsx("ul",{className:"list-disc list-inside",children:t.headlines.map((i,l)=>e.jsx("li",{children:i},l))})]}):null,t.about?e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold",children:"About"}),e.jsx("p",{className:"whitespace-pre-wrap",children:t.about})]}):null,t.skills?.length?e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold mb-1",children:"Skills"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:t.skills.map((i,l)=>e.jsx("span",{className:"px-1.5 py-0.5 rounded bg-blue-100 text-blue-800 dark:bg-blue-900/40 dark:text-blue-300",children:i},l))})]}):null,t.keywords?.length?e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold mb-1",children:"Keywords"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:t.keywords.map((i,l)=>e.jsx("span",{className:"px-1.5 py-0.5 rounded bg-muted",children:i},l))})]}):null,Array.isArray(t.experience_tips)&&t.experience_tips.length?e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold",children:"Experience tips"}),e.jsx("ul",{className:"list-disc list-inside space-y-1",children:t.experience_tips.map((i,l)=>typeof i=="string"?e.jsx("li",{children:i},l):e.jsxs("li",{children:[e.jsxs("span",{className:"font-medium",children:[i.role??"",i.company?` @ ${i.company}`:""]}),i.suggestions?.length?e.jsx("ul",{className:"list-[circle] list-inside ml-4",children:i.suggestions.map((a,d)=>e.jsx("li",{children:a},d))}):null]},l))})]}):null]})}function J({questions:r,strengths:t,areasToImprove:i}){const l=Array.isArray(r)?r:[],a=Array.isArray(t)?t:[],d=Array.isArray(i)?i:[];return e.jsxs("div",{className:"text-xs space-y-3",children:[a.length?e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-green-700 dark:text-green-400",children:"Strengths"}),e.jsx("ul",{className:"list-disc list-inside",children:a.map((n,o)=>e.jsx("li",{children:n},o))})]}):null,d.length?e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold text-red-700 dark:text-red-400",children:"Areas to improve"}),e.jsx("ul",{className:"list-disc list-inside",children:d.map((n,o)=>e.jsx("li",{children:n},o))})]}):null,l.length?e.jsxs("div",{children:[e.jsxs("div",{className:"font-semibold mb-1",children:["Questions (",l.length,")"]}),e.jsx("ol",{className:"list-decimal list-inside space-y-2",children:l.map((n,o)=>e.jsxs("li",{children:[e.jsx("div",{className:"font-medium",children:n.question}),n.answer?e.jsxs("div",{className:"mt-1 whitespace-pre-wrap",children:[e.jsx("span",{className:"text-muted-foreground",children:"Answer: "}),n.answer]}):null,n.feedback?e.jsx("div",{className:"mt-1 text-muted-foreground italic",children:n.feedback}):null]},o))})]}):null]})}function T({messages:r}){if(!Array.isArray(r)||!r.length)return e.jsx("p",{className:"text-xs text-muted-foreground",children:"(no messages)"});const t=r;return e.jsx("div",{className:"text-xs space-y-2 max-h-96 overflow-auto",children:t.map((i,l)=>e.jsxs("div",{className:`p-2 rounded ${i.role==="assistant"?"bg-blue-50 dark:bg-blue-950/30":"bg-muted"}`,children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase text-muted-foreground",children:i.role}),e.jsx("div",{className:"whitespace-pre-wrap",children:i.content})]},l))})}function D({result:r}){if(!r||typeof r!="object")return e.jsx("p",{className:"text-xs text-muted-foreground",children:"(empty)"});const t=r;return e.jsxs("div",{className:"text-xs space-y-3",children:[t.script?e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold",children:"Script"}),e.jsx("p",{className:"whitespace-pre-wrap",children:t.script})]}):null,t.email?e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold",children:"Email"}),e.jsx("p",{className:"whitespace-pre-wrap",children:t.email})]}):null,Array.isArray(t.talking_points)&&t.talking_points.length?e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold",children:"Talking points"}),e.jsx("ul",{className:"list-disc list-inside",children:t.talking_points.map((i,l)=>e.jsx("li",{children:i},l))})]}):null,t.rationale?e.jsxs("div",{children:[e.jsx("div",{className:"font-semibold",children:"Rationale"}),e.jsx("p",{className:"whitespace-pre-wrap",children:t.rationale})]}):null,e.jsxs("details",{children:[e.jsx("summary",{className:"cursor-pointer text-muted-foreground",children:"Raw JSON"}),e.jsx("pre",{className:"mt-1 whitespace-pre-wrap max-h-64 overflow-auto",children:JSON.stringify(r,null,2)})]})]})}function E({id:r,reveal:t,setReveal:i,content:l,label:a="Click to reveal"}){if(l==null)return e.jsx("p",{className:"text-xs text-muted-foreground",children:"(empty)"});const d=typeof l=="string"?l:JSON.stringify(l,null,2);return!d||d==="{}"||d==="[]"||d==="null"?e.jsx("p",{className:"text-xs text-muted-foreground",children:"(empty)"}):t[r]?e.jsx("pre",{className:"mt-1 text-xs whitespace-pre-wrap bg-muted/40 p-2 rounded max-h-64 overflow-auto",children:d}):e.jsxs("button",{type:"button",onClick:()=>i({...t,[r]:!0}),className:"text-xs text-blue-600 hover:underline",children:[a," (",d.length," chars)"]})}function V({id:r,reveal:t,setReveal:i,feedback:l}){if(!l||typeof l!="object")return e.jsx("p",{className:"text-xs text-muted-foreground",children:"(no feedback)"});const a=l;if(!t[r])return e.jsx("button",{type:"button",onClick:()=>i({...t,[r]:!0}),className:"text-xs text-blue-600 hover:underline",children:"Feedback - click to reveal"});const d=({title:o,items:x,tone:u})=>
1{if(!x?.length)return null;const h=u==="good"?"text-green-700 dark:text-green-400":u==="bad"?"text-red-700 dark:text-red-400":"text-blue-700 dark:text-blue-400";return e.jsxs("div",{children:[e.jsx("div",{className:`text-xs font-semibold ${h}`,children:o}),e.jsx("ul",{className:"list-disc list-inside text-xs space-y-0.5 mt-1",children:x.map((p,j)=>e.jsx("li",{children:p},j))})]})},n=({title:o,items:x,tone:u})=>{if(!x?.length)return null;const h=u==="good"?"bg-green-100 text-green-800 dark:bg-green-900/40 dark:text-green-300":"bg-red-100 text-red-800 dark:bg-red-900/40 dark:text-red-300";return e.jsxs("div",{children:[e.jsxs("div",{className:"text-xs font-semibold mb-1",children:[o," (",x.length,")"]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:x.map((p,j)=>e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded ${h}`,children:p},j))})]})};return e.jsxs("div",{className:"mt-2 space-y-3 bg-muted/40 p-3 rounded",children:[typeof a.score=="number"?e.jsxs("div",{className:"text-xs",children:["Overall score: ",e.jsx("span",{className:"font-semibold",children:a.score})]}):null,e.jsx(d,{title:"Strengths",items:a.strengths,tone:"good"}),e.jsx(d,{title:"Weaknesses",items:a.weaknesses,tone:"bad"}),e.jsx(d,{title:"Suggestions",items:a.suggestions,tone:"info"}),e.jsx(n,{title:"Matched keywords",items:a.matched_keywords,tone:"good"}),e.jsx(n,{title:"Missing keywords",items:a.missing_keywords,tone:"bad"}),a.sub_scores?e.jsxs("details",{className:"text-xs",children:[e.jsx("summary",{className:"cursor-pointer text-muted-foreground",children:"Sub-scores & raw JSON"}),e.jsx("pre",{className:"mt-1 whitespace-pre-wrap max-h-64 overflow-auto",children:JSON.stringify(l,null,2)})]}):null]})}export{G 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.