PageSourceSearch

https://pipoly.app/assets/QualificationReview-BKCFxgh_.js

js pipoly.app collected 2026-09-24 14:32:53 UTC 9,800 bytes, 1 lines download raw bytes

1import{j as e}from"./ui-vendor-7ksmbWQe.js";import{i as Y,r as n}from"./react-vendor-LSUMIZ7H.js";import{l as Z,j as r,P as ee,D as se,C as o,e as m,f as ie,B as f,x as ae,aj as te,y as ne,z as le,A as re,ae as ce}from"./index-BbjaYi6k.js";import{B as u}from"./badge-Bmsjjq4U.js";import{T as de,a as oe,b as N,c as y}from"./tabs-4iXEHpOk.js";import{S as me,a as ue,b as xe,c as fe,d as B}from"./select-xPg_jz0B.js";import{D as b}from"./DisplayIdLink-BAkz2tQ7.js";import{u as pe}from"./i18n-vendor-Cq4PMOpV.js";import{U as he}from"./users-DtxaQxId.js";import{C as R}from"./circle-check-big-BU2VkEa7.js";import{C as A}from"./circle-x-B6KHRi7p.js";import{H as I}from"./heart-B7z_fJzT.js";import{P as je}from"./plus-D08-NIzm.js";import{S as ge}from"./star-CuJD8JJC.js";import"./VerifiedBadge-TgSpUZsv.js";import"./pipolyMonogram-BF6B0_Vg.js";function Be(){const{t:i}=pe(),{id:p}=Y(),[c,P]=n.useState(null),[L,z]=n.useState([]),[x,U]=n.useState([]),[$,H]=n.useState([]),[O,E]=n.useState(!0),[S,q]=n.useState(null),[v,J]=n.useState({payable:0,pending:0,employer:0}),[h,C]=n.useState(""),[d,V]=n.useState(""),[T,_]=n.useState(!1),[M,D]=n.useState(!1),{toast:l}=Z();n.useEffect(()=>{w()},[p]);const w=async()=>{try{const[s,a,t,g,W]=await Promise.all([r.getQualification(p),r.getQualificationResponses(p),r.getQualifiedUsers(p),r.getProfile(),r.getFavoriteLists()]);P(s),z(a||[]),U(t||[]),H(W||[]),g&&J({payable:g.payable_balance,pending:g.pending_balance,employer:g.employer_balance||0})}catch(s){l({title:i("common.error"),description:s.message,variant:"destructive"})}finally{E(!1)}},Q=async(s,a)=>{q(s);try{await r.reviewQualificationResponse(s,a),l({title:i("common.success"),description:`Response ${a}d`}),w()}catch(t){l({title:i("common.error"),description:t.message,variant:"destructive"})}finally{q(null)}},X=async()=>{if(h.trim())try{await r.createFavoriteList(h.trim()),l({title:i("common.success"),description:i("qualificationReview.listCreated")}),C(""),D(!1),w()}catch(s){l({title:i("common.error"),description:s.message,variant:"destructive"})}},G=async()=>{if(d){_(!0);try{const s=await r.addQualifiedToFavoriteList(d,p);l({title:i("common.success"),description:i("qualificationReview.addedToList",{count:s.added})})}catch(s){l({title:i("common.error"),description:s.message,variant:"destructive"})}finally{_(!1)}}},K=async s=>{if(!d){l({title:i("qualificationReview.selectList"),description:i("qualificationReview.selectListFirst"),variant:"destructive"});return}try{await r.addFavoriteListMember(d,s),l({title:i("common.success"),description:i("qualificationReview.addedSingle",{id:s})})}catch(a){l({title:i("common.error"),description:a.message,variant:"destructive"})}};if(O)return e.jsx("div",{className:"min-h-screen bg-background pb-20 md:pb-6 flex items-center justify-center",children:e.jsx(ee,{size:48,speed:1.6})});if(!c)return null;const k=typeof c.questions=="string"?JSON.parse(c.questions):c.questions,j=L.filter(s=>s.status==="pending"),F=L.filter(s=>s.status!=="pending");return e.jsxs("div",{className:"min-h-screen bg-background pb-20 md:pb-6",children:[e.jsx(se,{payableBalance:v.payable,pendingBalance:v.pending,employerBalance:v.employer}),e.jsxs("main",{className:"container mx-auto px-4 pt-24 md:pt-6 pb-8 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:c.title}),e.jsx("p",{className:"text-muted-foreground",children:c.description}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsxs(u,{variant:"outline",children:[e.jsx(he,{className:"h-3 w-3 mr-1"}),c.claimed,"/",c.max_claims," ",i("qualificationReview.responses")]}),e.jsx(u,{className:"bg-green-100 text-green-700 border-green-300",children:i("qualificationReview.qualifiedCount",{count:x.length})})]})]}),e.jsxs(de,{defaultValue:"pending",children:[e.jsxs(oe,{className:"grid w-full grid-cols-3",children:[e.jsxs(N,{value:"pending",children:[i("qualificationReview.pendingTab"),j.length>0&&e.jsx(u,{variant:"secondary",className:"ml-1",children:j.length})]}),e.jsx(N,{value:"reviewed",children:i("qualificationReview.reviewedTab")}
1),e.jsxs(N,{value:"qualified",children:[i("qualificationReview.qualifiedTab"),e.jsx(u,{variant:"secondary",className:"ml-1",children:x.length})]})]}),e.jsx(y,{value:"pending",className:"space-y-4 mt-4",children:j.length===0?e.jsx(o,{children:e.jsx(m,{className:"py-8 text-center text-muted-foreground",children:i("qualificationReview.noPending")})}):j.map(s=>e.jsx(o,{children:e.jsxs(m,{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold",children:e.jsx(b,{displayId:s.display_id,children:s.name||s.display_id})}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.country," • ",new Date(s.submitted_at).toLocaleDateString()]})]}),e.jsxs(u,{variant:"outline",children:[e.jsx(ie,{className:"h-3 w-3 mr-1"})," ",i("statistics.pending")]})]}),e.jsx("div",{className:"space-y-2 text-sm",children:k.map(a=>{const t=typeof s.answers=="string"?JSON.parse(s.answers):s.answers;return e.jsxs("div",{className:"p-2 bg-muted/50 rounded",children:[e.jsx("p",{className:"font-medium text-xs text-muted-foreground",children:a.question}),a.type==="social_media"?e.jsxs("p",{children:["@",t[`${a.id}_username`]," • ",t[`${a.id}_followers`]," ",i("qualificationReview.followers")]}):e.jsx("p",{children:t[a.id]||"—"})]},a.id)})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(f,{size:"sm",className:"flex-1",disabled:S===s.id,onClick:()=>Q(s.id,"approve"),children:[e.jsx(R,{className:"h-4 w-4 mr-1"})," ",i("qualificationReview.approve")]}),e.jsxs(f,{size:"sm",variant:"destructive",className:"flex-1",disabled:S===s.id,onClick:()=>Q(s.id,"reject"),children:[e.jsx(A,{className:"h-4 w-4 mr-1"})," ",i("qualificationReview.reject")]})]})]})},s.id))}),e.jsx(y,{value:"reviewed",className:"space-y-4 mt-4",children:F.length===0?e.jsx(o,{children:e.jsx(m,{className:"py-8 text-center text-muted-foreground",children:i("qualificationReview.noReviewed")})}):F.map(s=>{const a=typeof s.answers=="string"?JSON.parse(s.answers):s.answers;return e.jsx(o,{children:e.jsxs(m,{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold",children:e.jsx(b,{displayId:s.display_id,children:s.name||s.display_id})}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.country," • ",new Date(s.submitted_at).toLocaleDateString()]})]}),e.jsx(u,{variant:s.status==="approved"?"default":"destructive",children:s.status==="approved"?e.jsxs(e.Fragment,{children:[e.jsx(R,{className:"h-3 w-3 mr-1"})," ",i("qualificationReview.approved")]}):e.jsxs(e.Fragment,{children:[e.jsx(A,{className:"h-3 w-3 mr-1"})," ",i("qualificationReview.rejected")]})})]}),e.jsx("div",{className:"space-y-2 text-sm",children:k.map(t=>e.jsxs("div",{className:"p-2 bg-muted/50 rounded",children:[e.jsx("p",{className:"font-medium text-xs text-muted-foreground",children:t.question}),t.type==="social_media"?e.jsxs("p",{children:["@",a[`${t.id}_username`]," • ",a[`${t.id}_followers`]," ",i("qualificationReview.followers")]}):t.type==="image"?a[t.id]?e.jsx("img",{src:a[t.id],alt:"Submitted proof",className:"mt-1 max-h-40 rounded border object-contain"}):e.jsx("p",{className:"text-muted-foreground",children:"—"}):e.jsx("p",{children:a[t.id]||"—"})]},t.id))})]})},s.id)})}),e.jsxs(y,{value:"qualified",className:"space-y-4 mt-4",children:[x.length>0&&e.jsx(o,{children:e.jsxs(m,{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(I,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"text-sm font-semibold",children:i("qualificationReview.addToFavoriteList")})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(me,{value:d||"select",onValueChange:s=>V(s==="select"?"":s),children:[e.jsx(ue,{className:"flex-1",children:e.jsx(xe,{placeholder:i("qualificationReview.selectList")})}),e.jsxs(fe,{children:[e.jsx(B,{value:"select",children:i("qualificationReview.selectList")}),$.map(s=>
1e.jsxs(B,{value:s.id,children:[s.name," (",s.member_count,")"]},s.id))]})]}),e.jsxs(ae,{open:M,onOpenChange:D,children:[e.jsx(te,{asChild:!0,children:e.jsx(f,{variant:"outline",size:"icon",children:e.jsx(je,{className:"h-4 w-4"})})}),e.jsxs(ne,{children:[e.jsx(le,{children:e.jsx(re,{children:i("qualificationReview.createFavoriteList")})}),e.jsx(ce,{placeholder:i("qualificationReview.listName"),value:h,onChange:s=>C(s.target.value)}),e.jsx(f,{onClick:X,disabled:!h.trim(),children:i("qualificationReview.create")})]})]})]}),d&&e.jsxs(f,{size:"sm",className:"w-full",onClick:G,disabled:T,children:[e.jsx(ge,{className:"h-4 w-4 mr-1"}),T?i("qualificationReview.adding"):i("qualificationReview.addAllQualified",{count:x.length})]})]})}),x.length===0?e.jsx(o,{children:e.jsx(m,{className:"py-8 text-center text-muted-foreground",children:i("qualificationReview.noQualified")})}):x.map(s=>e.jsx(o,{children:e.jsx(m,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold",children:e.jsx(b,{displayId:s.display_id,children:s.name||s.display_id})}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.country," • Qualified ",new Date(s.qualified_at).toLocaleDateString()]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[d&&e.jsx(f,{variant:"ghost",size:"sm",onClick:()=>K(s.display_id),children:e.jsx(I,{className:"h-3 w-3"})}),e.jsxs(u,{className:"bg-green-100 text-green-700 border-green-300",children:[e.jsx(R,{className:"h-3 w-3 mr-1"})," ",i("qualificationDetail.qualified")]})]})]})})},s.id))]})]})]})]})}export{Be 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.