PageSourceSearch

https://prudentialzenith.com/assets/AdminReview-D28PKhfK.js

js prudentialzenith.com collected 2026-10-08 06:47:26 UTC 11,715 bytes, 1 lines download raw bytes

1import{r,j as e}from"./vendor-react-Nof-x1fz.js";import{u as Y}from"./index-COnZ2x0F.js";import{getReviewItems as z,createReviewItem as X,updateReviewItem as Z}from"./admin-DJibAR_k.js";import{R as J}from"./ReviewerNotesModal-DPKoqjmp.js";import{Z as K,R as ee,T as te,L as se,W as re,a8 as ae,V as le,a3 as y,C as B,o as M,a as ne,c as oe}from"./vendor-icons-CWLj2DW1.js";import"./vendor-supabase-DLKM8hy9.js";import"./vendor-Dlv1YlWM.js";import"./vendor-ui-D2kDCIdO.js";import"./vendor-motion-DeVoByvi.js";import"./editorial-images-DK3E68n7.js";import"./editorial-content-DMcTGHPE.js";import"./vendor-forms-FOlkAZd8.js";import"./vendor-carousel-NXspLAZy.js";function ye(){return e.jsx("div",{className:"flex items-center justify-center min-h-[60vh]",children:e.jsx("div",{className:"w-8 h-8 border-4 border-[#ED1B2E] border-t-transparent rounded-full animate-spin"})})}const D={pending:{label:"Pending",color:"bg-amber-100 text-amber-700",icon:e.jsx(oe,{className:"w-3.5 h-3.5"})},in_review:{label:"In Review",color:"bg-blue-100 text-blue-700",icon:e.jsx(ne,{className:"w-3.5 h-3.5"})},approved:{label:"Approved",color:"bg-green-100 text-green-700",icon:e.jsx(B,{className:"w-3.5 h-3.5"})},rejected:{label:"Rejected",color:"bg-red-100 text-red-700",icon:e.jsx(M,{className:"w-3.5 h-3.5"})},changes_requested:{label:"Changes Requested",color:"bg-purple-100 text-purple-700",icon:e.jsx(y,{className:"w-3.5 h-3.5"})}},A={content:{label:"Content",color:"bg-blue-50 text-blue-600"},media:{label:"Media",color:"bg-purple-50 text-purple-600"},event:{label:"Event",color:"bg-green-50 text-green-600"},vendor:{label:"Vendor",color:"bg-amber-50 text-amber-600"}},F={urgent:{label:"Urgent",color:"text-red-600"},high:{label:"High",color:"text-amber-600"},normal:{label:"Normal",color:"text-gray-500"},low:{label:"Low",color:"text-gray-400"}};function Ne(){const{session:c}=Y(),[d,u]=r.useState([]),[_,q]=r.useState(!0),[N,w]=r.useState(""),[g,L]=r.useState("all"),[h,P]=r.useState("all"),[b,$]=r.useState(""),[C,E]=r.useState(!1),[O,R]=r.useState(null),[S,f]=r.useState(!1),[o,x]=r.useState({title:"",type:"content",description:"",priority:"normal"}),[k,I]=r.useState(!1),[m,v]=r.useState({open:!1,action:"approved",itemId:"",itemTitle:""}),p=r.useCallback(async()=>{const t=await z();t.ok?(u(t.data.items),w("")):w(t.error.message),q(!1)},[]);r.useEffect(()=>{c!=null&&c.accessToken&&p()},[c==null?void 0:c.accessToken,p]);const U=r.useCallback(async()=>{E(!0),await p(),E(!1)},[p]),j=(t,s)=>{const a=d.find(i=>i.id===t);v({open:!0,action:s,itemId:t,itemTitle:(a==null?void 0:a.title)||"Untitled"})},V=async t=>{const{itemId:s,action:a}=m,i=await Z(s,{status:a,reviewerNotes:t||void 0});i.ok&&(u(l=>l.map(n=>n.id===s?i.data.item:n)),R(null)),v(l=>({...l,open:!1}))},G=async()=>{if(!o.title.trim())return;I(!0);const t=await X(o);t.ok&&(u(s=>[t.data.item,...s]),f(!1),x({title:"",type:"content",description:"",priority:"normal"})),I(!1)},T=d.filter(t=>!(g!=="all"&&t.status!==g||h!=="all"&&t.type!==h||b&&!t.title.toLowerCase().includes(b.toLowerCase()))),H=d.filter(t=>t.status==="pending").length,Q=d.filter(t=>t.status==="in_review").length,W=t=>{const s=Date.now()-new Date(t).getTime(),a=Math.floor(s/(1e3*60*60));return a<1?"< 1h ago":a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`};return _?e.jsx("div",{className:"flex items-center justify-center min-h-[60vh]",children:e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 border-4 border-[#ED1B2E] border-t-transparent rounded-full animate-spin"}),e.jsx("span",{className:"text-sm text-gray-500",children:"Loading review queue..."})]})}):e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Review Queue"}),e.jsxs("p",{className:"text-gray-500 mt-1",children:[H," pending · ",Q," in review"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>f(!S),className:"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-[#ED1B2E] rounded-lg hover:bg-[#C71530]",children:[e.jsx(K,{className:"w-4 h-4"})," New Item"]}),e.jsxs("button",{onClick:U,disabled:C,className:"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 disabled:opacity-50",children:[e.jsx(ee,{className:`w-4 h-4 ${C?"animate-spin":""}`})," Refresh"]})]})]}),N&&e.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-xl p-4 mb-6 flex items-start gap-3",children:[e.jsx(te,{className:"w-5 h-5 text-red-500 mt-0.5 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-red-900",children:"Failed to load review queue"}),e.jsx("p",{className:"text-sm text-red-700",children:N})]})]}),S&&e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-5 mb-6 space-y-3",children:[e.jsx("h3",{className:"font-semibold text-gray-900",children:"Add Review Item"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:[e.jsx("input",{type:"text",placeholder:"Title",value:o.title,onChange:t=>x(s=>({...s,title:t.target.value})),className:"px-3 py-2 border border-gray-300 rounded-lg text-sm focus:border-[#
1ED1B2E] focus:ring-2 focus:ring-[#ED1B2E]/20 focus:outline-none sm:col-span-3"}),e.jsxs("select",{value:o.type,onChange:t=>x(s=>({...s,type:t.target.value})),className:"px-3 py-2 border border-gray-300 rounded-lg text-sm bg-white",children:[e.jsx("option",{value:"content",children:"Content"}),e.jsx("option",{value:"media",children:"Media"}),e.jsx("option",{value:"event",children:"Event"}),e.jsx("option",{value:"vendor",children:"Vendor"})]}),e.jsxs("select",{value:o.priority,onChange:t=>x(s=>({...s,priority:t.target.value})),className:"px-3 py-2 border border-gray-300 rounded-lg text-sm bg-white",children:[e.jsx("option",{value:"low",children:"Low"}),e.jsx("option",{value:"normal",children:"Normal"}),e.jsx("option",{value:"high",children:"High"}),e.jsx("option",{value:"urgent",children:"Urgent"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:G,disabled:k||!o.title.trim(),className:"px-4 py-2 text-sm font-medium text-white bg-[#ED1B2E] rounded-lg hover:bg-[#C71530] disabled:opacity-50",children:k?e.jsx(se,{className:"w-4 h-4 animate-spin"}):"Create"}),e.jsx("button",{onClick:()=>f(!1),className:"px-4 py-2 text-sm text-gray-600 hover:text-gray-900",children:"Cancel"})]})]}),e.jsx("textarea",{placeholder:"Description (optional)",value:o.description,onChange:t=>x(s=>({...s,description:t.target.value})),className:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:border-[#ED1B2E] focus:ring-2 focus:ring-[#ED1B2E]/20 focus:outline-none resize-none",rows:2})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-4 mb-6 flex flex-wrap gap-3 items-center",children:[e.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[e.jsx(re,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),e.jsx("input",{type:"text",placeholder:"Search by title...",value:b,onChange:t=>$(t.target.value),className:"w-full pl-9 pr-3 py-2 border border-gray-300 rounded-lg text-sm focus:border-[#ED1B2E] focus:ring-2 focus:ring-[#ED1B2E]/20 focus:outline-none"})]}),e.jsxs("select",{value:g,onChange:t=>L(t.target.value),className:"px-3 py-2 border border-gray-300 rounded-lg text-sm bg-white",children:[e.jsx("option",{value:"all",children:"All Statuses"}),e.jsx("option",{value:"pending",children:"Pending"}),e.jsx("option",{value:"in_review",children:"In Review"}),e.jsx("option",{value:"approved",children:"Approved"}),e.jsx("option",{value:"rejected",children:"Rejected"}),e.jsx("option",{value:"changes_requested",children:"Changes Requested"})]}),e.jsxs("select",{value:h,onChange:t=>P(t.target.value),className:"px-3 py-2 border border-gray-300 rounded-lg text-sm bg-white",children:[e.jsx("option",{value:"all",children:"All Types"}),e.jsx("option",{value:"content",children:"Content"}),e.jsx("option",{value:"media",children:"Media"}),e.jsx("option",{value:"event",children:"Event"}),e.jsx("option",{value:"vendor",children:"Vendor"})]})]}),e.jsx("div",{className:"space-y-3",children:T.length===0?e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-12 text-center",children:[e.jsx(ae,{className:"w-12 h-12 text-gray-300 mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-1",children:d.length===0?"No review items yet":"No items match your filters"}),e.jsx("p",{className:"text-sm text-gray-500",children:d.length===0?"Create your first review item using the button above.":"Try adjusting your filters."})]}):T.map(t=>{const s=D[t.status]||D.pending,a=A[t.type]||A.content,i=F[t.priority]||F.normal,l=O===t.id;return e.jsxs("div",{className:`bg-white rounded-xl border transition-all ${l?"border-[#ED1B2E] shadow-md":"border-gray-200 hover:border-gray-300"}`,children:[e.jsx("div",{className:"p-4 cursor-pointer",onClick:()=>R(l?null:t.id),children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-1",children:[e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded text-xs font-medium ${a.color}`,children:a.label}),e.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs font-medium ${s.color}`,children:[s.icon,s.label]}),t.priority!=="normal"&&e.jsx("span",{className:`text-xs font-medium ${i.color}`,children:i.label})]}),e.jsx("h3",{className:"font-semibold text-gray-900 truncate",children:t.title}),e.jsxs("div",{className:"flex items-center gap-3 mt-1 text-xs text-gray-500",children:[e.jsx("span",{children:t.submittedBy}),e.jsx("span",{children:"·"}),e.jsx("span",{children:W(t.submittedAt)})]})]}),e.jsx(le,{className:`w-5 h-5 text-gray-400 transition-transform flex-shrink-0 mt-1 ${l?"rotate-180":""}`})]})}),l&&e.jsxs("div",{className:"border-t border-gray-100 p-4 bg-gray-50/50",children:[t.description&&e.jsx("p",{className:"text-sm text-gray-700 mb-3",children:t.description}),t.reviewerNotes&&e.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-3 mb-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-medium text-amber-700 mb-1",children:[e.jsx(y,{className:"w-3.5 h-3.5"})," Reviewer Notes"]}),e.jsx("p",{className:"text-sm text-amber-800",children:t.reviewerNotes})]}),(t.status==="pending"||t.status==="in_review")&&e.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[e.jsxs("button",{onClick:n=>{n.stopPropagation(),j(t.id,"approved")},className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-white bg-green-600 rounded-lg hover:bg-green-700",children:[e.jsx(B,{className:"w-4 h-4"})," Approve"]}),e.jsxs("button",{onClick:n=>{n.stopPropagation(),j(t.id,"rejected")},className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-white bg-red-600 rounded-lg hover:bg-red-700",children:[e.jsx(M,{className:"w-4 h-4"})," Reject"]}),e.jsxs("button",{onClick:n=>{n.stopPropagation(),j(t.id,"changes_requested")},className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50",children:[e.jsx(y,{className:"w-4 h-4"})," Request Changes"]})]})]})]},t.id)})}),e.jsx(J,{open:m.open,action:m.action,itemTitle:m.itemTitle,onConfirm:V,onClose:()=>v(t=>({...t,open:!1}))})]})}export{Ne as AdminReview,ye as HydrateFallback};

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.