1import{r as i,j as e}from"./radix-CDu5Es6J.js";import{s as y,B as p,C as g,e as k,f as b,j as v,d as u,i as c,T as F,I as _,g as C}from"./admin-Ck-EjqfI.js";import{u as R}from"./day1-CaC5GY6J.js";import{u as z,A as B,a as G}from"./day3-DzQSNh6M.js";import{_ as O,U,p as H,c5 as V,M as q,a3 as Y}from"./icons-DeioJRsM.js";import"./tanstack-BafG60Gz.js";import"./supabase-Bb38dPVh.js";import"./day2-D2rfOpb3.js";import"./day1-presentations-CbeCh8DI.js";import"./day1-modules-CGxgl8D4.js";import"./day1-sessions-CoONypFJ.js";function te({onComplete:P,onBack:S}){const{user:t,profile:l}=R(),[o,E]=i.useState(""),[f,L]=i.useState([]),{updateProgress:j}=z(),[n,d]=i.useState({expertise:[],bio:"",contactPreferences:{allowEmail:!0,allowPhone:!1,allowLinkedIn:!0}}),[m,A]=i.useState([]),[M,N]=i.useState(!0),w=["Financial Planning & Analysis","AI Implementation","Digital Transformation","Risk Management","Data Analytics","Process Automation","Change Management","Treasury Management","Compliance & Regulation","ESG Reporting","Strategic Planning","Team Leadership"],x=m.filter(s=>{const a=o===""||s.name.toLowerCase().includes(o.toLowerCase())||s.company.toLowerCase().includes(o.toLowerCase())||s.role.toLowerCase().includes(o.toLowerCase()),r=f.length===0||f.some(h=>s.expertise.includes(h));return a&&r});i.useEffect(()=>{if(n.bio||n.expertise.length>0){const s=Math.min(100,(n.bio?25:0)+n.expertise.length*10+(n.contactPreferences.allowEmail?15:0)+(n.contactPreferences.allowLinkedIn?15:0)+20);j("networking",s,{networkProfile:n,expertiseAreas:n.expertise,networkConnections:x.length},s===100)}},[n,x.length,j]),i.useEffect(()=>{I()},[]);const I=async()=>{N(!0);try{const{data:s}=await y.from("network_profiles").select("*").eq("user_id",t==null?void 0:t.id).single();s&&d({expertise:s.expertise||[],bio:s.bio||"",contactPreferences:s.contact_preferences||{allowEmail:!0,allowPhone:!1,allowLinkedIn:!0}}),A([{id:"1",name:"Sarah Chen",company:"TechFin Solutions",role:"CFO",expertise:["AI Implementation","Financial Planning & Analysis","Digital Transformation"],contact:{linkedin:"linkedin.com/in/sarahchen"}},{id:"2",name:"Ahmed Hassan",company:"Global Finance Corp",role:"Director of Finance",expertise:["Risk Management","Compliance & Regulation","ESG Reporting"],contact:{email:"[email protected]"}},{id:"3",name:"Maria Rodriguez",company:"Innovation Labs",role:"VP Finance",expertise:["Process Automation","Data Analytics","Team Leadership"],contact:{linkedin:"linkedin.com/in/mariarodriguez"}}])}catch(s){console.error("Error loading network data:",s)}finally{N(!1)}},T=s=>{d(a=>({...a,expertise:a.expertise.includes(s)?a.expertise.filter(r=>r!==s):[...a.expertise,s]}))},D=async()=>{try{const{error:s}=await y.from("network_profiles").upsert({user_id:t==null?void 0:t.id,expertise:n.expertise,bio:n.bio,contact_preferences:n.contactPreferences,updated_at:new Date().toISOString()});if(s)throw s;P({profileUpdated:!0,expertise:n.expertise,connectionsViewed:m.length})}catch(s){console.error("Error saving profile:",s)}};return e.jsx("div",{className:"min-h-screen bg-background p-4 md:p-8",children:e.jsxs("div",{className:"max-w-6xl mx-auto",children:[e.jsxs(p,{variant:"ghost",onClick:S,className:"mb-6",children:[e.jsx(O,{className:"mr-2 h-4 w-4"}),"Back to Dashboard"]}),e.jsxs("div",{className:"grid lg:grid-cols-3 gap-8",children:[e.jsx("div",{className:"lg:col-span-1",children:e.jsxs(g,{children:[e.jsxs(k,{children:[e.jsxs(b,{className:"flex items-center gap-2",children:[e.jsx(U,{className:"h-5 w-5"}),"My Network Profile"]}),e.jsx(v,{children:"Build your professional network"})]}),e.jsxs(u,{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx(c,{children:"Your Name"}),e.jsx("p",{className:"text-sm font-medium mt-1",children:(l==null?void 0:l.display_name)||(t==null?void 0:t.email)})]}),e.jsxs("div",{children:[e.jsx(c,{children:"Company"}),e.jsx("p",{className:"text-sm font-medium mt-1",children:(l==null?void 0:l.company)||"Not specified"})]}),e.jsxs("div",{children:[e.jsx(c,{children:"Professional Bio"}),e.jsx(F,{className:"mt-2",placeholder:"Share your professional background and interests...",value:n.bio,onChange:s=>d(a=>({...a,bio:s.target.value})),rows:4})]}),e.jsxs("div",{children:[e.jsx(c,{children:"Areas of Expertise"}),e.jsx("div",{className:"mt-2 space-y-2",children:w.map(s=>e.jsxs("label",{className:"flex items-center space-x-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:n.expertise.includes(s),onChange:()=>T(s),className:"rounded border-gray-300"}),e.jsx("span",{className:"text-sm",children:s})]},s))})]}),e.jsxs("div",{children:[e.jsx(c,{children:"Contact Preferences"}),e.jsxs("div",{className:"mt-2 space-y-2",children:[e.jsxs("label",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",checked:n.contactPreferences.allowEmail,onChange:s=>d(a=>({...a,contactPreferences:{...a.contactPreferences,allowEmail:s.target.checked}})),className:"rounded border-gray-300"}),e.jsx("span",{className:"text-sm",children:"Allow email contact"})]}),e.jsxs("label",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",checked:n.contactPreferences.allowLinkedIn,onChange:s=>d(a=>({...a,contactPreferences:{...a.contactPreferences,allowLinkedIn:s.target.checked}})),className:"rounded border-gray-300"}),e.jsx("span",{className:"text-sm",children:"Share LinkedIn profile"})]})]})]}),e.jsx(p,{onClick:D,className:"w-full",children:"Save Profile & Complete"})]})]})}),e.jsx("div",{className:"lg:col-span-2",children:e.jsxs(g,{children:[e.jsxs(k,{children:[e.jsx(b,{children:"Network Directory"}),e.jsx(v,{children:"Connect with other finance transformation leaders"})]}),e.jsxs(u,{children:[e.jsxs("div",{className:"space-y-4 mb-6",children:[e.jsxs("div",{className:"relative",children:[e.jsx(H,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(_,{placeholder:"Search by name, company, or role...",value:o,onChange:s=>E(s.target.value),className:"pl-10"})]}),e.jsxs("div",{children:[e.jsxs(c,{className:"mb-2 flex items-center gap-2",children:[e.jsx(V,{className:"h-4 w-4"}),"Filter by Expertise"]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:w.slice(0,6).map(s=>e.jsx(C,{variant:f.includes(s)?"default":"outline",className:"cursor-pointer",onClick:()=>{L(a=>a.includes(s)?a.filter(r=>r!==s):[...a,s])},children:s},s))})]})]}),e.jsx("div",{className:"space-y-4",children:M?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading network members..."}):x.length===0?e.jsx(B,{children:e.jsx(G,{children:"No members found matching your criteria. Try adjusting your filters."})}):x.map(s=>{var a,r;return e.jsx(g,{className:"hover:shadow-md transition-shadow",children:e.jsx(u,{className:"p-4",children:e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-semibold text-lg",children:s.name}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.role," at ",s.company]}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:s.expertise.map(h=>e.jsx(C,{variant:"secondary",className:"text-xs",children:h},h))})]}),e.jsxs("div",{className:"flex gap-2",children:[((a=s.contact)==null?void 0:a.email)&&e.jsx(p,{size:"sm",variant:"outline",children:e.jsx(q,{className:"h-4 w-4"})}),((r=s.contact)==null?void 0:r.linkedin)&&e.jsx(p,{size:"sm",variant:"outline",children:e.jsx(Y,{className:"h-4 w-4"})})]})]})})},s.id)})}),e.jsxs("div",{className:"mt-8 p-4 bg-primary/5 rounded-lg",children:[e.jsx("h4",{className:"font-semibold mb-2",children:"Network Insights"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground",children:"Total Members"}),e.jsx("p",{className:"font-semibold text-lg",children:m.length})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground",children:"Companies"}),e.jsx("p",{className:"font-semibold text-lg",children:new Set(m.map(s=>s.company)).size})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground",children:"Expertise Areas"}),e.jsx("p",{className:"font-semibold text-lg",children:new Set(m.flatMap(s=>s.expertise)).size})]})]})]})]})]})})]})]})})}export{te 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.