PageSourceSearch

https://www.shekunj.com/assets/competitions-ExUFgDA8.js

js shekunj.com collected 2026-10-03 00:17:08 UTC 11,889 bytes, 1 lines download raw bytes

1import{r as p,j as e}from"./vendor-misc-CVac01wp.js";import{A}from"./AdminLayout-CO8H_7Ul.js";import{A as D}from"./AdminCrudPage-bmRqtbTw.js";import{c as j}from"./resources.service-CEzcrkWz.js";import{t as f}from"./team.service-BSWn09hG.js";import{u as b,a as I,b as E}from"./vendor-query-DHu-h-P3.js";import{B as h,G as v}from"./index-iLSfY4ww.js";import{T as P}from"./textarea-Bm8prxxr.js";import{L as S}from"./label-Dowl2Ooi.js";import{D as O,a as q,b as L,c as H}from"./dialog-DMNKv6do.js";import{B as R}from"./badge-BcwiMj0L.js";import{S as z}from"./skeleton-DSZsjrVM.js";import{U as F,e as N,q as U,O as K,N as C,az as M}from"./vendor-icons-DDUvZBzo.js";import{m as w}from"./vendor-framer-motion-CHz41Reu.js";import{f as B}from"./vendor-dates-DmBuu7Xm.js";import"./vendor-router-ClCfPVR3.js";import"./admin.service-QVGJKPaA.js";import"./input-D-P_XYh4.js";import"./select-DbYO0HMT.js";import"./vendor-radix-DimYera1.js";import"./alert-dialog-CSJ8fu_6.js";import"./file-upload-field-CIwn-X19.js";import"./upload.service-o80zmZT8.js";import"./vendor-auth-ClTo_901.js";import"./vendor-lottie-DJPGgW79.js";const _=[{key:"title",label:"Title",type:"text",required:!0},{key:"description",label:"Description",type:"textarea",required:!0},{key:"competitionType",label:"Type",type:"select",required:!0,showInCard:!0,options:[{label:"Hackathon",value:"HACKATHON"},{label:"Coding Challenge",value:"CODING_CHALLENGE"},{label:"Case Competition",value:"CASE_COMPETITION"},{label:"Design Contest",value:"DESIGN_CONTEST"},{label:"Innovation Challenge",value:"INNOVATION_CHALLENGE"},{label:"Other",value:"OTHER"}]},{key:"mode",label:"Mode",type:"select",required:!0,showInCard:!0,options:[{label:"Online",value:"ONLINE"},{label:"Offline",value:"OFFLINE"},{label:"Hybrid",value:"HYBRID"}]},{key:"startDate",label:"Start Date",type:"datetime",required:!0},{key:"endDate",label:"End Date",type:"datetime",required:!0},{key:"registrationDeadline",label:"Registration Deadline",type:"datetime"},{key:"venue",label:"Venue",type:"text"},{key:"maxTeamSize",label:"Max Team Size",type:"number"},{key:"maxParticipants",label:"Max Participants",type:"number"},{key:"totalPrizePool",label:"Total Prize Pool",type:"number"},{key:"tags",label:"Tags",type:"tags"},{key:"bannerImageUrl",label:"Banner Image",type:"file",fileCategory:"image",fileAccept:"image/*"}];function y({label:o,value:c,onChange:d}){return e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx(S,{className:"text-sm font-medium",children:o}),e.jsxs("span",{className:"text-sm font-bold text-gray-700",children:[c,"/10"]})]}),e.jsx("input",{type:"range",min:0,max:10,step:.5,value:c,onChange:a=>d(Number(a.target.value)),className:"w-full accent-gray-900"})]})}function G({competitionId:o,onClose:c}){const d=I(),[a,r]=p.useState(null),[s,n]=p.useState({innovation:7,technical:7,impact:7,presentation:7,feedback:""}),{data:l,isLoading:u}=b({queryKey:["admin-submissions",o],queryFn:()=>f.getSubmissions(o),enabled:!!o}),g=E({mutationFn:()=>f.scoreSubmission(a.id,s),onSuccess:()=>{d.invalidateQueries({queryKey:["admin-submissions",o]}),r(null),v({title:"Score saved!",description:"Submission has been scored."})},onError:t=>v({title:t?.message??"Failed to save score",variant:"destructive"})}),x=l?.data??[];return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("h3",{className:"font-semibold text-base",children:["Submissions (",x.length,")"]}),e.jsx("button",{onClick:c,className:"text-sm text-gray-400 hover:text-gray-700",children:"Close"})]}),u&&e.jsx("div",{className:"flex justify-center py-8",children:e.jsx(K,{className:"w-6 h-6 animate-spin"})}),!u&&x.length===0&&e.jsx("p",{className:"text-center text-gray-400 py-8 text-sm",children:"No submissions yet."}),e.jsx("div",{className:"space-y-3 max-h-[60vh] overflow-y-auto pr-1",children:x.map(t=>{const i=(t.scores??[]).length>0,k=i?(t.scores.reduce((m,T)=>m+T.totalScore,0)/t.scores.length).toFixed(1):null;return e.jsx("div",{className:"border border-gray-100 rounded-xl p-4 bg-gray-50 hover:bg-white transition-colors",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-semibold text-gray-900 truncate",children:t.title}),e.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["by ",t.team?.name??"Unknown"]}),t.description&&e.jsx("p",{className:"text-sm text-gray-600 mt-1.5 line-clamp-2",children:t.description}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[t.projectUrl&&e.jsxs("a",{href:t.projectUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-600 hover:underline flex items-center gap-1",children:[e.jsx(C,{className:"w-3 h-3"})," Project"]}),t.demoUrl&&e.jsxs("a",{href:t.demoUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-600 hover:underline flex items-center gap-1",children:[e.jsx(C,{className:"w-3 h-3"})," Demo"]})]})]}),e.jsxs("div",{className:"flex flex-col items-end gap-2 shrink-0",children:[i?e.jsxs("div",{className:"flex items-center gap-1 text-green-600",children:[e.jsx(M,{className:"w-4 h-4"}),e.jsx("span",{className:"text-xs font-bold",children:k})]}):null,e.jsx(h,{size:"sm",variant:i?"outline":"default",className:"rounded-xl text-xs h-8",onClick:()=>{r(t);const m=t.scores?.[0];n({innovation:m?.innovation??7,technical:m?.technical??7,impact:m?.impact??7,presentation:m?.presentation??7,feedback:m?.feedback??""})},children:i?"Re-score":"Score"})]})]})},t.id)})}),e.jsx(O,{open:!!a,onOpenChange:t=>!t&&r(null),children:e.jsxs(q,{className:"sm:max-w-md",children:[e.jsx(L,{children:e.jsxs(H,{
1children:["Score: ",a?.title]})}),e.jsxs("div",{className:"space-y-5 py-2",children:[e.jsx(y,{label:"Innovation",value:s.innovation,onChange:t=>n(i=>({...i,innovation:t}))}),e.jsx(y,{label:"Technical Excellence",value:s.technical,onChange:t=>n(i=>({...i,technical:t}))}),e.jsx(y,{label:"Impact",value:s.impact,onChange:t=>n(i=>({...i,impact:t}))}),e.jsx(y,{label:"Presentation",value:s.presentation,onChange:t=>n(i=>({...i,presentation:t}))}),e.jsxs("div",{children:[e.jsx(S,{className:"text-sm font-medium mb-1 block",children:"Feedback (optional)"}),e.jsx(P,{rows:3,value:s.feedback,onChange:t=>n(i=>({...i,feedback:t.target.value})),placeholder:"Comments for the team...",className:"resize-none"})]}),e.jsxs("div",{className:"flex justify-between items-center p-3 bg-gray-50 rounded-xl",children:[e.jsx("span",{className:"text-sm font-medium text-gray-600",children:"Total Score"}),e.jsxs("span",{className:"text-xl font-bold text-gray-900",children:[(s.innovation+s.technical+s.impact+s.presentation).toFixed(1),"/40"]})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(h,{variant:"outline",className:"flex-1 rounded-xl",onClick:()=>r(null),children:"Cancel"}),e.jsx(h,{className:"flex-1 rounded-xl bg-gray-900",disabled:g.isPending,onClick:()=>g.mutate(),children:g.isPending?"Saving...":"Save Score"})]})]})})]})}function J({competitionId:o,onClose:c}){const{data:d,isLoading:a}=b({queryKey:["competition-registrations",o],queryFn:async()=>{const s=await j.getRegistrations(o);return s.success?s.data:[]}}),r=d??[];return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("p",{className:"text-sm text-gray-500",children:[r.length," participant",r.length!==1?"s":""]}),e.jsx(h,{variant:"ghost",size:"sm",onClick:c,children:"← Back"})]}),a&&e.jsx("div",{className:"space-y-2",children:Array.from({length:5}).map((s,n)=>e.jsx(z,{className:"h-14 rounded-xl"},n))}),!a&&r.length===0&&e.jsx("p",{className:"text-sm text-center text-gray-400 py-8",children:"No registrations yet."}),!a&&r.length>0&&e.jsx("div",{className:"space-y-2 max-h-[55vh] overflow-y-auto pr-1",children:r.map((s,n)=>{const l=s.user??{};return e.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 rounded-xl border border-gray-100 bg-gray-50 hover:bg-white transition-colors",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-gray-200 shrink-0 overflow-hidden flex items-center justify-center text-gray-500 text-xs font-bold",children:l.avatarUrl?e.jsx("img",{src:l.avatarUrl,alt:"",className:"w-full h-full object-cover"}):`${l.name?.[0]??"?"}`}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold text-gray-900 truncate",children:l.name??"–"}),e.jsx("p",{className:"text-xs text-gray-500 truncate",children:l.email})]}),e.jsxs("div",{className:"text-right shrink-0",children:[e.jsx(R,{variant:"outline",className:"text-xs capitalize",children:(s.registrationData?.participationType??"individual").toLowerCase()}),e.jsx("p",{className:"text-xs text-gray-400 mt-1",children:s.createdAt?B(new Date(s.createdAt),"dd MMM yyyy"):"–"})]})]},s.id??n)})})]})}function je(){const o=j,[c,d]=p.useState(null),[a,r]=p.useState(!1),[s,n]=p.useState(null),[l,u]=p.useState(!1),{data:g}=b({queryKey:["competitions","admin-list"],queryFn:()=>j.list({limit:100})}),x=g?.data??[];return e.jsx(A,{children:e.jsxs("div",{className:"space-y-8",children:[e.jsx(D,{title:"Competitions",fields:_,service:o,titleKey:"title",descriptionKey:"description",badgeKey:"competitionType"}),e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-200 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{className:"w-5 h-5 text-blue-500"}),e.jsx("h2",{className:"font-bold text-lg",children:"Registrations"})]}),e.jsxs(h,{variant:"outline",size:"sm",className:"rounded-xl gap-1.5",onClick:()=>u(!l),children:[l?"Hide":"Show"," ",e.jsx(N,{className:`w-4 h-4 transition-transform ${l?"rotate-180":""}`})]})]}),l&&e.jsx(w.div,{initial:{opacity:0,y:8}
1,animate:{opacity:1,y:0},children:s?e.jsx(J,{competitionId:s,onClose:()=>n(null)}):e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500 mb-3",children:"Select a competition to view participants:"}),e.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-3",children:x.map(t=>e.jsxs("button",{onClick:()=>n(t.id),className:"p-3 text-left rounded-xl border border-gray-100 hover:border-gray-300 hover:bg-gray-50 transition-all",children:[e.jsx("p",{className:"font-semibold text-sm text-gray-900 truncate",children:t.title}),e.jsxs("p",{className:"text-xs text-gray-400 mt-0.5",children:[t.currentParticipants??0," / ",t.maxParticipants??"∞"," registered"]})]},t.id))})]})})]}),e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-200 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(U,{className:"w-5 h-5 text-amber-500"}),e.jsx("h2",{className:"font-bold text-lg",children:"Judging Panel"})]}),e.jsxs(h,{variant:"outline",size:"sm",className:"rounded-xl gap-1.5",onClick:()=>r(!a),children:[a?"Hide":"Show"," ",e.jsx(N,{className:`w-4 h-4 transition-transform ${a?"rotate-180":""}`})]})]}),a&&e.jsx(w.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},children:c?e.jsx(G,{competitionId:c,onClose:()=>d(null)}):e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500 mb-3",children:"Select a competition to review and score submissions:"}),e.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-3",children:x.filter(t=>t.competitionType==="HACKATHON"||!0).map(t=>e.jsxs("button",{onClick:()=>d(t.id),className:"p-3 text-left rounded-xl border border-gray-100 hover:border-gray-300 hover:bg-gray-50 transition-all",children:[e.jsx("p",{className:"font-semibold text-sm text-gray-900 truncate",children:t.title}),e.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:t.competitionType})]},t.id))})]})})]})]})})}export{je 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.