PageSourceSearch

https://qe.finance/assets/CampaignDetail-CHdkqcIC.js

js qe.finance collected 2026-10-09 17:57:14 UTC 16,413 bytes, 1 lines download raw bytes

1import{r as j,j as e}from"./three-vendor-C1XI7YMt.js";import{aW as V,aD as Y,at as F,z as v,G as U,B as x,cE as q,J as w,bf as z,v as G,af as b,K as J,M as W,N as H,cc as I,cF as X,bq as Z,bg as ee,aN as E,x as Q,bc as se,w as ae,bb as A,aM as te,aO as P}from"./index-HWdulj8p.js";import{P as re}from"./PageTransition-ukhzQwEh.js";import{L as ie}from"./LegacyEarnNotice-Dq0a018S.js";import{C as f,d as g}from"./card-CFSH4Cam.js";import{u as ne}from"./useUserRole-Bm1zusjb.js";import{u as oe,a as le,b as ce,c as de,d as me,K as h,i as S,e as xe}from"./KorraReferralCard-BYQjpN0A.js";import{L as ue}from"./lock-BGqaYxsd.js";import{W as pe}from"./wallet-B6MB4EmQ.js";import{C as he}from"./circle-alert-CXEmxoUP.js";import{T as fe,a as ge,b as D,c as _,d as je,e as C}from"./table-D_iMbdSd.js";import{T as Ne}from"./trophy-CwoFJNBp.js";import{f as be}from"./formatDistanceToNow-CbUl9Oy3.js";import"./log-in-B4XXzkrq.js";import"./copy-CFB2oqWl.js";import"./constructNow-z6YUvWDG.js";var ve="Separator",M="horizontal",we=["horizontal","vertical"],K=j.forwardRef((t,r)=>{const{decorative:s,orientation:c=M,...a}=t,o=ye(c)?c:M,u=s?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return e.jsx(V.div,{"data-orientation":o,...u,...a,ref:r})});K.displayName=ve;function ye(t){return we.includes(t)}var B=K;const O=j.forwardRef(({className:t,orientation:r="horizontal",decorative:s=!0,...c},a)=>e.jsx(B,{ref:a,decorative:s,orientation:r,className:Y("shrink-0 bg-border",r==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...c}));O.displayName=B.displayName;function _e(t){return F({queryKey:["campaign_participants",t],enabled:!!t,queryFn:async()=>{const{data:r,error:s}=await v.rpc("get_campaign_participants_public",{_campaign_id:t});if(s)throw s;const c=r||[],a=c.map(d=>d.creator_id);let o={};if(a.length>0){const[{data:d},{data:u}]=await Promise.all([v.from("profiles").select("id, name, avatar_url, creator_tier").in("id",a),v.rpc("get_profiles_private",{_ids:a}
1)]),i=new Map((u||[]).map(l=>[l.id,l.wallet_address]));for(const l of d||[])o[l.id]={...l,wallet_address:i.get(l.id)??null}}return c.map(d=>({...d,profiles:o[d.creator_id]||null}))}})}function Ce(t,r){return F({queryKey:["my_participation",t,r],enabled:!!t&&!!r,queryFn:async()=>{const{data:s,error:c}=await v.rpc("get_my_campaign_participation",{_campaign_id:t});if(c)throw c;return(s||[])[0]||null}})}const ke="https://jup.ag/swap/USDC-DPdNMhjBnftREwT82KXytQBk7zd5RBkRrG41L795pump";function Ee({campaign:t,userId:r}){const s=U(),c=!!t.qe_gate_enabled&&Number(t.min_qe_usd||0)>0,{data:a,isLoading:o,refetch:d}=oe(t.id,c&&!!r),u=le(),[i,l]=j.useState(!1);if(!c)return null;const m=Number(t.min_qe_usd||0),p=async()=>{if(!r){s(q());return}l(!0);try{const n=await u.mutateAsync(t.id);n.eligible?b.success("You're qualified!",{description:`Holding ${(n.currentQe||0).toLocaleString(void 0,{maximumFractionDigits:0})} $QE — locked in.`}):n.reason==="no_wallet"?b.error("Add your wallet first",{description:"Connect a Solana wallet on your profile to verify your $QE balance."}):n.reason==="insufficient_balance"?b.error("Not enough $QE yet",{description:`You hold ~$${(n.currentUsd||0).toFixed(2)} of $QE. Need $${m}.`}):b.error("Couldn't verify balance",{description:"Try again in a moment."}),d()}catch(n){b.error("Verification failed",{description:n.message})}finally{l(!1)}};return e.jsx(f,{className:"border-accent/30 bg-accent/5 mb-6",children:e.jsx(g,{className:"p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-accent/15 flex items-center justify-center shrink-0",children:e.jsx(ue,{className:"w-5 h-5 text-accent"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2 flex-wrap",children:["Token-gated campaign",e.jsxs("span",{className:"text-xs font-normal text-muted-foreground",children:["Requires ",e.jsxs("span",{className:"text-accent font-semibold",children:["$",m]}
1)," of $QE",a!=null&&a.qePriceUsd&&a.requiredQe?e.jsxs(e.Fragment,{children:[" · ~",a.requiredQe.toLocaleString(void 0,{maximumFractionDigits:0})," $QE at current price"]}):null]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Once you qualify, your spot is locked even if the price drops."}),!r&&e.jsx(x,{size:"sm",className:"mt-3",onClick:()=>s(q()),children:"Sign in to check eligibility"}),r&&o&&e.jsxs("div",{className:"flex items-center gap-2 mt-3 text-xs text-muted-foreground",children:[e.jsx(w,{className:"w-3.5 h-3.5 animate-spin"})," Checking your balance…"]}),r&&a&&!o&&e.jsxs("div",{className:"mt-3 space-y-2",children:[a.reason==="no_wallet"&&e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(pe,{className:"w-3.5 h-3.5"}),"No Solana wallet on your profile yet."]}),e.jsx(x,{size:"sm",variant:"outline",onClick:()=>s("/profile"),children:"Add wallet"})]}),a.reason==="insufficient_balance"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx(he,{className:"w-3.5 h-3.5 text-destructive"}),e.jsxs("span",{className:"text-muted-foreground",children:["You hold"," ",e.jsxs("span",{className:"text-foreground font-medium",children:["~$",(a.currentUsd||0).toFixed(2)]})," ","of $QE (",(a.currentQe||0).toLocaleString(void 0,{maximumFractionDigits:0})," tokens)"]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(x,{size:"sm",variant:"outline",className:"gap-1.5",onClick:()=>window.open(ke,"_blank"),children:["Buy $QE on Jupiter",e.jsx(z,{className:"w-3 h-3"})]}),e.jsxs(x,{size:"sm",variant:"ghost",onClick:p,disabled:i,children:[i&&e.jsx(w,{className:"w-3.5 h-3.5 animate-spin mr-1.5"}),"Re-check"]})]})]}),a.reason==="ok"&&e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx(G,{className:"w-3.5 h-3.5 text-accent"}),e.jsxs("span",{className:"text-foreground",children:["Qualified · holding ",(a.currentQe||0).toLocaleString(void 0,{maximumFractionDigits:0})," $QE"," ","(~$",(a.currentUsd||0).toFixed(2),")"]})]}),a.reason==="price_unavailable"&&e.jsx("div",{className:"text-xs text-muted-foreground",children:"Couldn't fetch current $QE price. Try again shortly."}),(a.reason==="no_wallet"||a.reason==="ok")&&e.jsxs(x,{size:"sm",variant:a.reason==="ok"?"secondary":"default",onClick:p,disabled:i||a.reason==="no_wallet",children:[i&&e.jsx(w,{className:"w-3.5 h-3.5 animate-spin mr-1.5"}),a.reason==="ok"?"Lock in my spot":"Verify & join"]})]})]})]})})})}function qe({userId:t}){const{data:r,isLoading:s}=ce(),{data:c}=de(t),a=j.useMemo(()=>{const i=[...(r==null?void 0:r.rows)||[]];return i.sort((l,m)=>m.premium_signups!==l.premium_signups?m.premium_signups-l.premium_signups:m.unique_ips-l.unique_ips),i},[r]),o=j.useMemo(()=>a.map(i=>i.code),[a]),{data:d}=me(o),u=a.some(i=>i.premium_signups>0||i.unique_ips>0);return e.jsx(f,{className:"border-border/50",children:e.jsxs(g,{className:"p-5 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ne,{className:"w-4 h-4",style:{color:h}}),e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Campaign Leaderboard"}),s&&e.jsx(w,{className:"w-3.5 h-3.5 animate-spin text-muted-foreground"})]}),a.length===0||!u?e.jsx("div",{className:"rounded-lg border border-dashed border-border/60 bg-muted/20 p-6 text-center",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"The board fills up as creators start sharing their links."})}):e.jsx("div",{className:"overflow-x-auto -mx-2 sm:mx-0",children:e.jsxs(fe,{children:[e.jsx(ge,{children:e.jsxs(D,{className:"border-border/40",children:[e.jsx(_,{className:"w-14 text-xs",children:"Rank"}),e.jsx(_,{className:"text-xs",children:"Creator"}),e.jsx(_,{className:"text-right text-xs",children:"Premium sign-ups"}),e.jsx(_,{className:"text-right text-xs",children:"Unique visitors"})]})}),e.jsx(je,{children:a.map((i,l)=>{const m=l+1,p=!!c&&i.code===c,n=d==null?void 0:d.get(i.code),N=(n==null?void 0:n.name)||`@${i.code}`,k=m<=3;return e.jsxs(D,{className:"border-border/30",style:p?{backgroundColor:`${h}12`,borderLeft:`3px solid ${h}`}:void 0,children:[e.jsx(C,{className:"font-semibold",children:e.jsx("span",{className:"inline-flex items-center justify-center w-7 h-7 rounded-full text-xs",style:k?{backgroundColor:`${h}22`,color:h}:{backgroundColor:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:m})}),e.jsx(C,{children:e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsxs(J,{className:"w-7 h-7 flex-shrink-0",children:[e.jsx(W,{src:(n==null?void 0:n.avatar_url)||""}),e.jsx(H,{className:"text-[10px]",children:(N[0]||"?").toUpperCase()})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"text-sm font-medium text-foreground truncate",children:[N,p&&e.jsx("span",{className:"ml-2 text-[10px] uppercase tracking-wider",style:{color:h},children:"You"})]}),(n==null?void 0:n.name)&&e.jsxs("div",{className:"text-[10px] text-muted-foreground font-mono truncate",children:["@",i.code]})]})]})}),e.jsx(C,{className:"text-right font-bold",style:{color:i.premium_signups>0?h:void 0},children:i.premium_signups}),e.jsx(C,{className:"text-right text-muted-foreground",children:i.unique_ips})]},i.code)})})]})}
1),e.jsx("p",{className:"text-[11px] text-muted-foreground/70 leading-relaxed pt-2 border-t border-border/30",children:"Payout terms live on the campaign details above. Korra provides general market commentary only."})]})})}function Ve(){var R,$,T;const{id:t}=I(),r=U(),{data:s,isLoading:c}=X(t),{data:a}=_e(t),[o,d]=j.useState(),{isAdmin:u,isEditor:i}=ne(),{data:l}=Ce(t,o),m=u||i,p=!!(s!=null&&s.qe_gate_enabled)&&Number((s==null?void 0:s.min_qe_usd)||0)>0,n=!p||!!(l!=null&&l.qe_qualifying_amount);if(j.useEffect(()=>{v.auth.getUser().then(({data:y})=>{var L;return d((L=y.user)==null?void 0:L.id)})},[]),c)return e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:e.jsx(w,{className:"w-6 h-6 animate-spin text-accent"})});if(!s)return e.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center gap-4",children:[e.jsx("p",{className:"text-muted-foreground",children:"Campaign not found."}),e.jsx(x,{variant:"outline",onClick:()=>r("/earn/dashboard"),children:"Back to Dashboard"})]});const N=s.status==="active",k=s.campaign_budget_qe-s.qe_distributed;return e.jsx(re,{variant:"warp",children:e.jsxs("div",{className:"min-h-screen bg-transparent",children:[e.jsx("div",{className:"pt-14"}),e.jsxs("div",{className:"max-w-3xl mx-auto px-6 py-12",children:[e.jsx(ie,{}),e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs(x,{variant:"ghost",size:"sm",className:"gap-2 text-muted-foreground",onClick:()=>r("/earn/dashboard"),children:[e.jsx(Z,{className:"w-4 h-4"})," Dashboard"]}),m&&e.jsxs(x,{variant:"outline",size:"sm",className:"gap-2",onClick:()=>r(`/earn/campaigns/create?edit=${t}`),children:[e.jsx(ee,{className:"w-3.5 h-3.5"})," Edit Campaign"]})]}),e.jsxs("div",{className:"flex items-start gap-4 mb-6",children:[s.logo_url||(R=s.project)!=null&&R.logo_url?e.jsx("img",{src:s.logo_url||(($=s.project)==null?void 0:$.logo_url)||"",alt:"",className:"w-16 h-16 rounded-xl object-cover border border-border/50"}):e.jsx("div",{className:"w-16 h-16 rounded-xl bg-muted flex items-center justify-center border border-border/50",children:e.jsx(E,{className:"w-8 h-8 text-accent"})}),e.jsxs("div",{className:"flex-1",children:[((T=s.project)==null?void 0:T.name)&&e.jsx("p",{className:"text-xs uppercase tracking-wider text-muted-foreground font-medium mb-1",children:s.project.name}),e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:s.name}),e.jsxs("div",{className:"flex items-center gap-3 mt-2 text-sm text-muted-foreground flex-wrap",children:[e.jsx(Q,{variant:N?"default":"secondary",className:N?"bg-accent/20 text-accent border-accent/30":"",children:s.status}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(E,{className:"w-3.5 h-3.5 text-accent"}),s.campaign_budget_qe.toLocaleString()," QE pool"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(se,{className:"w-3.5 h-3.5"}),(a==null?void 0:a.length)||0," creators"]}),s.end_date&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ae,{className:"w-3.5 h-3.5"}),be(new Date(s.end_date),{addSuffix:!0})]})]})]})]}),e.jsx(O,{className:"my-6"}),s.description&&e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"text-sm font-semibold text-foreground mb-2",children:"About this Campaign"}),e.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:s.description})]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-4 mb-6",children:[s.content_guidelines&&e.jsx(f,{className:"border-border/50",children:e.jsxs(g,{className:"p-4",children:[e.jsxs("h3",{className:"text-sm font-semibold text-foreground mb-2 flex items-center gap-2",children:[e.jsx(A,{className:"w-4 h-4 text-accent"})," Content Guidelines"]}),e.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:s.content_guidelines})]})}),s.posting_requirements&&e.jsx(f,{className:"border-border/50",children:e.jsxs(g,{className:"p-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground mb-2",children:"Posting Requirements"}),e.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:s.posting_requirements})]})}),s.do_not_say&&e.jsx(f,{className:"border-destructive/30",children:e.jsxs(g,{className:"p-4",children:[e.jsxs("h3",{className:"text-sm font-semibold text-destructive mb-2 flex items-center gap-2",children:[e.jsx(te,{className:"w-4 h-4"})," Do Not Say"]}),e.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:s.do_not_say})]})}),s.example_posts&&e.jsx(f,{className:"border-border/50",children:e.jsxs(g,{className:"p-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground mb-2",children:"Example Posts"}),e.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:s.example_posts})]})})]}),s.assets_url&&e.jsxs(x,{variant:"outline",size:"sm",className:"mb-6 gap-2",onClick:()=>window.open(s.assets_url,"_blank"),children:[e.jsx(z,{className:"w-3.5 h-3.5"})," Download Campaign Assets"]}),s.required_tags&&s.required_tags.length>0&&e.jsxs("div",{className:"mb-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground mb-2",children:"Required Tags"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:s.required_tags.map(y=>e.jsx(Q,{variant:"outline",children:y},y))})]}),e.jsx(f,{className:"border-border/50 mb-6",children:e.jsxs(g,{className:"p-4",children:[e.jsxs("h3",{className:"text-sm font-semibold text-foreground mb-2 flex items-center gap-2",children:[e.jsx(E,{className:"w-4 h-4 text-accent"})," Reward Distribution"]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:S(t)?"Rewards come from the 5M $QE prize pool and are distributed based on the Premium sign-ups your personal link drives, with unique visitors as the tie-breaker. Everything is measured automatically — no submissions to review.":"Rewards are distributed to all creators who contribute value to the campaign, based on the quality of their posts, engagement metrics, and overall value brought to the project."})]})}),e.jsxs("div",{className:"flex flex-wrap gap-4 text-sm text-muted-foreground mb-8",children:[s.start_date&&e.jsxs("span",{children:["Start: ",P(new Date(s.start_date),"MMM d, yyyy")]}),s.end_date&&e.jsxs("span",{children:["End: ",P(new Date(s.end_date),"MMM d, yyyy")]}
1),e.jsxs("span",{children:["Remaining: ",k.toLocaleString()," QE"]})]}),S(t)?e.jsxs("div",{className:"space-y-6",children:[e.jsx(xe,{userId:o}),e.jsx(qe,{userId:o})]}):N&&e.jsxs(e.Fragment,{children:[e.jsx(Ee,{campaign:s,userId:o}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs(x,{className:"gap-2",disabled:p&&!!o&&!n,onClick:()=>{if(!o){r(q());return}r(`/earn/submit?campaign=${t}`)},children:[e.jsx(A,{className:"w-4 h-4"})," Submit Content"]}),p&&!!o&&!n&&e.jsx("span",{className:"text-xs text-muted-foreground self-center",children:"Verify your $QE balance above to unlock submissions."})]})]})]})]})})}export{Ve 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.