HR-ATS-Portal/frontend/dist/assets/Inbox-DHkr4tpw.js

8 lines
22 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import{d as je,u as ee,e as J,a as I,s as Y,g as X,r as b,j as e,I as m,E as S,h as _,A as F,B as k,c as ge,S as be,i as fe,l as Q,q as C,n as ve,o as ye,f as Ne,p as L,t as Se,T as se,v as q,w as ae,x as te,y as W,z as G,C as ke,D as Ce,F as Ae,G as Ee,H as Re}from"./index-BTPmxtwM.js";import{u as ne}from"./useMutation-CMO99S-s.js";import{M as K}from"./Modal-B8aWFZt2.js";import{T as Pe}from"./Tabs-DVZeUemd.js";const Te=["All Applications","Unread","Imported","Processed","Rejected","Duplicates","Email"],Ie={Unread:{isread:!1},Processed:{applicationStatus:"PROCESS"},Rejected:{applicationStatus:"REJECTED"}},we=new Date("2026-07-09T20:00"),z=70;function E(a){if(!a)return null;const l=new Date(a);return Number.isNaN(l.getTime())?null:l}function ie(a){const l=(a||"").trim();if(!l)return{source:"Unknown",sourceMeta:null};const n=l.toLowerCase().replace(/[^a-z]/g,""),t=Ee.find(o=>n.includes(o.toLowerCase().replace(/[^a-z]/g,"")));return t?{source:t,sourceMeta:Re[t]}:{source:l.split(",")[0].trim(),sourceMeta:null}}function le({item:a}){var l;return e.jsxs("span",{className:"source-chip",style:{"--chip":(l=a.sourceMeta)==null?void 0:l.color},children:[e.jsx("span",{className:"source-dot"}),a.source]})}function Me(a){var o;const l=(a||"").trim();if(!l)return"";if(!/<[a-z!/]/i.test(l))return l;const n=l.replace(/<br\s*\/?>/gi,`
`).replace(/<\/(p|div|li|tr|h[1-6]|blockquote|table)\s*>/gi,`
`),t=new DOMParser().parseFromString(n,"text/html");return t.querySelectorAll("script, style, head").forEach(h=>h.remove()),(((o=t.body)==null?void 0:o.textContent)||"").replace(/[ \t]+\n/g,`
`).replace(/\n{3,}/g,`
`).trim()}const _e={processing:"Parsing",matched:"Parsed",no_text:"Failed",failed:"Failed",dlq:"Failed",skipped:"Pending"};async function De(a){const l=await Ae(a),n=l==null?void 0:l.data;if(!n)return null;const t=n.sender_name||n.fromEmail||"Unknown";return{id:String(n.id),name:t,initials:G(t),color:W(t),email:n.fromEmail||"",position:n.subject||"(no subject)",...ie(n.message_to),received:E(n.when)??E(n.message_sent_time),unread:!!n.unread,processing:n.unread?"Unread":"Read",resumeStatus:_e[n.match_status]??"Pending",attachment:n.attachment_name,hasAttachment:!!n.attachment,body:Me(n.body),cc:n.message_cc||"",bcc:n.message_bcc||"",sentAt:E(n.message_sent_time),files:Array.isArray(n.files)?n.files:[],matchStatus:n.match_status||null,matchSummary:n.match_summary||"",matchReasoning:n.match_reasoning||"",matchError:n.match_error||"",matchedAt:E(n.matched_at)}}async function Z(a){const l=await Ce(a);return(Array.isArray(l==null?void 0:l.data)?l.data:[]).map(t=>{const o=t.name||t.email||"Unknown";return{id:String(t.id),name:o,initials:G(o),color:W(o),email:t.email||"",position:t.position||"(no subject)",...ie(t.source),received:E(t.received),unread:!!t.unread,processing:t.processing||"Unread",applicationStatus:t.application_status||null,resumeStatus:t.resume_status||"Pending",attachment:t.attachment,hasAttachment:!!t.has_attachment,resumeText:t.resume_text||"",atsScore:t.ats_score,phone:t.phone,experience:t.experience,recruiter:t.recruiter,duplicate:!!t.duplicate}})}function ce(a){const l=J();return ne({mutationFn:n=>ve(n),onMutate:async n=>{await l.cancelQueries({queryKey:C.mailbox.all()});const t=l.getQueriesData({queryKey:C.mailbox.all()});return l.setQueriesData({queryKey:C.mailbox.all()},o=>Array.isArray(o)?o.map(h=>h.id===n?{...h,unread:!1,processing:h.processing==="Unread"?"Read":h.processing}:h):o),{previous:t}},onError:(n,t,o)=>{for(const[h,d]of(o==null?void 0:o.previous)??[])l.setQueryData(h,d);a(_(n,"Could not mark as read."),"error")},onSettled:()=>l.invalidateQueries({queryKey:C.mailbox.all()})})}function Qe(){const{toast:a}=je(),l=ee();J();const{data:n=[]}=I(Y("jobs")),{data:t=[]}=I(Y("recruiters")),o=X("inbox"),h=X("candidates"),[d,x]=b.useState("All Applications"),[y,j]=b.useState(null),[u,N]=b.useState(""),[f,g]=b.useState(null),[P,T]=b.useState(null),[D,r]=b.useState(null),p=Ie[d]??{},v=I({queryKey:C.mailbox.applications(p),queryFn:()=>Z(p),enabled:d!=="Email"}),re=I({queryKey:C.mailbox.applications({}),queryFn:()=>Z({}),enabled:d!=="Email"}),B=v.data??[],R=re.data??[],$=I({queryKey:C.mailbox.messages(),queryFn:async()=>{const s=await ke();return(Array.isArray(s==null?void 0:s.data)?s.data:[]).map(i=>({id:String(i.id),from:i.sender_name||i.fromEmail||"Unknown",fromEmail:i.fromEmail||"",subject:i.subject||"",body:i.body||"",when:E(i.when)??E(i.message_sent_time),unread:!!i.unread,attachment:i.attachment_name||"Resume.pdf",attachmentSize:"—",matchStatus:i.match_status||null,matchSummary:i.match_summary||"",matchReasoning:i.match_reasoning||"",matchError:i.match_error||"",matchedAt:E(i.matched_at),imported:!1}))},enabled:d==="Email"}),oe=b.useMemo(()=>({"All Applications":R.length,Unread:R.filter(s=>s.processing==="Unread").length,Imported:R.filter(s=>s.processing==="Imported").length,Processed:R.filter(s=>s.applicationStatus==="PROCESS").length,Rejected:R.filter(s=>s.applicationStatus==="REJECTED").length,Duplicates:R.filter(s=>s.duplicate).length,Email:($.data??[]).filter(s=>s.unread).length}),[R,$.data]),H=b.useMemo(()=>{let s=B;return d==="Unread"?s=s.filter(c=>c.processing==="Unread"):d==="Imported"?s=s.filter(c=>c.processing==="Imported"):d==="Processed"?s=s.filter(c=>c.applicationStatus==="PROCESS"):d==="Rejected"?s=s.filter(c=>c.applicationStatus==="REJECTED"):d==="Duplicates"&&(s=s.filter(c=>c.duplicate)),u&&(s=s.filter(c=>(c.name+c.position+c.source).toLowerCase().includes(u.toLowerCase()))),s},[B,d,u]),w=I({queryKey:C.mailbox.message(y),queryFn:()=>De(y),enabled:d!=="Email"&&!!y}),V=B.find(s=>s.id===y),A=V||w.data?{...V,...w.data??{}}:null,de=ce(a);function me(s){j(s);const c=B.find(i=>i.id===s);c!=null&&c.unread&&de.mutate(s)}function ue(s,c,i){return{id:`CAN-${5001+i.length}`,name:s.name,initials:s.initials,color:s.color,email:s.email,phone:s.phone,jobId:c.id,jobTitle:c.title,department:c.department,experience:s.experience,currentCompany:q(te),currentTitle:c.title,location:q(ae),stage:"Applied",status:"Applied",aiScore:s.atsScore,source:s.source,recruiter:s.recruiter,recruiterId:"",applied:new Date(se),education:"Bachelor's Degree",skills:c.skills.slice(0,4),rating:"4.0",salary:Q(90,180)*1e3,matchedSkills:c.skills.slice(0,3),missingSkills:c.skills.slice(3),recommendation:s.atsScore>=82?"Strong Match":"Potential Match",subScores:{skills:s.atsScore,experience:s.atsScore,education:80,keywords:s.atsScore,location:100,salary:90},noticePeriod:"1 month",availability:"2 weeks",certifications:[],favorite:!1,interviewStatus:"Not Scheduled"}}function U(s){const c=fe(s.jobId)||n[0];h(i=>[ue(s,c,i),...i]),o(i=>i.map(O=>O.id===s.id?{...O,processing:"Imported",unread:!1}:O)),a(`${s.name} imported → Applied stage of ${c.title}`,"success")}function he(s){o(c=>c.map(i=>i.id===s.id?{...i,resumeStatus:"Parsing"}:i)),a("Parsing resume with AI…","info"),setTimeout(()=>{o(c=>c.map(i=>i.id===s.id?{...i,resumeStatus:"Parsed",atsScore:Q(60,96)}:i)),a("Resume parsed — profile fields extracted","success")},1100)}function pe(s){s.processing!=="Imported"&&s.processing!=="Processed"&&U(s),o(c=>c.map(i=>i.id===s.id?{...i,processing:"Processed"}:i)),a(`${s.name} moved to pipeline`,"success"),setTimeout(()=>l("/pipeline"),700)}function xe(s){o(c=>c.map(i=>i.id===s.id?{...i,processing:"Rejected",unread:!1}:i)),a(`${s.name} rejected`,"warning")}return e.jsxs("div",{className:"page",children:[e.jsxs("div",{className:"page-head",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"page-title",children:"Recruitment Inbox"}),e.jsx("p",{className:"page-sub",children:"Every candidate, every source — one unified queue"})]}),e.jsxs("div",{className:"page-head-actions",children:[e.jsxs("span",{className:"integration-status",children:[e.jsx("span",{className:"pulse"}),"Microsoft Graph API · Connected"]}),e.jsxs("button",{className:"btn btn-secondary",onClick:()=>{a("Syncing all sources…","info"),setTimeout(()=>a("Inbox synced","success"),900)},children:[e.jsx(m,{name:"refresh"})," Sync"]}),e.jsxs("button",{className:"btn btn-primary",onClick:()=>l("/import"),children:[e.jsx(m,{name:"upload"})," Upload CVs"]})]})]}),e.jsxs("div",{className:"card",children:[e.jsx("div",{style:{margin:"0 16px",paddingTop:8},children:e.jsx(Pe,{value:d,onChange:s=>{x(s),j(null)},tabs:Te.map(s=>({key:s,label:s,count:oe[s]}))})}),d==="Email"?e.jsx(qe,{query:$,jobs:n,updateCandidates:h,toast:a}):e.jsxs("div",{className:"split",children:[e.jsxs("div",{className:"split-list",children:[e.jsx("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--border)"},children:e.jsxs("div",{className:"toolbar-search",style:{maxWidth:"none"},children:[e.jsx(m,{name:"search"}),e.jsx("input",{value:u,onChange:s=>N(s.target.value),placeholder:"Search applications…"})]})}),e.jsxs("div",{children:[v.isPending&&e.jsx(S,{icon:"inbox",title:"Loading…",children:"Fetching applications from the server."}),v.isError&&e.jsx(S,{icon:"inbox",title:"Couldnt load applications",children:_(v.error,"Request failed")}),v.isSuccess&&H.length===0?e.jsx(S,{icon:"inbox",title:"Nothing here",children:"No applications in this view."}):H.map(s=>e.jsxs("div",{className:`inbox-item${s.unread?" unread":""}${y===s.id?" active":""}`,onClick:()=>me(s.id),children:[e.jsx(F,{name:s.name,initials:s.initials,color:s.color}),e.jsxs("div",{className:"ii-main",children:[e.jsxs("div",{className:"ii-name",children:[s.name," ",s.duplicate&&e.jsx("span",{className:"badge b-red badge-plain",style:{padding:"1px 6px",fontSize:10},children:"DUP"})]}),e.jsx("div",{className:"ii-pos",children:s.position}),e.jsxs("div",{className:"ii-meta",children:[e.jsx(le,{item:s})," ",e.jsx(k,{children:s.processing}),s.applicationStatus&&s.applicationStatus!=="CLOSED"&&e.jsx(k,{children:s.applicationStatus})]})]}),e.jsxs("div",{style:{textAlign:"right",flexShrink:0},children:[e.jsx("div",{className:"ii-time",children:s.received?ge(Math.round((we-s.received)/6e4)):"—"}),s.atsScore!=null&&e.jsx("div",{style:{marginTop:6},children:e.jsx(be,{score:s.atsScore})})]})]},s.id))]})]}),e.jsx("div",{className:"split-detail",children:A?w.isError?e.jsx("div",{style:{padding:"100px 20px"},children:e.jsx(S,{icon:"inbox",title:"Couldnt load this application",children:_(w.error,"Request failed")})}):e.jsx(Be,{item:A,loading:w.isPending,onPreview:()=>g(A),onImport:()=>U(A),onParse:()=>he(A),onMove:()=>pe(A),onNote:()=>r(A),onReject:()=>xe(A)}):e.jsx("div",{style:{padding:"100px 20px"},children:e.jsx(S,{icon:"inbox",title:"Select an application",children:"Choose an item from the list to view details and take action."})})})]})]}),f&&e.jsx(K,{title:f.attachment,subtitle:`Resume preview · ${f.name}`,size:"modal-lg",onClose:()=>g(null),footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn btn-secondary",onClick:()=>g(null),children:"Close"}),e.jsxs("button",{className:"btn btn-primary",onClick:()=>{const s=f;g(null),U(s)},disabled:!0,title:"Needs a backend endpoint — not implemented yet",children:[e.jsx(m,{name:"user-plus"})," Import Candidate"]})]}),children:e.jsx("pre",{className:"resume-thumb",style:{maxHeight:"none",fontSize:12},children:f.resumeText||"Resume text not extracted yet — the matching task has not run for this application."})}),P&&e.jsx(Fe,{item:P,recruiters:t,onClose:()=>T(null),onSave:s=>{o(c=>c.map(i=>i.id===P.id?{...i,recruiter:s}:i)),T(null),a(`Recruiter assigned to ${P.name}`,"success")}}),D&&e.jsx(K,{title:"Add Note",subtitle:D.name,onClose:()=>r(null),footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn btn-secondary",onClick:()=>r(null),children:"Cancel"}),e.jsxs("button",{className:"btn btn-primary",onClick:()=>{r(null),a("Note added","success")},children:[e.jsx(m,{name:"check"})," Save Note"]})]}),children:e.jsxs("div",{className:"form-field",children:[e.jsx("label",{children:"Note"}),e.jsx("textarea",{placeholder:"Add a note about this application…"})]})})]})}function M(a,l=""){return a==null||a===""?"—":`${a}${l}`}function Be({item:a,loading:l,onPreview:n,onImport:t,onParse:o,onMove:h,onNote:d,onReject:x}){var f,g;const y=ee(),j=a.atsScore>=82?"Strong Match":a.atsScore>=65?"Potential Match":"Weak Match",u=a.atsScore>=82?"var(--success)":a.atsScore>=65?"var(--warning)":"var(--danger)",N="Needs a backend endpoint — not implemented yet";return e.jsxs("div",{style:{padding:24},children:[e.jsxs("div",{className:"flex items-center gap-16",style:{marginBottom:20},children:[e.jsx(F,{name:a.name,initials:a.initials,color:a.color,className:"avatar-lg"}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{className:"ph-name",style:{fontSize:19},children:a.name}),e.jsx("div",{className:"ph-role",children:a.position}),e.jsxs("div",{className:"ph-tags",style:{marginTop:8},children:[e.jsx(le,{item:a})," ",e.jsx(k,{children:a.processing})," ",a.applicationStatus&&a.applicationStatus!=="CLOSED"&&e.jsxs(e.Fragment,{children:[e.jsx(k,{children:a.applicationStatus})," "]}),e.jsx(k,{className:a.resumeStatus==="Parsed"?"b-green":a.resumeStatus==="Failed"?"b-red":"b-amber",children:a.resumeStatus})," ",l&&e.jsx("span",{className:"cell-sub",children:"Loading details…"})]})]}),a.atsScore!=null&&e.jsxs("div",{style:{textAlign:"center"},children:[e.jsx("div",{className:"ats-ring",style:{width:84,height:84,"--pct":a.atsScore,"--c":u},children:e.jsx("div",{className:"ats-val",children:e.jsx("div",{className:"ats-num",style:{fontSize:22},children:a.atsScore})})}),e.jsx("div",{className:"cell-sub",style:{marginTop:4},children:"ATS Score"})]})]}),e.jsxs("div",{className:"info-grid",style:{marginBottom:20},children:[e.jsxs("div",{className:"info-item",children:[e.jsx("div",{className:"il",children:"Email"}),e.jsx("div",{className:"iv",children:M(a.email)})]}),e.jsxs("div",{className:"info-item",children:[e.jsx("div",{className:"il",children:"Phone"}),e.jsx("div",{className:"iv",children:M(a.phone)})]}),e.jsxs("div",{className:"info-item",children:[e.jsx("div",{className:"il",children:"Experience"}),e.jsx("div",{className:"iv",children:M(a.experience," years")})]}),e.jsxs("div",{className:"info-item",children:[e.jsx("div",{className:"il",children:"Assigned Recruiter"}),e.jsx("div",{className:"iv",children:M(a.recruiter)})]}),e.jsxs("div",{className:"info-item",children:[e.jsx("div",{className:"il",children:"Received"}),e.jsx("div",{className:"iv",children:a.received?L(a.received):"—"})]}),a.sentAt&&e.jsxs("div",{className:"info-item",children:[e.jsx("div",{className:"il",children:"Sent"}),e.jsx("div",{className:"iv",children:L(a.sentAt)})]}),a.cc&&e.jsxs("div",{className:"info-item",children:[e.jsx("div",{className:"il",children:"CC"}),e.jsx("div",{className:"iv",children:a.cc})]}),a.bcc&&e.jsxs("div",{className:"info-item",children:[e.jsx("div",{className:"il",children:"BCC"}),e.jsx("div",{className:"iv",children:a.bcc})]}),a.atsScore!=null&&e.jsxs("div",{className:"info-item",children:[e.jsx("div",{className:"il",children:"Match"}),e.jsx("div",{className:"iv",children:e.jsx(k,{className:Se(j),children:j})})]})]}),!l&&e.jsx("div",{className:"email-preview",style:{marginBottom:20},children:a.body||e.jsx("span",{className:"text-muted",children:"This email has no message body."})}),a.hasAttachment&&e.jsx("div",{className:"card",style:{boxShadow:"none",background:"var(--bg-sunken)",marginBottom:20},children:e.jsxs("div",{className:"card-body",children:[e.jsxs("div",{className:"flex items-center gap-12",style:{justifyContent:"space-between",marginBottom:12},children:[e.jsxs("div",{className:"fw-600",children:[e.jsx(m,{name:"paperclip"})," ",M(a.attachment),((g=(f=a.files)==null?void 0:f[0])==null?void 0:g.size)!=null&&e.jsxs("span",{className:"cell-sub",children:[" · ",Math.round(a.files[0].size/1024)," KB"]})]}),e.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:n,children:[e.jsx(m,{name:"eye"})," Preview"]})]}),e.jsx("pre",{className:"resume-thumb",children:a.resumeText||"Resume text not extracted yet — the matching task has not run for this application."})]})}),e.jsxs("div",{className:"flex gap-8",style:{flexWrap:"wrap"},children:[e.jsxs("button",{className:"btn btn-primary",onClick:t,disabled:!0,title:N,children:[e.jsx(m,{name:"user-plus"})," Import Candidate"]}),e.jsxs("button",{className:"btn btn-secondary",onClick:o,disabled:!0,title:N,children:[e.jsx(m,{name:"sparkles"})," Parse Resume"]}),e.jsxs("button",{className:"btn btn-secondary",onClick:()=>y(`/matching?record=${a.id}`),children:[e.jsx(m,{name:"target"})," Assign Job"]}),e.jsxs("button",{className:"btn btn-secondary",onClick:h,disabled:!0,title:N,children:[e.jsx(m,{name:"layers"})," Move to Pipeline"]}),e.jsxs("button",{className:"btn btn-secondary",onClick:d,disabled:!0,title:N,children:[e.jsx(m,{name:"edit"})," Add Note"]}),e.jsxs("button",{className:"btn btn-ghost",style:{color:"var(--danger)"},onClick:x,disabled:!0,title:N,children:[e.jsx(m,{name:"x"})," Reject"]})]})]})}function Fe({item:a,recruiters:l,onClose:n,onSave:t}){const[o,h]=b.useState(a.recruiter),d=l.find(x=>x.name===a.recruiter);return e.jsxs(K,{title:"Assign Recruiter",subtitle:a.name,onClose:n,footer:e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"btn btn-secondary",onClick:n,children:"Cancel"}),e.jsx("button",{className:"btn btn-primary",onClick:()=>t(o),children:"Assign"})]}),children:[e.jsxs("div",{className:"form-field",children:[e.jsx("label",{children:"Recruiter"}),e.jsx("select",{value:o,onChange:x=>h(x.target.value),children:l.map(x=>e.jsx("option",{children:x.name},x.id))})]}),e.jsxs("p",{className:"text-muted text-sm",style:{marginTop:10},children:["Current workload is factored automatically. This recruiter has ",(d==null?void 0:d.openReqs)??5," open reqs."]})]})}function qe({query:a,jobs:l,updateCandidates:n,toast:t}){const o=J(),[h,d]=b.useState(null),[x,y]=b.useState(()=>new Set),j=a.data??[],u=j.find(r=>r.id===h),N=j.filter(r=>r.unread).length,f=ce(t),g=ne({mutationFn:()=>ye(),onSuccess:async()=>{await o.invalidateQueries({queryKey:C.mailbox.all()}),t("Mailbox synced","success")},onError:r=>t(_(r,"Sync failed"),"error")});function P(r){const p=l[0];p&&(n(v=>[{id:`CAN-${5001+v.length}`,name:r.from,initials:G(r.from),color:W(r.from),email:r.fromEmail,phone:"+1 (555) 000-0000",jobId:p.id,jobTitle:p.title,department:p.department,experience:Q(2,10),currentCompany:q(te),currentTitle:p.title,location:q(ae),stage:"Applied",status:"Applied",aiScore:z,source:"Microsoft Outlook",recruiter:p.recruiter,recruiterId:"",applied:new Date(se),education:"Bachelor's Degree",skills:p.skills.slice(0,4),rating:"4.0",salary:13e4,matchedSkills:p.skills.slice(0,3),missingSkills:p.skills.slice(3),recommendation:"Potential Match",subScores:{skills:z,experience:80,education:80,keywords:z,location:100,salary:90},noticePeriod:"1 month",availability:"2 weeks",certifications:[],favorite:!1,interviewStatus:"Not Scheduled"},...v]),y(v=>new Set(v).add(r.id)),t(`${r.from} imported from Outlook → ${p.title}`,"success"))}const T=r=>x.has(r.id);function D(r){d(r.id),r.unread&&f.mutate(r.id)}return e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{padding:"12px 18px",borderBottom:"1px solid var(--border)",display:"flex",alignItems:"center",gap:12},children:[e.jsxs("span",{className:"integration-status",children:[e.jsx("span",{className:"pulse"}),"Outlook · Microsoft Graph API"]}),e.jsx("span",{className:"text-muted text-sm",children:a.isPending?"Loading…":a.isError?"Sync failed":`${j.length} messages · ${N} unread`}),e.jsxs("button",{className:"btn btn-secondary btn-sm",style:{marginLeft:"auto"},disabled:g.isPending,onClick:()=>{t("Fetching from Outlook…","info"),g.mutate()},children:[e.jsx(m,{name:"refresh"})," ",g.isPending?"Syncing…":"Sync Mailbox"]})]}),e.jsxs("div",{className:"split",children:[e.jsxs("div",{className:"split-list",children:[a.isPending&&e.jsx(S,{icon:"mail",title:"Loading…",children:"Fetching mailbox from the server."}),a.isError&&e.jsx(S,{icon:"mail",title:"Couldnt load mailbox",children:_(a.error,"Request failed")}),a.isSuccess&&j.length===0&&e.jsx(S,{icon:"mail",title:"Nothing here",children:"No emails in the mailbox."}),a.isSuccess&&j.map(r=>e.jsxs("div",{className:`inbox-item${r.unread?" unread":""}${h===r.id?" active":""}`,onClick:()=>D(r),children:[e.jsx(F,{name:r.from}),e.jsxs("div",{className:"ii-main",children:[e.jsx("div",{className:"ii-name",children:r.from}),e.jsx("div",{className:"ii-pos",children:r.subject}),e.jsxs("div",{className:"ii-meta",children:[e.jsxs("span",{className:"source-chip",style:{"--chip":"#0078d4"},children:[e.jsx(m,{name:"mail"}),"Outlook"]}),T(r)&&e.jsx(k,{className:"b-green",children:"Imported"})]})]}),e.jsx("div",{className:"ii-time",children:r.when?Ne(r.when):"—"})]},r.id))]}),e.jsx("div",{className:"split-detail",children:u?e.jsxs("div",{style:{padding:24},children:[e.jsxs("div",{className:"flex items-center gap-12",style:{marginBottom:6},children:[e.jsx("h2",{style:{fontSize:18,flex:1},children:u.subject}),T(u)?e.jsx(k,{className:"b-green",children:"Imported"}):e.jsx(k,{className:"b-blue",children:"New"})]}),e.jsxs("div",{className:"flex items-center gap-12",style:{marginBottom:20},children:[e.jsx(F,{name:u.from}),e.jsxs("div",{children:[e.jsx("div",{className:"fw-600",children:u.from}),e.jsxs("div",{className:"cell-sub",children:[u.fromEmail," · ",u.when?L(u.when):"Date unavailable"]})]})]}),e.jsx("div",{className:"email-preview",style:{marginBottom:18,whiteSpace:"pre-wrap"},children:u.body}),e.jsxs("div",{className:"attach-card",style:{marginBottom:18},children:[e.jsx("span",{className:"attach-icn",children:e.jsx(m,{name:"file"})}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{className:"fw-600",children:u.attachment}),e.jsxs("div",{className:"cell-sub",children:[u.attachmentSize," · PDF"]})]}),e.jsx("div",{className:"flex items-center gap-8",children:e.jsxs("button",{className:"btn btn-secondary btn-sm",onClick:()=>t("Opening attachment preview","info"),children:[e.jsx(m,{name:"eye"})," Preview"]})})]}),e.jsxs("div",{className:"flex gap-8",children:[T(u)?e.jsxs("button",{className:"btn btn-secondary",disabled:!0,children:[e.jsx(m,{name:"check"})," Already Imported"]}):e.jsxs("button",{className:"btn btn-primary",onClick:()=>P(u),children:[e.jsx(m,{name:"user-plus"})," Import Candidate"]}),e.jsxs("button",{className:"btn btn-secondary",onClick:()=>t("Reply drafted","info"),children:[e.jsx(m,{name:"mail"})," Reply"]}),e.jsxs("button",{className:"btn btn-ghost",style:{color:"var(--danger)"},onClick:()=>t("Email archived","info"),children:[e.jsx(m,{name:"trash"})," Archive"]})]})]}):e.jsx("div",{style:{padding:"100px 20px"},children:e.jsx(S,{icon:"mail",title:"Select an email",children:"Preview email body and resume attachments here."})})})]})]})}export{Qe as default};
//# sourceMappingURL=Inbox-DHkr4tpw.js.map