1import{c as L,J as C,aB as R,k as U,a as z,f as I,r as t,j as e,M as m,aL as x,B as c,_ as w,ci as h,p as _,q,b7 as K,b8 as J,b9 as O,an as k,W as H,c9 as Q}from"./app-B1Q6Py99.js";import{A as S,a as A}from"./alert-zdYYo10H.js";/** 2 * @license lucide-react v0.487.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const V=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"12",x2:"12",y1:"16",y2:"12",key:"1y1yb1"}],["line",{x1:"12",x2:"12.01",y1:"8",y2:"8",key:"110wyk"}]],W=L("badge-info",V),Y=[{id:"mock-expert-1",name:"Dr. Emma Johnson",title:"Research Scientist",organization:"Stockholm University",expertise:["Machine Learning","Data Analysis","Neural Networks"],imageUrl:"https://i.pravatar.cc/150?img=1",bio:"Specializing in machine learning algorithms with 8+ years of experience in both academic and industrial settings.",hourlyRate:850,availability:[{date:new Date("2025-05-20"),startTime:"10:00",endTime:"11:30",isAvailable:!0},{date:new Date("2025-05-21"),startTime:"14:00",endTime:"15:30",isAvailable:!0},{date:new Date("2025-05-22"),startTime:"09:00",endTime:"10:30",isAvailable:!0}],freePreMeeting:!0,nextAvailable:"3 days"},{id:"mock-expert-2",name:"Prof. Marcus Chen",title:"Senior Research Fellow",organization:"KTH Royal Institute",expertise:["Quantum Computing","Computational Physics","Algorithm Development"],imageUrl:"https://i.pravatar.cc/150?img=2",bio:"Leading researcher in quantum computing applications with extensive publication record in high-impact journals.",hourlyRate:950,availability:[{date:new Date("2025-05-19"),startTime:"13:00",endTime:"14:30",isAvailable:!0},{date:new Date("2025-05-20"),startTime:"15:00",endTime:"16:30",isAvailable:!0},{date:new Date("2025-05-23"),startTime:"11:00",endTime:"12:30",isAvailable:!0}],freePreMeeting:!0,nextAvailable:"2 days"}];async function Z(a){try{const{data:i,error:r}=await C.functions.invoke("match",{body:{projectId:a}});if(r)throw console.error("Error calling match function:",r),new Error("Failed to match experts");return i}catch{return console.log("Using mock experts as fallback"),Y}}const $=()=>{const{id:a}=R(),{user:i}=U(),{toast:r}=z(),u=I(),[l,D]=t.useState(null),[E,j]=t.useState(!0),[p,F]=t.useState(null),[g,P]=t.useState([]),[d,f]=t.useState(!1),[N,b]=t.useState(null),[M,v]=t.useState(!1);t.useEffect(()=>{(async()=>{if(!(!i||!a))try{j(!0);const{data:n,error:o}=await C.from("projects").select("*").eq("id",a).eq("client_id",i.id).single();if(o)throw o;D(n)}catch(n){F(n.message||"Failed to load project"),r({title:"Error",description:"Could not load the project. Please try again.",variant:"destructive"})}finally{j(!1)}})()},[i,a,r]);const y=async()=>{if(a)try{f(!0);const s=await Z(a);P(s)}catch{r({title:"Error",description:"Failed to find matching specialists. Please try again later.",variant:"destructive"})}finally{f(!1)}},B=s=>{b(s),v(!0)},T=()=>{v(!1),b(null)};return i?E?e.jsx(m,{children:e.jsx("div",{className:"flex justify-center items-center min-h-[60vh]",children:e.jsx(x,{className:"h-8 w-8 animate-spin text-primary"})})}):p||!l?e.jsx(m,{children:e.jsxs("div",{className:"container mx-auto py-10 px-4",children:[e.jsx(S,{children:e.jsx(A,{children:p||"Project not found"})}),e.jsxs(c,{variant:"outline",className:"mt-4",onClick:()=>u("/client/projects"),children:[e.jsx(w,{className:"mr-2 h-4 w-4"})," Back to Projects"]})]})}):e.jsxs(m,{children:[e.jsxs("div",{className:"container mx-auto py-10 px-4",children:[e.jsxs("div",{className:"mb-8",children:[e.jsxs(c,{variant:"outline",className:"mb-4",onClick:()=>u("/client/projects"),children:[e.jsx(w,{className:"mr-2 h-4 w-4"})," Back to Projects"]}),e.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-start md:items-center gap-4",children:[e.jsx("h1",{className:"text-2xl font-bold",children:l.title}),e.jsx(c,{onClick:y,disabled:d,children:d?e.jsxs(e.Fragment,{children:[e.jsx(x,{className:"mr-2 h-4 w-4 animate-spin"}),"Finding Specialists..."]}):e.jsxs(e.Fragment,{children:[e.jsx(h,{className:"mr-2 h-4 w-4"}),"Find Specialists"]})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8 mb-8",children:[e.jsxs("div",{className:"lg:col-span-2",children:[e.jsxs("div",{className:"border p-6 rounded-lg mb-6",children:[e.jsx("h2",{className:"text-lg font-medium mb-4",children:"Project Details"}),e.jsxs("div",{className:"mb-4",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-1",children:"Description"}),e.jsx("p",{className:"whitespace-pre-wrap",children:l.description})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 mt-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-1",children:"Budget"}),e.jsxs("p",{children:[l.budget," SEK"]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-1",children:"Visibility"}),e.jsx("p",{className:"capitalize",children:l.visibility})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-1",children:"Created"}),e.jsx("p",{children:new Date(l.created_at).toLocaleDateString()})]})]})]}),g.length>0&&e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-medium mb-4",children:"Matching Specialists"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:g.map(s=>e.jsxs(_,{className:"overflow-hidden hover:shadow-md transition-shadow",children:[e.jsxs(q,{className:"pt-6",children:[e.jsx("div",{className:"flex justify-between items-start mb-2",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(K,{className:"h-12 w-12 border border-primary/20",children:[e.jsx(J,{src:s.imageUrl,alt:s.name}),e.jsx(O,{children:s.name.charAt(0)})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-bold text-lg truncate",children:s.name}),e.jsx("p",{className:"text-sm text-muted-foreground -mt-0.5",children:s.title})]})]})}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3 text-left",children:s.organization}),e.jsxs("div",{className:"flex flex-wrap gap-1 mb-3",children:[s.expertise.slice(0,2).map((n,o)=>e.jsx("span",{className:"text-xs py-0.5 px-2 bg-primary/10 text-primary rounded-full",children:n},o)),s.expertise.length>2&&e.jsxs("span",{className:"text-xs py-0.5 px-2 bg-muted text-muted-foreground rounded-full",children:["+",s.expertise.length-2]})]}),e.jsx("p",{className:"text-sm text-gray-700 mb-3 line-clamp-2",children:s.bio}),e.jsxs("div",{className:"flex items-center justify-between text-sm text-muted-foreground mb-2",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(k,{className:"h-4 w-4"}),e.jsxs("span",{children:["Available: ",s.nextAvailable]})]}),e.jsxs("div",{className:"font-medium text-primary",children:[s.hourlyRate," SEK/hour"]})]})]}),e.jsx(H,{className:"flex pt-0 border-t",children:e.jsx(c,{className:"w-full",onClick:()=>B(s),children:"Book Free 30-Min Meeting"})})]},s.id))})]})]}),e.jsxs("div",{className:"border p-6 rounded-lg h-fit",children:[e.jsx("h2",{className:"text-lg font-medium mb-4",children:"Project Status"}),e.jsxs("div",{className:"mb-4",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-1",children:"Status"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-green-500"}),e.jsx("span",{children:"Open"})]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-1",children:"Next Steps"}),e.jsxs("ul",{className:"space-y-2 text-sm",children:[e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(W,{className:"h-4 w-4 mt-0.5 text-primary"}),e.jsx("span",{children:"Find matching specialists to help with your project"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(k,{className:"h-4 w-4 mt-0.5 text-primary"}),e.jsx("span",{children:"Book free 30-minute meetings with specialists"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(h,{className:"h-4 w-4 mt-0.5 text-primary"}),e.jsx("span",{children:"Choose a specialist and start collaborating"})]})]})]}),e.jsx(c,{onClick:y,disabled:d,className:"w-full",children:d?e.jsxs(e.Fragment,{children:[e.jsx(x,{className:"mr-2 h-4 w-4 animate-spin"}),"Finding Specialists..."]}):e.jsxs(e.Fragment,{children:[e.jsx(h,{className:"mr-2 h-4 w-4"}),"Find Specialists"]})})]})]})]}),N&&e.jsx(Q,{expert:N,isOpen:M,onClose:T})]}):e.jsx(m,{children:e.jsx("div",{className:"container mx-auto py-10 px-4",children:e.jsx(S,{children:e.jsx(A,{children:"You must be logged in to view this project."})})})})};export{$ 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.