@igamingcareer/igaming-components 1.0.32 → 1.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.mjs +6 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7797,7 +7797,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
7797
7797
|
|
|
7798
7798
|
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
7799
7799
|
|
|
7800
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return v.useEffect(()=>{n&&(document.getElementById(n)||console.error(t))},[t,n]),null},l_="DialogDescriptionWarning",d_=({contentRef:n,descriptionId:e})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ij(l_).contentName}}.`;return v.useEffect(()=>{var c;const o=(c=n.current)==null?void 0:c.getAttribute("aria-describedby");e&&o&&(document.getElementById(e)||console.warn(a))},[a,n,e]),null},h_=kj,y_=gj,Aj=xj,qj=vj,Nj=wj,Pj=Cj,u_=Sj;function p_(n,e){if(n==null)return{};var t={},a=Object.keys(n),o,c;for(c=0;c<a.length;c++)o=a[c],!(e.indexOf(o)>=0)&&(t[o]=n[o]);return t}var k_=["color"],m_=b.forwardRef(function(n,e){var t=n.color,a=t===void 0?"currentColor":t,o=p_(n,k_);return b.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:e}),b.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:a,fillRule:"evenodd",clipRule:"evenodd"}))});const f_=h_,g_=y_,_j=v.forwardRef(({className:n,...e},t)=>i.jsx(Aj,{ref:t,className:ze("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...e}));_j.displayName=Aj.displayName;const zj=v.forwardRef(({className:n,children:e,...t},a)=>i.jsxs(g_,{children:[i.jsx(_j,{}),i.jsxs(qj,{ref:a,className:ze("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n),...t,children:[e,i.jsxs(u_,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[i.jsx(m_,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));zj.displayName=qj.displayName;const Tj=({className:n,...e})=>i.jsx("div",{className:ze("flex flex-col space-y-1.5 text-center sm:text-left",n),...e});Tj.displayName="DialogHeader";const Rj=({className:n,...e})=>i.jsx("div",{className:ze("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...e});Rj.displayName="DialogFooter";const Hj=v.forwardRef(({className:n,...e},t)=>i.jsx(Nj,{ref:t,className:ze("text-lg font-semibold leading-none tracking-tight",n),...e}));Hj.displayName=Nj.displayName;const Dj=v.forwardRef(({className:n,...e},t)=>i.jsx(Pj,{ref:t,className:ze("text-sm text-muted-foreground",n),...e}));Dj.displayName=Pj.displayName;var x_="Label",Fj=v.forwardRef((n,e)=>i.jsx(ai.label,{...n,ref:e,onMouseDown:t=>{var o;t.target.closest("button, input, select, textarea")||((o=n.onMouseDown)==null||o.call(n,t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Fj.displayName=x_;var Vj=Fj;const v_=NC("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Bj=v.forwardRef(({className:n,...e},t)=>i.jsx(Vj,{ref:t,className:ze(v_(),n),...e}));Bj.displayName=Vj.displayName;const M_=1,w_=1e6;let Pw=0;function b_(){return Pw=(Pw+1)%Number.MAX_SAFE_INTEGER,Pw.toString()}const _w=new Map,CC=n=>{if(_w.has(n))return;const e=setTimeout(()=>{_w.delete(n),G9({type:"REMOVE_TOAST",toastId:n})},w_);_w.set(n,e)},C_=(n,e)=>{switch(e.type){case"ADD_TOAST":return{...n,toasts:[e.toast,...n.toasts].slice(0,M_)};case"UPDATE_TOAST":return{...n,toasts:n.toasts.map(t=>t.id===e.toast.id?{...t,...e.toast}:t)};case"DISMISS_TOAST":{const{toastId:t}=e;return t?CC(t):n.toasts.forEach(a=>{CC(a.id)}),{...n,toasts:n.toasts.map(a=>a.id===t||t===void 0?{...a,open:!1}:a)}}case"REMOVE_TOAST":return e.toastId===void 0?{...n,toasts:[]}:{...n,toasts:n.toasts.filter(t=>t.id!==e.toastId)}}},L_=[];let zw={toasts:[]};function G9(n){zw=C_(zw,n),L_.forEach(e=>{e(zw)})}function LC({...n}){const e=b_(),t=o=>G9({type:"UPDATE_TOAST",toast:{...o,id:e}}),a=()=>G9({type:"DISMISS_TOAST",toastId:e});return G9({type:"ADD_TOAST",toast:{...n,id:e,open:!0,onOpenChange:o=>{o||a()}}}),{id:e,dismiss:a,update:t}}const S_=new Set([200,201,202,204]);function j_(n){return n===400?"BAD_REQUEST":n===401?"UNAUTHORIZED":n===403?"FORBIDDEN":n===404?"NOT_FOUND":n===409?"CONFLICT":n===429?"RATE_LIMITED":n>=500?"SERVER":"UNKNOWN"}function I_(n){if(n.friendly)return n.friendly;switch(n.code){case"TIMEOUT":return"The request took too long. Please try again.";case"NETWORK":return"You appear to be offline or the server can’t be reached.";case"RATE_LIMITED":return"Too many requests. Please wait a moment and try again.";case"SERVER":return"The server had an issue. Please try again shortly.";case"CONFLICT":return"This email may already be subscribed.";case"BAD_REQUEST":return"Please check your input and try again.";case"UNAUTHORIZED":return"Please sign in to continue.";default:return"Something went wrong. Please try again."}}async function A_(n,e){const{timeoutMs:t=12e3,...a}=e??{},o=new AbortController,c=setTimeout(()=>o.abort(),t);try{const s=await fetch(n,{...a,signal:o.signal});if(S_.has(s.status)){if(s.status===204)return{ok:!0,data:void 0};const y=await s.text();return{ok:!0,data:y?JSON.parse(y):void 0}}let l=null;try{l=await s.json()}catch{}return{ok:!1,error:{code:j_(s.status),status:s.status,message:(l==null?void 0:l.message)||`${s.status} ${s.statusText}`,details:l}}}catch(s){const l=(s==null?void 0:s.name)==="AbortError";return{ok:!1,error:{code:l?"TIMEOUT":"NETWORK",message:l?"Request aborted by timeout":(s==null?void 0:s.message)||"Network error"}}}finally{clearTimeout(c)}}function q_({open:n,onOpenChange:e,onSubscriptionSuccess:t,searchQuery:a,filters:o,apiUrl:c="http://localhost:5147"}){const[s,l]=b.useState(""),[d,h]=b.useState(!1),[y,u]=b.useState(null),p=async k=>{if(k.preventDefault(),u(null),!s||!s.includes("@")){u("Please enter a valid email address.");return}h(!0);try{const f=await A_(`${c}/api/leads`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:s,source:"filters_modal",utmCampaign:"jobs_filters",utmMedium:"ui",utmSource:"subscription_modal"}),timeoutMs:1e4});if(!f.ok){u(I_(f.error)),LC({title:"Subscription failed",description:f.error.message,variant:"destructive"});return}localStorage.setItem("leadId",f.data.id),localStorage.setItem("email",s),LC({title:"You're subscribed",description:`We'll notify you at ${s} when new jobs match your criteria.`}),t==null||t(),l("")}finally{h(!1)}};return i.jsx(f_,{open:n,onOpenChange:e,children:i.jsxs(zj,{className:"sm:max-w-md",children:[i.jsxs(Tj,{children:[i.jsxs(Hj,{className:"flex items-center gap-2",children:[i.jsx(Wi,{className:"h-5 w-5 text-orange-500"}),"Create Job Alert"]}),i.jsx(Dj,{children:"Subscribe to get notified when new jobs matching your search criteria are posted."})]}),i.jsxs("form",{onSubmit:p,className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(Bj,{htmlFor:"email",children:"Email address"}),i.jsxs("div",{className:"relative",children:[i.jsx(Zn,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),i.jsx(_i,{id:"email",type:"email",placeholder:"Enter your email address",value:s,onChange:k=>l(k.target.value),className:"pl-10",required:!0,"aria-invalid":!!y,"aria-describedby":y?"email-error":void 0})]}),y&&i.jsx("p",{id:"email-error",role:"alert",className:"text-sm text-red-600",children:y})]}),a&&i.jsxs("div",{className:"rounded-lg bg-muted p-3 text-sm",children:[i.jsx("p",{className:"font-medium",children:"Alert criteria:"}),i.jsxs("p",{className:"text-muted-foreground",children:['"',a,'"']})]}),i.jsxs(Rj,{className:"gap-2 sm:gap-0",children:[i.jsx($e,{type:"button",variant:"outline",onClick:()=>e(!1),disabled:d,children:"Cancel"}),i.jsx($e,{type:"submit",disabled:d,children:d?"Creating Alert...":"Create Alert"})]})]})]})})}const N_=6,P_=({apiUrl:n,itemsPerPage:e=12,filterKeys:t,banner:a,enableMobileFilter:o=!0,cardType:c,dateField:s="created_at",dateFieldLabel:l="Published",searchableFilters:d=["companies"],notification_url:h="http://localhost:5147"})=>{var Ri;const[y,u]=b.useState([]),[p,k]=b.useState([]),[f,m]=b.useState([]),[g,x]=b.useState(1),[w,L]=b.useState({}),[S,C]=b.useState([]),[q,I]=b.useState({}),[A,j]=b.useState(""),[R,U]=b.useState([]),[H,V]=b.useState(!1),[$,K]=b.useState(e),[G,te]=b.useState("grid"),[Q,ve]=b.useState([]),[ne,ce]=b.useState(!1),[_e,B]=b.useState([]),[O,X]=b.useState(!0),[ye,ge]=b.useState(null),[se,rt]=b.useState("all"),[He,Pt]=b.useState(!1),[Ot,Et]=b.useState(!1),[Xe,z]=b.useState({jobTypes:[],experienceLevels:[],country:"",minSalary:"",maxSalary:"",city:""}),[_,E]=b.useState({open:!1,type:"info",message:""}),he=(P,F)=>{E({open:!0,type:P,message:F})};b.useEffect(()=>{try{const P=localStorage.getItem("savedJobs");P&&ve(JSON.parse(P));const F=localStorage.getItem("lastVisitedJobs");F&&B(JSON.parse(F))}catch(P){console.error("Error loading data from localStorage:",P)}},[]),b.useEffect(()=>{const F=new URLSearchParams(window.location.search).get("date_filter");if(F&&F!=="all"){rt(F);const J=ot(y,w,S,F);k(J),x(1),le(J)}},[y]),b.useEffect(()=>{if(!n){ge("❌ Missing API URL for Listing component!"),X(!1);return}X(!0),ge(null),(async()=>{try{const F=await fetch(n);if(!F.ok)throw new Error(`API responded with status: ${F.status}`);const J=await F.json();if(!Array.isArray(J))throw new Error("Expected an array but received: "+typeof J);const ie=J.map((xt,oi)=>({...xt,sponsored:oi%7===0,topTag:Pb(xt.title||"")})),ue=Array.from(new Set(ie.map(xt=>xt.topTag).filter(xt=>typeof xt=="string"))).slice(0,10);m(ue),u(ie),k(ie);const Se=fo(ie,t);I(Se)}catch(F){console.error("Error fetching data:",F),ge(`Failed to load data: ${F instanceof Error?F.message:String(F)}`);const J=mN(20);u(J),k(J);const ie=fo(J,t);I(ie)}finally{X(!1)}})()},[n]),b.useEffect(()=>{const P=new URLSearchParams(window.location.search),F={};t.forEach(ue=>{const Se=P.get(ue);Se&&(F[ue]=Se)}),L(F);const J=P.get("q")||P.get("searchTerm")||"";J&&(j(J),gt(J));const ie={};t.forEach(ue=>{const Se=P.get(ue);Se&&(ie[ue]=Se)}),L(ie)},[]),b.useEffect(()=>{if(ne){const P=y.filter(F=>Q.includes(F.id||F.slug||F.link));k(P),x(1)}else{let P=y;P=ot(P,w,S,se),P=SN(P,Xe),k(P)}},[ne,Q,y,w,S,se,Xe]);const le=P=>{const F=fo(P,t);I(F)},Ae=(P,F)=>{L(J=>{const ie={...J};F?ie[P]=F:delete ie[P],ne&&ce(!1);const ue=ot(y,ie,S,se);return k(ue),x(1),le(ue),ie})},qe=()=>{Et(!0),Pt(!1)},Je=b.useRef(null),zi=P=>{x(P),setTimeout(()=>{var F;(F=Je.current)==null||F.scrollIntoView({behavior:"smooth",block:"start"})},100)},ya=P=>{ne&&ce(!1),rt(P),ni(P),$S(P)},ni=P=>{const F=ot(y,w,S,P);k(F),x(1),le(F)},Ut=P=>{if(j(P),P){const F=y.map(J=>J.title).filter((J,ie,ue)=>J&&J.toLowerCase().includes(P.toLowerCase())&&ue.indexOf(J)===ie).slice(0,5);U(F)}else U([])},gt=P=>{if(!P.trim())return;ne&&ce(!1);const F=[...S,P.trim()];C(F);const J=ot(y,w,F,se);k(J),x(1),le(J),j("")},Ti=P=>{const F=S.filter(ie=>ie!==P);C(F);const J=ot(y,w,F,se);k(J),x(1),le(J)},ii=()=>{z({jobTypes:[],experienceLevels:[],country:"",minSalary:"",maxSalary:"",city:""});const P=ot(y,w,S,se);k(P),x(1),le(P)},Gt=()=>{L({}),C([]),ce(!1),rt("all"),ii(),k(y),x(1),le(y)},ua=P=>{const F=new Set,J=[];for(const ie of P){const ue=`${ie.key??""}|${ie.value.toLowerCase()}`;F.has(ue)||(F.add(ue),J.push(ie))}return J},T=P=>P.replace(/\/+$/,""),W=async()=>{if(!Ot)Pt(!0);else{const P=localStorage.getItem("email"),F=localStorage.getItem("leadId");if(!P||!F){he("info","Please subscribe first to create alerts.");return}const J="keyword",ie=(Ge,ht)=>ht&&ht.trim()?{key:Ge.toLowerCase(),value:ht.trim()}:null,ue=Object.entries(w).map(([Ge,ht])=>ie(Ge,ht)).filter(Ge=>Ge!==null),Se=S.map(Ge=>ie(J,Ge)).filter(Ge=>Ge!==null),xt=ie(J,A),oi=xt?[xt]:[],Hi=ua([...ue,...Se,...oi]);if(Hi.length===0){he("info","No filters/keywords to save.");return}try{const Ge=T(h??"http://localhost:5147"),ht=await fetch(`${Ge}/api/leads/${F}/preferences/bulk`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Hi)});if(!ht.ok){let Ao="";try{Ao=await ht.text()}catch{}throw new Error(`${ht.status} ${ht.statusText} ${Ao}`.trim())}he("success","Alert saved. We’ll notify you about new matching jobs."),j("")}catch(Ge){console.error("Create alert failed:",Ge),he("error","Failed to save alert.")}}},oe=()=>{V(!H)},Le=p.length===0?0:(g-1)*$+1,Be=Math.min(g*$,p.length),Wt=P=>{K(P),x(1)},De=()=>{te(G==="grid"?"list":"grid")},Fe=P=>{const F=P.id??P._id??P.slug??P.link;ve(J=>{const ie=J.includes(F);let ue;ie?ue=J.filter(Se=>Se!==F):ue=[...J,F];try{localStorage.setItem("savedJobs",JSON.stringify(ue))}catch(Se){console.error("Error saving to localStorage:",Se)}return ue})},_t=P=>{const F=P.id||P.slug||P.link;B(J=>{const ie=J.filter(Se=>(Se.id||Se.slug||Se.link)!==F),ue=[P,...ie].slice(0,N_);try{localStorage.setItem("lastVisitedJobs",JSON.stringify(ue))}catch(Se){console.error("Error saving to localStorage:",Se)}return ue})},me=()=>{ce(!ne)},Ve=Math.ceil(p.length/$),pa=p.slice((g-1)*$,g*$);return ye&&!y.length?i.jsx("div",{className:"flex-grow p-8",children:i.jsx("div",{className:"max-w-7xl mx-auto",children:i.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-800 rounded-lg p-6",children:[i.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Error Loading Jobs"}),i.jsx("p",{className:"mb-4",children:ye}),i.jsx("button",{onClick:()=>window.location.reload(),className:"bg-red-100 hover:bg-red-200 text-red-800 font-medium py-2 px-4 rounded",children:"Retry"})]})})}):i.jsxs("div",{className:"flex flex-col min-h-screen pb-16 md:pb-0",children:[i.jsxs("div",{className:"flex-grow",children:[i.jsx(Nb,{onSearchChange:Ut,searchPlaceholder:"Search jobs, companies, or keywords...",title:"Job Listings",description:"",popularTags:f,generateHref:P=>`/jobs?q=${P.toLowerCase().replace(/\s+/g,"+")}`}),i.jsxs("div",{className:"container mx-auto py-8 pb-20 md:pb-8",children:[i.jsxs("div",{className:"relative",children:[i.jsxs("div",{className:"relative flex items-center gap-2 sm:my-6 my-2",children:[i.jsx(qb,{data:y.map(P=>P.title).filter(Boolean),onSelect:P=>{gt(P)},onTyping:P=>{j(P),Ut(P)},placeholder:"Search for jobs, companies, or keywords...",className:"w-full",showSubmitButton:!0}),i.jsx("button",{className:"block md:hidden flex items-center justify-center p-3 bg-white border-2 border-gray-200 text-gray-700 rounded-xl hover:border-gray-300 hover:bg-gray-50 transition-all duration-200 focus:ring-4 focus:ring-gray-200 focus:outline-none hover:scale-105",onClick:oe,children:i.jsx(oa,{size:16,className:"mr-1.5"})})]}),i.jsx(_b,{filters:[...se!=="all"?[{key:"date",label:l,value:se.replace(/_/g," "),onRemove:()=>ya("all")}]:[],...S.map(P=>({key:"search",label:"",value:P,onRemove:()=>Ti(P)})),...Object.entries(w).map(([P,F])=>({key:P,label:P.replace(/_/g," "),value:F,onRemove:()=>Ae(P,"")}))],onClearAll:Gt,handleCreateAlert:W})]}),o&&i.jsxs("button",{className:"md:hidden w-full mb-6 px-4 py-3 bg-yellow-600 text-white rounded-lg flex items-center justify-center",onClick:oe,"aria-expanded":H,children:[i.jsx(oa,{className:"w-4 h-4 mr-2"}),H?"Close Filters":"Filters"]}),i.jsxs("div",{className:"flex flex-col lg:flex-row lg:gap-6",children:[i.jsx(XS,{dateFieldLabel:"Date",activeDateFilter:se,onDateFilterChange:ya,filterKeys:t,searchableFilters:d,filtersData:q,activeFilters:w,handleFilterChange:Ae,toggleSavedJobsFilter:me,showOnlySaved:ne,savedJobs:Q}),O?i.jsx(Ab,{}):i.jsxs("div",{className:"lg:gap-6",children:[i.jsx(zb,{viewMode:G,onToggleViewMode:De,selectedItemsPerPage:$,onItemsPerPageChange:Wt,totalCount:p.length,startIndex:Le,endIndex:Be,title:"Latest News"}),i.jsxs("div",{className:"",children:[i.jsx("div",{className:"mb-6",children:i.jsxs("div",{className:"flex flex-row items-center justify-between",children:[i.jsxs("h3",{className:"text-xl font-semibold text-gray-900 flex items-center",children:[ne?"Saved Jobs":"Open Positions",se!=="all"&&!ne&&i.jsxs("span",{className:"text-sm font-normal text-gray-500 ml-2",children:["(",se.replace(/_/g," "),")"]})]}),i.jsxs("p",{className:"text-sm text-gray-600",children:[i.jsx("span",{className:"font-semibold text-gray-900",children:p.length})," found"]})]})}),i.jsx(bN,{items:pa,cardType:c,viewMode:G,savedJobs:Q,onSaveJob:Fe,onViewJob:_t,firstItemRef:Je}),p.length>0&&i.jsx("div",{className:"mt-6",children:i.jsx(Tb,{currentPage:g,totalPages:Ve,onPageChange:zi})})]}),_e.length>0&&i.jsx("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-5",children:i.jsx(CN,{jobs:_e,onViewJob:_t})})]}),i.jsx("div",{className:"hidden lg:block lg:w-1/4 space-y-6",children:((Ri=a==null?void 0:a.sidebar)==null?void 0:Ri.enabled)&&i.jsxs("div",{className:"sticky top-4",children:[i.jsx(So,{position:"sidebar",url:a.sidebar.url,link:a.sidebar.link,alt:a.sidebar.alt}),i.jsx(Ib,{api_url:h}),i.jsxs("div",{className:"mt-6 bg-white rounded-lg shadow-sm border border-gray-200 p-5",children:[i.jsx("h3",{className:"font-semibold text-lg mb-3",children:"Featured Employers"}),i.jsx("div",{className:"grid grid-cols-3 gap-2",children:[...Array(6)].map((P,F)=>i.jsx("div",{className:"flex items-center justify-center p-2 bg-gray-50 rounded-md",children:i.jsx("img",{src:`/placeholder.svg?height=40&width=40&text=${String.fromCharCode(65+F)}`,alt:`Featured employer ${F+1}`,className:"w-10 h-10 object-contain"})},F))})]})]})})]})]})]}),i.jsx(ZS,{activeDateFilter:se,handleDateFilterChange:ya,filterKeys:t,searchableFilters:d,dateFieldLabel:l,activeFilters:w,handleFilterChange:Ae,toggleSavedJobsFilter:me,filtersData:q,savedJobs:Q,showOnlySaved:ne,isMobileFilterOpen:H,toggleMobileFilter:oe}),i.jsx(GS,{savedJobsCount:Q.length}),i.jsx(ES,{open:_.open,type:_.type,message:_.message,onClose:()=>E(P=>({...P,open:!1}))}),i.jsx(q_,{open:He,onOpenChange:Pt,onSubscriptionSuccess:qe,apiUrl:h})]})},__=()=>i.jsx("div",{children:i.jsx("h2",{children:"Welcome to the Header!"})}),z_=({article:n,isBookmarked:e,onToggleBookmark:t,onShare:a,layout:o="card"})=>{const[c,s]=b.useState(!1),l=p=>{const k=new Date(p),m=Math.floor((new Date().getTime()-k.getTime())/(1e3*60*60));return m<1?"Just now":m<24?`${m}h ago`:m<48?"Yesterday":k.toLocaleDateString("en-US",{month:"short",day:"numeric"})},d=p=>p>=1e3?`${(p/1e3).toFixed(1)}k`:p.toString(),h=p=>p.length>1?p[1]:p[0],y=(p,k)=>p.length<=k?p:p.substring(0,k).trim()+"...",u=o==="grid"?"flex flex-col":"flex flex-col md:flex-row md:items-center";return i.jsxs("article",{className:`
|
|
7800
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return v.useEffect(()=>{n&&(document.getElementById(n)||console.error(t))},[t,n]),null},l_="DialogDescriptionWarning",d_=({contentRef:n,descriptionId:e})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ij(l_).contentName}}.`;return v.useEffect(()=>{var c;const o=(c=n.current)==null?void 0:c.getAttribute("aria-describedby");e&&o&&(document.getElementById(e)||console.warn(a))},[a,n,e]),null},h_=kj,y_=gj,Aj=xj,qj=vj,Nj=wj,Pj=Cj,u_=Sj;function p_(n,e){if(n==null)return{};var t={},a=Object.keys(n),o,c;for(c=0;c<a.length;c++)o=a[c],!(e.indexOf(o)>=0)&&(t[o]=n[o]);return t}var k_=["color"],m_=b.forwardRef(function(n,e){var t=n.color,a=t===void 0?"currentColor":t,o=p_(n,k_);return b.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:e}),b.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:a,fillRule:"evenodd",clipRule:"evenodd"}))});const f_=h_,g_=y_,_j=v.forwardRef(({className:n,...e},t)=>i.jsx(Aj,{ref:t,className:ze("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",n),...e}));_j.displayName=Aj.displayName;const zj=v.forwardRef(({className:n,children:e,...t},a)=>i.jsxs(g_,{children:[i.jsx(_j,{}),i.jsxs(qj,{ref:a,className:ze("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",n),...t,children:[e,i.jsxs(u_,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[i.jsx(m_,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));zj.displayName=qj.displayName;const Tj=({className:n,...e})=>i.jsx("div",{className:ze("flex flex-col space-y-1.5 text-center sm:text-left",n),...e});Tj.displayName="DialogHeader";const Rj=({className:n,...e})=>i.jsx("div",{className:ze("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",n),...e});Rj.displayName="DialogFooter";const Hj=v.forwardRef(({className:n,...e},t)=>i.jsx(Nj,{ref:t,className:ze("text-lg font-semibold leading-none tracking-tight",n),...e}));Hj.displayName=Nj.displayName;const Dj=v.forwardRef(({className:n,...e},t)=>i.jsx(Pj,{ref:t,className:ze("text-sm text-muted-foreground",n),...e}));Dj.displayName=Pj.displayName;var x_="Label",Fj=v.forwardRef((n,e)=>i.jsx(ai.label,{...n,ref:e,onMouseDown:t=>{var o;t.target.closest("button, input, select, textarea")||((o=n.onMouseDown)==null||o.call(n,t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Fj.displayName=x_;var Vj=Fj;const v_=NC("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Bj=v.forwardRef(({className:n,...e},t)=>i.jsx(Vj,{ref:t,className:ze(v_(),n),...e}));Bj.displayName=Vj.displayName;const M_=1,w_=1e6;let Pw=0;function b_(){return Pw=(Pw+1)%Number.MAX_SAFE_INTEGER,Pw.toString()}const _w=new Map,CC=n=>{if(_w.has(n))return;const e=setTimeout(()=>{_w.delete(n),G9({type:"REMOVE_TOAST",toastId:n})},w_);_w.set(n,e)},C_=(n,e)=>{switch(e.type){case"ADD_TOAST":return{...n,toasts:[e.toast,...n.toasts].slice(0,M_)};case"UPDATE_TOAST":return{...n,toasts:n.toasts.map(t=>t.id===e.toast.id?{...t,...e.toast}:t)};case"DISMISS_TOAST":{const{toastId:t}=e;return t?CC(t):n.toasts.forEach(a=>{CC(a.id)}),{...n,toasts:n.toasts.map(a=>a.id===t||t===void 0?{...a,open:!1}:a)}}case"REMOVE_TOAST":return e.toastId===void 0?{...n,toasts:[]}:{...n,toasts:n.toasts.filter(t=>t.id!==e.toastId)}}},L_=[];let zw={toasts:[]};function G9(n){zw=C_(zw,n),L_.forEach(e=>{e(zw)})}function LC({...n}){const e=b_(),t=o=>G9({type:"UPDATE_TOAST",toast:{...o,id:e}}),a=()=>G9({type:"DISMISS_TOAST",toastId:e});return G9({type:"ADD_TOAST",toast:{...n,id:e,open:!0,onOpenChange:o=>{o||a()}}}),{id:e,dismiss:a,update:t}}const S_=new Set([200,201,202,204]);function j_(n){return n===400?"BAD_REQUEST":n===401?"UNAUTHORIZED":n===403?"FORBIDDEN":n===404?"NOT_FOUND":n===409?"CONFLICT":n===429?"RATE_LIMITED":n>=500?"SERVER":"UNKNOWN"}function I_(n){if(n.friendly)return n.friendly;switch(n.code){case"TIMEOUT":return"The request took too long. Please try again.";case"NETWORK":return"You appear to be offline or the server can’t be reached.";case"RATE_LIMITED":return"Too many requests. Please wait a moment and try again.";case"SERVER":return"The server had an issue. Please try again shortly.";case"CONFLICT":return"This email may already be subscribed.";case"BAD_REQUEST":return"Please check your input and try again.";case"UNAUTHORIZED":return"Please sign in to continue.";default:return"Something went wrong. Please try again."}}async function A_(n,e){const{timeoutMs:t=12e3,...a}=e??{},o=new AbortController,c=setTimeout(()=>o.abort(),t);try{const s=await fetch(n,{...a,signal:o.signal});if(S_.has(s.status)){if(s.status===204)return{ok:!0,data:void 0};const y=await s.text();return{ok:!0,data:y?JSON.parse(y):void 0}}let l=null;try{l=await s.json()}catch{}return{ok:!1,error:{code:j_(s.status),status:s.status,message:(l==null?void 0:l.message)||`${s.status} ${s.statusText}`,details:l}}}catch(s){const l=(s==null?void 0:s.name)==="AbortError";return{ok:!1,error:{code:l?"TIMEOUT":"NETWORK",message:l?"Request aborted by timeout":(s==null?void 0:s.message)||"Network error"}}}finally{clearTimeout(c)}}function q_({open:n,onOpenChange:e,onSubscriptionSuccess:t,searchQuery:a,filters:o,apiUrl:c="http://localhost:5147"}){const[s,l]=b.useState(""),[d,h]=b.useState(!1),[y,u]=b.useState(null),p=async k=>{if(k.preventDefault(),u(null),!s||!s.includes("@")){u("Please enter a valid email address.");return}h(!0);try{const f=await A_(`${c}/api/leads`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:s,source:"filters_modal",utmCampaign:"jobs_filters",utmMedium:"ui",utmSource:"subscription_modal"}),timeoutMs:1e4});if(!f.ok){u(I_(f.error)),LC({title:"Subscription failed",description:f.error.message,variant:"destructive"});return}localStorage.setItem("leadId",f.data.id),localStorage.setItem("email",s),LC({title:"You're subscribed",description:`We'll notify you at ${s} when new jobs match your criteria.`}),t==null||t(),l("")}finally{h(!1)}};return i.jsx(f_,{open:n,onOpenChange:e,children:i.jsxs(zj,{className:"sm:max-w-md",children:[i.jsxs(Tj,{children:[i.jsxs(Hj,{className:"flex items-center gap-2",children:[i.jsx(Wi,{className:"h-5 w-5 text-orange-500"}),"Create Job Alert"]}),i.jsx(Dj,{children:"Subscribe to get notified when new jobs matching your search criteria are posted."})]}),i.jsxs("form",{onSubmit:p,className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(Bj,{htmlFor:"email",children:"Email address"}),i.jsxs("div",{className:"relative",children:[i.jsx(Zn,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),i.jsx(_i,{id:"email",type:"email",placeholder:"Enter your email address",value:s,onChange:k=>l(k.target.value),className:"pl-10",required:!0,"aria-invalid":!!y,"aria-describedby":y?"email-error":void 0})]}),y&&i.jsx("p",{id:"email-error",role:"alert",className:"text-sm text-red-600",children:y})]}),a&&i.jsxs("div",{className:"rounded-lg bg-muted p-3 text-sm",children:[i.jsx("p",{className:"font-medium",children:"Alert criteria:"}),i.jsxs("p",{className:"text-muted-foreground",children:['"',a,'"']})]}),i.jsxs(Rj,{className:"gap-2 sm:gap-0",children:[i.jsx($e,{type:"button",variant:"outline",onClick:()=>e(!1),disabled:d,children:"Cancel"}),i.jsx($e,{type:"submit",disabled:d,children:d?"Creating Alert...":"Create Alert"})]})]})]})})}const N_=6,P_=({apiUrl:n,itemsPerPage:e=12,filterKeys:t,banner:a,enableMobileFilter:o=!0,cardType:c,dateField:s="created_at",dateFieldLabel:l="Published",searchableFilters:d=["companies"],notification_url:h="http://localhost:5147"})=>{var Ri;const[y,u]=b.useState([]),[p,k]=b.useState([]),[f,m]=b.useState([]),[g,x]=b.useState(1),[w,L]=b.useState({}),[S,C]=b.useState([]),[q,I]=b.useState({}),[A,j]=b.useState(""),[R,U]=b.useState([]),[H,V]=b.useState(!1),[$,K]=b.useState(e),[G,te]=b.useState("grid"),[Q,ve]=b.useState([]),[ne,ce]=b.useState(!1),[_e,B]=b.useState([]),[O,X]=b.useState(!0),[ye,ge]=b.useState(null),[se,rt]=b.useState("all"),[He,Pt]=b.useState(!1),[Ot,Et]=b.useState(!1),[Xe,z]=b.useState({jobTypes:[],experienceLevels:[],country:"",minSalary:"",maxSalary:"",city:""}),[_,E]=b.useState({open:!1,type:"info",message:""}),he=(P,F)=>{E({open:!0,type:P,message:F})};b.useEffect(()=>{try{const P=localStorage.getItem("savedJobs");P&&ve(JSON.parse(P));const F=localStorage.getItem("lastVisitedJobs");F&&B(JSON.parse(F))}catch(P){console.error("Error loading data from localStorage:",P)}},[]),b.useEffect(()=>{const F=new URLSearchParams(window.location.search).get("date_filter");if(F&&F!=="all"){rt(F);const J=ot(y,w,S,F);k(J),x(1),le(J)}},[y]),b.useEffect(()=>{if(!n){ge("❌ Missing API URL for Listing component!"),X(!1);return}X(!0),ge(null),(async()=>{try{const F=await fetch(n);if(!F.ok)throw new Error(`API responded with status: ${F.status}`);const J=await F.json();if(!Array.isArray(J))throw new Error("Expected an array but received: "+typeof J);const ie=J.map((xt,oi)=>({...xt,sponsored:oi%7===0,topTag:Pb(xt.title||"")})),ue=Array.from(new Set(ie.map(xt=>xt.topTag).filter(xt=>typeof xt=="string"))).slice(0,10);m(ue),u(ie),k(ie);const Se=fo(ie,t);I(Se)}catch(F){console.error("Error fetching data:",F),ge(`Failed to load data: ${F instanceof Error?F.message:String(F)}`);const J=mN(20);u(J),k(J);const ie=fo(J,t);I(ie)}finally{X(!1)}})()},[n]),b.useEffect(()=>{const P=new URLSearchParams(window.location.search),F={};t.forEach(ue=>{const Se=P.get(ue);Se&&(F[ue]=Se)}),L(F);const J=P.get("q")||P.get("searchTerm")||"";J&&(j(J),gt(J));const ie={};t.forEach(ue=>{const Se=P.get(ue);Se&&(ie[ue]=Se)}),L(ie)},[]),b.useEffect(()=>{if(ne){const P=y.filter(F=>Q.includes(F.id||F.slug||F.link));k(P),x(1)}else{let P=y;P=ot(P,w,S,se),P=SN(P,Xe),k(P)}},[ne,Q,y,w,S,se,Xe]);const le=P=>{const F=fo(P,t);I(F)},Ae=(P,F)=>{L(J=>{const ie={...J};F?ie[P]=F:delete ie[P],ne&&ce(!1);const ue=ot(y,ie,S,se);return k(ue),x(1),le(ue),ie})},qe=()=>{Et(!0),W().then(()=>Pt(!1))},Je=b.useRef(null),zi=P=>{x(P),setTimeout(()=>{var F;(F=Je.current)==null||F.scrollIntoView({behavior:"smooth",block:"start"})},100)},ya=P=>{ne&&ce(!1),rt(P),ni(P),$S(P)},ni=P=>{const F=ot(y,w,S,P);k(F),x(1),le(F)},Ut=P=>{if(j(P),P){const F=y.map(J=>J.title).filter((J,ie,ue)=>J&&J.toLowerCase().includes(P.toLowerCase())&&ue.indexOf(J)===ie).slice(0,5);U(F)}else U([])},gt=P=>{if(!P.trim())return;ne&&ce(!1);const F=[...S,P.trim()];C(F);const J=ot(y,w,F,se);k(J),x(1),le(J),j("")},Ti=P=>{const F=S.filter(ie=>ie!==P);C(F);const J=ot(y,w,F,se);k(J),x(1),le(J)},ii=()=>{z({jobTypes:[],experienceLevels:[],country:"",minSalary:"",maxSalary:"",city:""});const P=ot(y,w,S,se);k(P),x(1),le(P)},Gt=()=>{L({}),C([]),ce(!1),rt("all"),ii(),k(y),x(1),le(y)},ua=P=>{const F=new Set,J=[];for(const ie of P){const ue=`${ie.key??""}|${ie.value.toLowerCase()}`;F.has(ue)||(F.add(ue),J.push(ie))}return J},T=P=>P.replace(/\/+$/,""),W=async()=>{if(!Ot)Pt(!0);else{const P=localStorage.getItem("email"),F=localStorage.getItem("leadId");if(!P||!F){he("info","Please subscribe first to create alerts.");return}const J="keyword",ie=(Ge,ht)=>ht&&ht.trim()?{key:Ge.toLowerCase(),value:ht.trim()}:null,ue=Object.entries(w).map(([Ge,ht])=>ie(Ge,ht)).filter(Ge=>Ge!==null),Se=S.map(Ge=>ie(J,Ge)).filter(Ge=>Ge!==null),xt=ie(J,A),oi=xt?[xt]:[],Hi=ua([...ue,...Se,...oi]);if(Hi.length===0){he("info","No filters/keywords to save.");return}try{const Ge=T(h??"http://localhost:5147"),ht=await fetch(`${Ge}/api/leads/${F}/preferences/bulk`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Hi)});if(!ht.ok){let Ao="";try{Ao=await ht.text()}catch{}throw new Error(`${ht.status} ${ht.statusText} ${Ao}`.trim())}he("success","Alert saved. We’ll notify you about new matching jobs."),j("")}catch(Ge){console.error("Create alert failed:",Ge),he("error","Failed to save alert.")}}},oe=()=>{V(!H)},Le=p.length===0?0:(g-1)*$+1,Be=Math.min(g*$,p.length),Wt=P=>{K(P),x(1)},De=()=>{te(G==="grid"?"list":"grid")},Fe=P=>{const F=P.id??P._id??P.slug??P.link;ve(J=>{const ie=J.includes(F);let ue;ie?ue=J.filter(Se=>Se!==F):ue=[...J,F];try{localStorage.setItem("savedJobs",JSON.stringify(ue))}catch(Se){console.error("Error saving to localStorage:",Se)}return ue})},_t=P=>{const F=P.id||P.slug||P.link;B(J=>{const ie=J.filter(Se=>(Se.id||Se.slug||Se.link)!==F),ue=[P,...ie].slice(0,N_);try{localStorage.setItem("lastVisitedJobs",JSON.stringify(ue))}catch(Se){console.error("Error saving to localStorage:",Se)}return ue})},me=()=>{ce(!ne)},Ve=Math.ceil(p.length/$),pa=p.slice((g-1)*$,g*$);return ye&&!y.length?i.jsx("div",{className:"flex-grow p-8",children:i.jsx("div",{className:"max-w-7xl mx-auto",children:i.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-800 rounded-lg p-6",children:[i.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Error Loading Jobs"}),i.jsx("p",{className:"mb-4",children:ye}),i.jsx("button",{onClick:()=>window.location.reload(),className:"bg-red-100 hover:bg-red-200 text-red-800 font-medium py-2 px-4 rounded",children:"Retry"})]})})}):i.jsxs("div",{className:"flex flex-col min-h-screen pb-16 md:pb-0",children:[i.jsxs("div",{className:"flex-grow",children:[i.jsx(Nb,{onSearchChange:Ut,searchPlaceholder:"Search jobs, companies, or keywords...",title:"Job Listings",description:"",popularTags:f,generateHref:P=>`/jobs?q=${P.toLowerCase().replace(/\s+/g,"+")}`}),i.jsxs("div",{className:"container mx-auto py-8 pb-20 md:pb-8",children:[i.jsxs("div",{className:"relative",children:[i.jsxs("div",{className:"relative flex items-center gap-2 sm:my-6 my-2",children:[i.jsx(qb,{data:y.map(P=>P.title).filter(Boolean),onSelect:P=>{gt(P)},onTyping:P=>{j(P),Ut(P)},placeholder:"Search for jobs, companies, or keywords...",className:"w-full",showSubmitButton:!0}),i.jsx("button",{className:"block md:hidden flex items-center justify-center p-3 bg-white border-2 border-gray-200 text-gray-700 rounded-xl hover:border-gray-300 hover:bg-gray-50 transition-all duration-200 focus:ring-4 focus:ring-gray-200 focus:outline-none hover:scale-105",onClick:oe,children:i.jsx(oa,{size:16,className:"mr-1.5"})})]}),i.jsx(_b,{filters:[...se!=="all"?[{key:"date",label:l,value:se.replace(/_/g," "),onRemove:()=>ya("all")}]:[],...S.map(P=>({key:"search",label:"",value:P,onRemove:()=>Ti(P)})),...Object.entries(w).map(([P,F])=>({key:P,label:P.replace(/_/g," "),value:F,onRemove:()=>Ae(P,"")}))],onClearAll:Gt,handleCreateAlert:W})]}),o&&i.jsxs("button",{className:"md:hidden w-full mb-6 px-4 py-3 bg-yellow-600 text-white rounded-lg flex items-center justify-center",onClick:oe,"aria-expanded":H,children:[i.jsx(oa,{className:"w-4 h-4 mr-2"}),H?"Close Filters":"Filters"]}),i.jsxs("div",{className:"flex flex-col lg:flex-row lg:gap-6",children:[i.jsx(XS,{dateFieldLabel:"Date",activeDateFilter:se,onDateFilterChange:ya,filterKeys:t,searchableFilters:d,filtersData:q,activeFilters:w,handleFilterChange:Ae,toggleSavedJobsFilter:me,showOnlySaved:ne,savedJobs:Q}),O?i.jsx(Ab,{}):i.jsxs("div",{className:"lg:gap-6",children:[i.jsx(zb,{viewMode:G,onToggleViewMode:De,selectedItemsPerPage:$,onItemsPerPageChange:Wt,totalCount:p.length,startIndex:Le,endIndex:Be,title:"Latest News"}),i.jsxs("div",{className:"",children:[i.jsx("div",{className:"mb-6",children:i.jsxs("div",{className:"flex flex-row items-center justify-between",children:[i.jsxs("h3",{className:"text-xl font-semibold text-gray-900 flex items-center",children:[ne?"Saved Jobs":"Open Positions",se!=="all"&&!ne&&i.jsxs("span",{className:"text-sm font-normal text-gray-500 ml-2",children:["(",se.replace(/_/g," "),")"]})]}),i.jsxs("p",{className:"text-sm text-gray-600",children:[i.jsx("span",{className:"font-semibold text-gray-900",children:p.length})," found"]})]})}),i.jsx(bN,{items:pa,cardType:c,viewMode:G,savedJobs:Q,onSaveJob:Fe,onViewJob:_t,firstItemRef:Je}),p.length>0&&i.jsx("div",{className:"mt-6",children:i.jsx(Tb,{currentPage:g,totalPages:Ve,onPageChange:zi})})]}),_e.length>0&&i.jsx("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-5",children:i.jsx(CN,{jobs:_e,onViewJob:_t})})]}),i.jsx("div",{className:"hidden lg:block lg:w-1/4 space-y-6",children:((Ri=a==null?void 0:a.sidebar)==null?void 0:Ri.enabled)&&i.jsxs("div",{className:"sticky top-4",children:[i.jsx(So,{position:"sidebar",url:a.sidebar.url,link:a.sidebar.link,alt:a.sidebar.alt}),i.jsx(Ib,{api_url:h}),i.jsxs("div",{className:"mt-6 bg-white rounded-lg shadow-sm border border-gray-200 p-5",children:[i.jsx("h3",{className:"font-semibold text-lg mb-3",children:"Featured Employers"}),i.jsx("div",{className:"grid grid-cols-3 gap-2",children:[...Array(6)].map((P,F)=>i.jsx("div",{className:"flex items-center justify-center p-2 bg-gray-50 rounded-md",children:i.jsx("img",{src:`/placeholder.svg?height=40&width=40&text=${String.fromCharCode(65+F)}`,alt:`Featured employer ${F+1}`,className:"w-10 h-10 object-contain"})},F))})]})]})})]})]})]}),i.jsx(ZS,{activeDateFilter:se,handleDateFilterChange:ya,filterKeys:t,searchableFilters:d,dateFieldLabel:l,activeFilters:w,handleFilterChange:Ae,toggleSavedJobsFilter:me,filtersData:q,savedJobs:Q,showOnlySaved:ne,isMobileFilterOpen:H,toggleMobileFilter:oe}),i.jsx(GS,{savedJobsCount:Q.length}),i.jsx(ES,{open:_.open,type:_.type,message:_.message,onClose:()=>E(P=>({...P,open:!1}))}),i.jsx(q_,{open:He,onOpenChange:Pt,onSubscriptionSuccess:qe,apiUrl:h})]})},__=()=>i.jsx("div",{children:i.jsx("h2",{children:"Welcome to the Header!"})}),z_=({article:n,isBookmarked:e,onToggleBookmark:t,onShare:a,layout:o="card"})=>{const[c,s]=b.useState(!1),l=p=>{const k=new Date(p),m=Math.floor((new Date().getTime()-k.getTime())/(1e3*60*60));return m<1?"Just now":m<24?`${m}h ago`:m<48?"Yesterday":k.toLocaleDateString("en-US",{month:"short",day:"numeric"})},d=p=>p>=1e3?`${(p/1e3).toFixed(1)}k`:p.toString(),h=p=>p.length>1?p[1]:p[0],y=(p,k)=>p.length<=k?p:p.substring(0,k).trim()+"...",u=o==="grid"?"flex flex-col":"flex flex-col md:flex-row md:items-center";return i.jsxs("article",{className:`
|
|
7801
7801
|
news-grid bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden
|
|
7802
7802
|
hover:shadow-md transition-shadow duration-300 ${u}
|
|
7803
7803
|
`,children:[i.jsxs("div",{className:`relative ${o==="list"?"md:w-1/3 md:flex-shrink-0":""}`,children:[i.jsx("img",{src:n.image||"/placeholder.svg?height=200&width=400&text=News",alt:n.title,className:`w-full h-48 object-cover transition-opacity duration-300 ${c?"opacity-100":"opacity-0"} ${o==="list"?"md:h-32":""}`,onLoad:()=>s(!0)}),!c&&i.jsx("div",{className:"absolute inset-0 bg-gray-200 animate-pulse flex items-center justify-center",children:i.jsx("div",{className:"w-12 h-12 text-gray-400",children:"📰"})}),i.jsxs("div",{className:"absolute top-3 left-3 flex flex-wrap gap-1",children:[n.isBreaking&&i.jsx("span",{className:"px-2 py-1 bg-red-500 text-white text-xs font-semibold rounded animate-pulse",children:"BREAKING"}),n.isTrending&&i.jsxs("span",{className:"px-2 py-1 bg-orange-500 text-white text-xs font-semibold rounded flex items-center",children:[i.jsx(yo,{className:"w-3 h-3 mr-1"}),"TRENDING"]})]}),i.jsx("button",{onClick:()=>t(n._id),className:`absolute top-3 right-3 p-2 rounded-full transition-colors ${e?"bg-yellow-500 text-white":"bg-white text-gray-600 hover:bg-gray-100"}`,"aria-label":e?"Remove bookmark":"Add bookmark",children:i.jsx(aa,{className:`w-4 h-4 ${e?"fill-current":""}`})})]}),i.jsxs("div",{className:`p-4 ${o==="list"?"md:w-2/3":""}`,children:[i.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:n.categories.slice(0,2).map((p,k)=>i.jsx("a",{href:`?category=${p}`,children:i.jsx("span",{className:"px-2 py-1 bg-yellow-100 text-yellow-800 text-xs font-medium rounded-full",children:p},k)}))}),i.jsx("h2",{className:"text-lg font-semibold text-gray-900 mb-2 line-clamp-2 hover:text-yellow-600 transition-colors",children:i.jsx("a",{href:n.link,target:"_blank",rel:"noopener noreferrer",children:n.title})}),i.jsx("p",{className:"text-sm text-gray-700 mb-3 line-clamp-3",children:y(n.content,o==="list"?150:200)}),i.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-500 mb-3",children:[i.jsxs("div",{className:"flex items-center space-x-4",children:[i.jsxs("span",{children:["By ",h(n.author)]}),i.jsx("span",{children:n.company})]}),i.jsxs("div",{className:"flex items-center space-x-3",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx(na,{className:"w-4 h-4 mr-1"}),i.jsxs("span",{children:[n.readTime,"m read"]})]}),i.jsxs("div",{className:"flex items-center",children:[i.jsx(Ki,{className:"w-4 h-4 mr-1"}),i.jsx("span",{children:d(n.viewCount||0)})]})]})]}),i.jsx("div",{className:"flex flex-wrap gap-1 mb-3",children:n.tags.slice(0,3).map((p,k)=>i.jsxs("span",{className:"px-2 py-1 bg-gray-100 text-gray-600 text-xs rounded",children:["#",p]},k))}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-sm text-gray-500",children:l(n.date)}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx("button",{onClick:()=>a(n),className:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-full transition-colors","aria-label":"Share article",children:i.jsx(so,{className:"w-4 h-4"})}),i.jsxs("a",{href:n.link,target:"_blank",rel:"noopener noreferrer",className:"flex items-center px-3 py-1.5 bg-yellow-600 text-white text-sm font-medium rounded-lg hover:bg-yellow-700 transition-colors",children:["Read More",i.jsx(Yi,{className:"w-3 h-3 ml-1"})]})]})]})]})]})},T_=({apiUrl:n="http://localhost:5000/api/news",filterKeys:e=["categories","author","company"],searchableFilters:t=["company","author","categories"],defaultFilters:a={categories:[],tags:[],authors:[],companies:[],dateRange:["",""],readTime:[0,999]},defaultSort:o="latest",bookmarkStorageKey:c="news-bookmarks",itemsPerPage:s=12,dateFieldLabel:l="Published"})=>{const[d,h]=b.useState([]),[y,u]=b.useState([]),[p,k]=b.useState([]),[f,m]=b.useState({}),[g,x]=b.useState(""),[w,L]=b.useState({}),[S,C]=b.useState(!1),[q,I]=b.useState(s),[A,j]=b.useState(new Set);b.useState(o);const[R,U]=b.useState("grid"),[H,V]=b.useState(1),[$,K]=b.useState([]),[G,te]=b.useState(!1),[Q,ve]=b.useState([]),[ne,ce]=b.useState([]),[_e,B]=b.useState(!0),[O,X]=b.useState("all"),[ye,ge]=b.useState(""),se=T=>T.trim().toLowerCase().replace(/\s+/g,"-"),[rt,He]=b.useState(a),[Pt,Ot]=b.useState(null);b.useEffect(()=>{const T=localStorage.getItem(c);T&&j(new Set(JSON.parse(T)))},[c]),b.useEffect(()=>{const T=new URLSearchParams(window.location.search),W={};e.forEach(De=>{const Fe=T.get(De);Fe&&(W[De]=Fe)}),L(W);const oe=T.get("q"),Le=T.get("categories");let Be=[...d];if(oe&&(Be=Be.filter(De=>De.title.toLowerCase().includes(oe.toLowerCase())),x(oe),Et(oe)),Le){const De=Le.trim().toLowerCase().replace(/\s+/g,"-");He(Fe=>({...Fe,categories:[De]})),Be=Be.filter(Fe=>Fe.categories.some(_t=>se(_t)===De))}k(Be);const Wt={};e.forEach(De=>{const Fe=T.get(De);Fe&&(Wt[De]=Fe)}),L(Wt)},[d]),b.useEffect(()=>{const W=new URLSearchParams(window.location.search).get("date_filter");if(W&&W!=="all"){X(W);const oe=ot(d,w,Q,W);u(oe),V(1),Xe(oe)}},[d]);const Et=T=>{if(!T.trim())return;const W=[...Q,T.trim()];ve(W);const oe=ot(d,w,W,O);u(oe),V(1),Xe(oe),x("")},Xe=T=>{const W=fo(T,e);m(W)},z=T=>{X(T),_(T),$S(T)},_=T=>{const W=ot(d,w,Q,T);u(W),V(1),Xe(W)};b.useEffect(()=>{localStorage.setItem(c,JSON.stringify(Array.from(A)))},[A,c]),b.useEffect(()=>{B(!0),Ot(null),(async()=>{try{const W=await fetch(n);if(!W.ok)throw new Error(`API responded with status: ${W.status}`);const oe=await W.json();if(!Array.isArray(oe))throw new Error("Expected an array but received: "+typeof oe);const Le=oe.map(me=>({...me,categories:Array.isArray(me.categories)?me.categories:[],topTag:gN(me.title||"")})),Be={};for(const me of Le){const Ve=me.topTag;Ve&&(Be[Ve]=(Be[Ve]||0)+1)}const Wt=Object.entries(Be).sort((me,Ve)=>Ve[1]-me[1]).slice(0,10).map(([me])=>me);ce(Wt);const De=new Set;Le.forEach(me=>{me.categories.forEach(Ve=>{De.add(se(Ve))})});const Fe=Array.from(De).map(me=>({id:me,name:me.replace(/-/g," ").replace(/\b\w/g,Ve=>Ve.toUpperCase()),icon:"📰",count:Le.filter(Ve=>Ve.categories.some(pa=>se(pa)===me)).length,color:"bg-gray-100 text-gray-800"}));h(Le),u(Le),k(Le),K(Fe);const _t=fo(Le,e);m(_t)}catch(W){console.error("Failed to fetch articles",W)}finally{B(!1)}})()},[n]);const E=()=>{U(R==="grid"?"list":"grid")};b.useMemo(()=>d.filter(T=>T.isTrending).slice(0,6),[d]),b.useMemo(()=>d.filter(T=>T.isBreaking),[d]);const he=Math.ceil(y.length/s),le=y.slice((H-1)*q,H*q),Ae=T=>{j(W=>{const oe=new Set(W);return oe.has(T)?oe.delete(T):oe.add(T),oe})},qe=T=>{navigator.share?navigator.share({title:T.title,text:T.title,url:T.link}):(navigator.clipboard.writeText(T.link),alert("Article link copied to clipboard!"))},Je=()=>{te(!G)},zi=y.length===0?0:(H-1)*q+1,ya=Math.min(H*q,y.length),ni=()=>{He({categories:[],tags:[],authors:[],companies:[],dateRange:["",""],readTime:[0,999]}),V(1);const T=ot(d,w,Q,O);u(T),V(1),Xe(T)},Ut=()=>{L({}),ve([]),X("all"),ni(),u(d),V(1),Xe(d)},gt=b.useRef(null),Ti=T=>{V(T),setTimeout(()=>{var W;(W=gt.current)==null||W.scrollIntoView({behavior:"smooth",block:"start"})},100)},ii=T=>{I(T),V(1)},Gt=(T,W)=>{L(oe=>{const Le={...oe};W?Le[T]=W:delete Le[T];const Be=ot(d,Le,Q,O);return u(Be),V(1),Xe(Be),Le})},ua=T=>{const W=Q.filter(Le=>Le!==T);ve(W);const oe=ot(d,w,W,O);u(oe),V(1),Xe(oe)};return i.jsxs("div",{className:"flex flex-col min-h-screen pb-16 md:pb-0",children:[i.jsxs("div",{className:"flex-grow",children:[i.jsx(Nb,{onSearchChange:T=>{const W=d.filter(oe=>oe.title.toLowerCase().includes(T.toLowerCase()));k(W),x(T)},title:"Latest News",popularTags:ne,generateHref:T=>`/news?q=${T.replace(/\s+/g,"+")}`}),i.jsxs("div",{className:"container mx-auto py-8 pb-20 md:pb-8",children:[i.jsxs("div",{className:"relative",children:[i.jsxs("div",{className:"relative flex items-center gap-2 sm:my-6 my-2",children:[i.jsx(qb,{data:d.map(T=>T.title),onSelect:T=>{Et(T)},onTyping:T=>{C(!!T),T||(k(d),x(""))},placeholder:"Search news, topics, or authors...",showSubmitButton:!0,className:"w-full"}),i.jsx("button",{className:"block md:hidden flex items-center justify-center p-3 bg-white border-2 border-gray-200 text-gray-700 rounded-xl hover:border-gray-300 hover:bg-gray-50 transition-all duration-200 focus:ring-4 focus:ring-gray-200 focus:outline-none hover:scale-105",onClick:Je,children:i.jsx(oa,{size:16,className:"mr-1.5"})}),g&&i.jsxs("div",{className:"flex gap-2 mt-3 px-4 sm:px-6 lg:px-8",children:[i.jsxs("span",{className:"bg-yellow-100 text-indigo-800 rounded-full px-3 py-1 text-sm flex items-center",children:[g,i.jsx("button",{onClick:()=>{k(d),x("")},className:"ml-2 text-indigo-600 hover:text-indigo-800",children:"×"})]}),i.jsx("button",{className:"text-sm text-gray-600 hover:underline",onClick:()=>{k(d),x("")},children:"Clear Search"})]})]}),i.jsx("div",{className:"max-w-7xl mx-auto md:pb-8",children:i.jsx("div",{className:"block w-full",children:i.jsx("div",{className:"relative flex items-center gap-2 sm:my-6 my-2",children:i.jsx(_b,{filters:[...ye?[{key:"categories",label:"Categories",value:ye.replace(/-/g," "),onRemove:()=>ge("")}]:[],...Q.map(T=>({key:"search",label:"",value:T,onRemove:()=>ua(T)})),...Object.entries(w).map(([T,W])=>({key:T,label:T.replace(/_/g," "),value:W,onRemove:()=>Gt(T,"")}))],onClearAll:Ut})})})})]}),i.jsx("main",{className:"max-w-7xl mx-auto px-4 pb-8 sm:px-6 lg:px-8",children:i.jsxs("div",{className:"flex flex-col lg:flex-row lg:gap-6",children:[i.jsx(XS,{dateFieldLabel:"Date",activeDateFilter:O,onDateFilterChange:z,filterKeys:e,searchableFilters:t,filtersData:f,activeFilters:w,handleFilterChange:Gt,toggleSavedJobsFilter:()=>console.log("toggle saved jobs filter"),showOnlySaved:!1,savedJobs:[]}),_e?i.jsx(Ab,{}):i.jsx(i.Fragment,{children:i.jsxs("div",{className:"lg:w-2/4",children:[i.jsx(zb,{viewMode:R,onToggleViewMode:E,selectedItemsPerPage:q,onItemsPerPageChange:ii,totalCount:y.length,startIndex:zi,endIndex:ya,title:"Latest News"}),y.length>0?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:R==="grid"?"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-2 gap-6":"space-y-6",children:le.map((T,W)=>i.jsx("div",{ref:W===0?gt:null,children:i.jsx(z_,{article:T,isBookmarked:A.has(T._id),onToggleBookmark:Ae,onShare:qe,layout:R})},T._id))}),he>1&&i.jsx("div",{className:"mt-8 flex justify-center",children:i.jsx(Tb,{currentPage:H,totalPages:he,onPageChange:Ti})})]}):i.jsxs("div",{className:"text-center py-12",children:[i.jsx(gi,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),i.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No articles found"}),i.jsx("p",{className:"text-gray-600 mb-4",children:"Try adjusting your search criteria or filters to find more articles."}),i.jsx("button",{onClick:Ut,className:"px-4 py-2 bg-yellow-600 text-white rounded-lg hover:bg-yellow-700 transition-colors",children:"Clear All Filters"})]})]})}),i.jsx("div",{className:"hidden lg:block lg:w-1/4 space-y-6",children:i.jsxs("div",{className:"sticky top-4",children:[i.jsx(So,{position:"sidebar",url:"https://video-previews.elements.envatousercontent.com/h264-video-previews/e08912ad-6856-4e36-89b5-cf1465cc79cb/32651312.mp4",link:"",alt:""}),i.jsx(Ib,{api_url:""}),i.jsxs("div",{className:"mt-6 bg-white rounded-lg shadow-sm border border-gray-200 p-5",children:[i.jsx("h3",{className:"font-semibold text-lg mb-3",children:"Featured Employers"}),i.jsx("div",{className:"grid grid-cols-3 gap-2",children:[...Array(6)].map((T,W)=>i.jsx("div",{className:"flex items-center justify-center p-2 bg-gray-50 rounded-md",children:i.jsx("img",{src:`/placeholder.svg?height=40&width=40&text=${String.fromCharCode(65+W)}`,alt:`Featured employer ${W+1}`,className:"w-10 h-10 object-contain"})},W))})]})]})})]})})]})]}),i.jsx(ZS,{activeDateFilter:O,handleDateFilterChange:z,filterKeys:e,searchableFilters:t,dateFieldLabel:l,activeFilters:w,handleFilterChange:Gt,filtersData:f,isMobileFilterOpen:G,toggleMobileFilter:Je})]})},Ho=[{id:"1",title:"Introduction to iGaming",description:"Gain a comprehensive and practical overview of the iGaming industry with this all-encompassing course. Perfect for beginners looking to understand the fundamentals.",instructor:"Sarah Johnson",price:299,originalPrice:399,currency:"EUR",duration:"8 hours",level:"Beginner",category:"fundamentals",subcategory:"intro-igaming",rating:4.8,reviewCount:1247,enrollmentCount:5420,thumbnail:"/placeholder.svg?height=200&width=300&text=iGaming+Intro",tags:["iGaming","Fundamentals","Industry Overview"],features:["Lifetime Access","Certificate","Mobile Access"],lastUpdated:"2024-01-15",language:"English",certificate:!0,accessType:"Lifetime",isFeatured:!0,isNew:!1,isBestseller:!0},{id:"2",title:"Payments & Banking in Gaming Masterclass",description:"Master the complex world of payment processing, banking regulations, and financial compliance in the iGaming industry.",instructor:"Michael Chen",price:699,currency:"EUR",duration:"12 hours",level:"Advanced",category:"business",subcategory:"payments-banking",rating:4.9,reviewCount:892,enrollmentCount:2156,thumbnail:"/placeholder.svg?height=200&width=300&text=Payments+Banking",tags:["Payments","Banking","Compliance","FinTech"],features:["Lifetime Access","Certificate","Expert Support"],lastUpdated:"2024-02-20",language:"English",certificate:!0,accessType:"Lifetime",isFeatured:!0,isNew:!0,isBestseller:!1},{id:"3",title:"The Psychology of Gambling Addiction",description:"Gain insight into the psychological reasons behind gambling, the nature of addiction, and the scientific aspects of the challenges players encounter.",instructor:"Dr. Emma Rodriguez",price:449,currency:"EUR",duration:"6 hours",level:"Intermediate",category:"responsible-gaming",subcategory:"addiction-psychology",rating:4.7,reviewCount:634,enrollmentCount:1890,thumbnail:"/placeholder.svg?height=200&width=300&text=Psychology+Addiction",tags:["Psychology","Addiction","Player Behavior","Mental Health"],features:["Lifetime Access","Certificate","Case Studies"],lastUpdated:"2024-01-30",language:"English",certificate:!0,accessType:"Lifetime",isFeatured:!1,isNew:!1,isBestseller:!0},{id:"4",title:"AI in Gaming & Betting",description:"Explore the cutting-edge applications of artificial intelligence in gaming platforms, player analytics, and betting algorithms.",instructor:"Alex Thompson",price:599,currency:"EUR",duration:"10 hours",level:"Advanced",category:"technology",subcategory:"game-development",rating:4.6,reviewCount:445,enrollmentCount:1234,thumbnail:"/placeholder.svg?height=200&width=300&text=AI+Gaming",tags:["AI","Machine Learning","Analytics","Technology"],features:["Lifetime Access","Certificate","Code Examples"],lastUpdated:"2024-03-01",language:"English",certificate:!0,accessType:"Lifetime",isFeatured:!0,isNew:!0,isBestseller:!1},{id:"5",title:"Slot Academy LIVE!",description:"Interactive live sessions covering slot game mechanics, RTP calculations, and game design principles with industry experts.",instructor:"Gaming Academy Team",price:1500,currency:"EUR",duration:"20 hours",level:"Advanced",category:"specialized",subcategory:"slot-mechanics",rating:4.9,reviewCount:156,enrollmentCount:423,thumbnail:"/placeholder.svg?height=200&width=300&text=Slot+Academy",tags:["Slots","Game Mechanics","Live Training","RTP"],features:["Live Sessions","Certificate","Expert Mentoring"],lastUpdated:"2024-02-15",language:"English",certificate:!0,accessType:"Limited",isFeatured:!0,isNew:!1,isBestseller:!1},{id:"6",title:"English Language for IGaming & Betting",description:"Specialized English language course designed for non-native speakers working in the iGaming and betting industry.",instructor:"Linda Parker",price:300,currency:"EUR",duration:"15 hours",level:"Beginner",category:"specialized",subcategory:"industry-overview",rating:4.5,reviewCount:789,enrollmentCount:2890,thumbnail:"/placeholder.svg?height=200&width=300&text=English+iGaming",tags:["English","Language","Communication","Industry Terms"],features:["Lifetime Access","Certificate","Audio Lessons"],lastUpdated:"2024-01-10",language:"Multiple",certificate:!0,accessType:"Lifetime",isFeatured:!1,isNew:!1,isBestseller:!0},{id:"7",title:"VIP and Premium Service Masterclass",description:"Learn how to deliver exceptional VIP experiences and premium customer service in the competitive iGaming landscape.",instructor:"Robert Williams",price:499,currency:"EUR",duration:"8 hours",level:"Intermediate",category:"business",subcategory:"vip-management",rating:4.8,reviewCount:567,enrollmentCount:1456,thumbnail:"/placeholder.svg?height=200&width=300&text=VIP+Service",tags:["VIP","Customer Service","Premium","Hospitality"],features:["Lifetime Access","Certificate","Templates"],lastUpdated:"2024-02-05",language:"English",certificate:!0,accessType:"Lifetime",isFeatured:!0,isNew:!1,isBestseller:!1},{id:"8",title:"Fundamentals of CRM for Online Gaming",description:"Master customer relationship management strategies specifically tailored for online gaming and betting platforms.",instructor:"Maria Garcia",price:425,currency:"EUR",duration:"9 hours",level:"Intermediate",category:"business",subcategory:"crm-customer-service",rating:4.7,reviewCount:423,enrollmentCount:1123,thumbnail:"/placeholder.svg?height=200&width=300&text=CRM+Gaming",tags:["CRM","Customer Management","Gaming","Analytics"],features:["Lifetime Access","Certificate","CRM Tools"],lastUpdated:"2024-01-25",language:"English",certificate:!0,accessType:"Lifetime",isFeatured:!1,isNew:!1,isBestseller:!0}],R_=({courses:n,onSearchResults:e,onTyping:t,placeholder:a="Search courses, instructors, or topics..."})=>{const[o,c]=b.useState(""),[s,l]=b.useState([]),[d,h]=b.useState(!1);b.useEffect(()=>{if(o.length>0){const k=n.filter(x=>{var L,S,C,q,I;const w=o.toLowerCase();return x.title.toLowerCase().includes(w)||((L=x.description)==null?void 0:L.toLowerCase().includes(w))||((S=x.instructor)==null?void 0:S.toLowerCase().includes(w))||((C=x.tags)==null?void 0:C.some(A=>A.toLowerCase().includes(w)))||((q=x.category)==null?void 0:q.toLowerCase().includes(w))||((I=x.subcategory)==null?void 0:I.toLowerCase().includes(w))});e(k);const f=n.filter(x=>x.title.toLowerCase().includes(o.toLowerCase())).map(x=>x.title).slice(0,3),m=n.flatMap(x=>x.tags??[]).filter(x=>x.toLowerCase().includes(o.toLowerCase())).filter((x,w,L)=>L.indexOf(x)===w).slice(0,3),g=n.filter(x=>x.instructor?x.instructor.toLowerCase().includes(o.toLowerCase()):!1).map(x=>x.instructor).filter((x,w,L)=>L.indexOf(x)===w).slice(0,2);l([...f,...m,...g]),h(!0)}else e(n),l([]),h(!1)},[o,n,e]);const y=k=>{c(k),t==null||t(k.length>0,k)},u=k=>{c(k),h(!1)},p=()=>{c(""),h(!1),t==null||t(!1,"")};return i.jsxs("div",{className:"course-search relative",children:[i.jsxs("div",{className:"relative",children:[i.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:i.jsx(mt,{className:"h-5 w-5 text-gray-400"})}),i.jsx("input",{type:"text",value:o,onChange:k=>y(k.target.value),onFocus:()=>h(s.length>0),onBlur:()=>setTimeout(()=>h(!1),200),className:"block w-full pl-10 pr-10 py-3 border border-gray-300 rounded-lg bg-white shadow-sm focus:outline-none focus:ring-2 focus:ring-yellow--500 focus:border-yellow--500 text-gray-900 placeholder-gray-500",placeholder:a}),o&&i.jsx("button",{onClick:p,className:"absolute inset-y-0 right-0 pr-3 flex items-center",children:i.jsx(wt,{className:"h-5 w-5 text-gray-400 hover:text-gray-600"})})]}),d&&s.length>0&&i.jsx("div",{className:"absolute z-10 w-full mt-1 bg-white border border-gray-200 rounded-lg shadow-lg",children:i.jsx("ul",{className:"py-1",children:s.map((k,f)=>i.jsx("li",{children:i.jsx("button",{onClick:()=>u(k),className:"w-full px-4 py-2 text-left text-sm text-gray-700 hover:bg-gray-100 focus:bg-gray-100 focus:outline-none",children:i.jsxs("div",{className:"flex items-center",children:[i.jsx(mt,{className:"h-4 w-4 text-gray-400 mr-2"}),k]})})},f))})}),o&&i.jsxs("div",{className:"mt-2 text-sm text-gray-600",children:['Search results for "',o,'"']})]})},H_=({title:n,subtitle:e,placeholder:t,courses:a=[],onSearchResults:o})=>i.jsx("section",{className:"py-16 bg-gradient-to-r from-[#0f1219] to-[#1a2236] text-white relative overflow-hidden",children:i.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[i.jsxs("div",{className:"text-center mb-8",children:[i.jsxs("h2",{className:"text-4xl font-bold text-white mb-4",children:[n||"Master the ",i.jsx("span",{className:"bg-gradient-accent bg-clip-text text-transparent",children:"IGaming Industry"})]}),i.jsx("p",{className:"text-xl text-indigo-100 max-w-2xl mx-auto",children:e||"Learn from industry experts and advance your career with our comprehensive course catalog"})]}),i.jsx("div",{className:"hidden lg:block max-w-2xl mx-auto",children:a&&o&&i.jsx(R_,{courses:a,onSearchResults:o,placeholder:t||"Search IGaming courses, instructors, or topics..."})})]})}),D_=({categories:n,selectedCategory:e,selectedSubcategory:t,onCategorySelect:a,onSubcategorySelect:o})=>{const[c,s]=b.useState(new Set),l=h=>{const y=new Set(c);y.has(h)?y.delete(h):y.add(h),s(y)},d=h=>{l(h),a(h)};return i.jsxs("nav",{className:"course-navigation bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[i.jsx("h2",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Course Categories"}),i.jsx("div",{className:"space-y-2",children:n.map(h=>{const y=c.has(h.id),u=e===h.id;return i.jsxs("div",{className:"category-group",children:[i.jsxs("button",{onClick:()=>d(h.id),className:`
|
package/dist/index.mjs
CHANGED
|
@@ -40441,7 +40441,12 @@ const N_ = 6, K_ = ({
|
|
|
40441
40441
|
return k(ue), x(1), le(ue), ie;
|
|
40442
40442
|
});
|
|
40443
40443
|
}, Ne = () => {
|
|
40444
|
-
Gt(!0),
|
|
40444
|
+
Gt(!0), W().then(
|
|
40445
|
+
() => (
|
|
40446
|
+
// Close the modal after successful subscription
|
|
40447
|
+
zt(!1)
|
|
40448
|
+
)
|
|
40449
|
+
);
|
|
40445
40450
|
}, Je = Io(null), Ti = (P) => {
|
|
40446
40451
|
x(P), setTimeout(() => {
|
|
40447
40452
|
var F;
|
package/package.json
CHANGED