@igamingcareer/igaming-components 1.0.16 → 1.0.17
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 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7759,7 +7759,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
7759
7759
|
hover:text-primary-500 relative`,children:[a.jsx(ui,{className:"w-6 h-6"}),a.jsx("span",{className:"text-xs mt-1",children:"Saved"}),o>0&&a.jsx("span",{className:`absolute -top-1 -right-1 bg-primary-500 text-white rounded-full
|
|
7760
7760
|
w-5 h-5 flex items-center justify-center text-xs`,children:o})]}),a.jsxs("a",{href:"/profile",className:`flex flex-col items-center justify-center text-gray-600 dark:text-gray-400
|
|
7761
7761
|
hover:text-primary-500`,children:[a.jsx(zi,{className:"w-6 h-6"}),a.jsx("span",{className:"text-xs mt-1",children:"Profile"})]}),a.jsxs("button",{className:`flex flex-col items-center justify-center text-gray-600 dark:text-gray-400
|
|
7762
|
-
hover:text-primary-500`,children:[a.jsx(b2,{className:"w-6 h-6"}),a.jsx("span",{className:"text-xs mt-1",children:"More"})]})]})}),XI=({activeDateFilter:o,handleDateFilterChange:e,filterKeys:r,searchableFilters:i,dateFieldLabel:n,activeFilters:c,handleFilterChange:s,toggleSavedJobsFilter:l,filtersData:d,savedJobs:h,showOnlySaved:y,isMobileFilterOpen:p,toggleMobileFilter:u,dateOptions:k=[{value:"all",label:"All Time"},{value:"today",label:"Today"},{value:"this_week",label:"This Week"},{value:"this_month",label:"This Month"},{value:"last_30_days",label:"Last 30 Days"},{value:"last_90_days",label:"Last 90 Days"}]})=>a.jsx("div",{children:a.jsxs("div",{className:p?"block":"hidden",children:[a.jsx("div",{className:"fixed inset-0 bg-gray-600 bg-opacity-75 z-40",onClick:()=>u(!p)}),a.jsxs("div",{className:"fixed inset-y-0 right-0 max-w-xs w-full bg-white shadow-xl z-50 overflow-y-auto",children:[a.jsxs("div",{className:"p-4 border-b border-gray-200 flex items-center justify-between",children:[a.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"Filters"}),a.jsx("button",{onClick:()=>u(!p),className:"p-2 rounded-full hover:bg-gray-100","aria-label":"Close filters",children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6 text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"p-4",children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium text-gray-900 mb-2",children:n}),a.jsx(vC,{activeDateFilter:o,onDateFilterChange:e,dateFieldLabel:"",options:k})]}),r.map(x=>{var m;return a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium text-gray-900 mb-2",children:x.replace(/_/g," ")}),i.includes(x)?a.jsx(LM,{options:d[x]||[],value:c[x]||"",onChange:f=>s(x,f),placeholder:`Select ${x.replace(/_/g," ")}`,className:"w-full"}):a.jsxs("select",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-indigo-500 focus:border-indigo-500 bg-white",value:c[x]||"",onChange:f=>s(x,f.target.value),children:[a.jsxs("option",{value:"",children:["Select ",x.replace(/_/g," ")]}),(m=d[x])==null?void 0:m.map(f=>a.jsx("option",{value:f,children:f},f))]})]},x)}),a.jsx("div",{className:"mt-6",children:a.jsxs("button",{onClick:l,className:`w-full px-4 py-2 rounded-lg flex items-center justify-center ${y?"bg-indigo-100 text-indigo-800":"bg-gray-100 text-gray-800 hover:bg-gray-200"}`,children:[a.jsx(_t,{size:16,className:"mr-2"}),a.jsxs("span",{children:["Saved Jobs (",h.length,")"]})]})}),a.jsx("div",{className:"mt-6 pt-6 border-t border-gray-200",children:a.jsx("button",{onClick:()=>u(!p),className:"w-full py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition-colors",children:"Apply Filters"})})]})]})]})}),MC=({totalColumns:o=2})=>a.jsx("div",{className:"flex-grow p-8",children:a.jsx("div",{className:"max-w-7xl mx-auto",children:a.jsxs("div",{className:"animate-pulse",children:[a.jsx("div",{className:"h-8 bg-gray-200 rounded w-1/4 mb-6"}),a.jsx("div",{className:`grid grid-cols-1 md:grid-cols-${o} gap-6`,children:[...Array(4)].map((e,r)=>a.jsxs("div",{className:"bg-white rounded-lg shadow-sm p-6",children:[a.jsx("div",{className:"h-6 bg-gray-200 rounded w-3/4 mb-4"}),a.jsx("div",{className:"h-4 bg-gray-200 rounded w-1/2 mb-2"}),a.jsx("div",{className:"h-4 bg-gray-200 rounded w-1/3 mb-4"}),a.jsx("div",{className:"h-20 bg-gray-200 rounded mb-4"}),a.jsx("div",{className:"h-8 bg-gray-200 rounded w-full"})]},r))})]})})}),JI=({filteredItems:o})=>a.jsx("div",{className:"mb-6",children:a.jsxs("div",{className:"flex flex-row md:items-center justify-between",children:[a.jsx("h1",{className:"text-3xl font-bold text-gray-900 md:mb-0",children:"Job Listings"}),a.jsx("div",{className:"flex items-center",children:a.jsxs("p",{className:"text-gray-600 mr-4",children:[a.jsx("span",{className:"font-semibold text-gray-900",children:o.length})," jobs found"]})})]})}),YI=6,KI=({apiUrl:o,itemsPerPage:e=12,filterKeys:r,banner:i,enableSearch:n=!0,enableMobileFilter:c=!0,cardType:s,dateField:l="created_at",dateFieldLabel:d="Published",searchableFilters:h=["companies"],notification_url:y="http://localhost:5147"})=>{var tn;const[p,u]=b.useState([]),[k,x]=b.useState([]),[m,f]=b.useState(1),[g,M]=b.useState({}),[C,w]=b.useState([]),[j,I]=b.useState({}),[N,A]=b.useState(""),[L,O]=b.useState([]),[U,D]=b.useState(!1),[G,J]=b.useState(e),[H,B]=b.useState("grid"),[E,ne]=b.useState([]),[ie,he]=b.useState(!1),[z,F]=b.useState([]),[R,W]=b.useState(!0),[K,oe]=b.useState(null),[Q,Ae]=b.useState("all"),[vt,ht]=b.useState({jobTypes:[],experienceLevels:[],country:"",minSalary:"",maxSalary:"",city:""}),[ii,ni]=b.useState({open:!1,type:"info",message:""}),oi=(S,_)=>{ni({open:!0,type:S,message:_})};b.useEffect(()=>{try{const S=localStorage.getItem("savedJobs");S&&ne(JSON.parse(S));const _=localStorage.getItem("lastVisitedJobs");_&&F(JSON.parse(_))}catch(S){console.error("Error loading data from localStorage:",S)}},[]),b.useEffect(()=>{const _=new URLSearchParams(window.location.search).get("date_filter");if(_&&_!=="all"){Ae(_);const T=Qe(p,g,C,_);x(T),f(1),Ke(T)}},[p]),b.useEffect(()=>{if(!o){oe("❌ Missing API URL for Listing component!"),W(!1);return}W(!0),oe(null),(async()=>{try{const _=await fetch(o);if(!_.ok)throw new Error(`API responded with status: ${_.status}`);const T=await _.json();if(!Array.isArray(T))throw new Error("Expected an array but received: "+typeof T);const Z=T.map((ee,xe)=>({...ee,sponsored:xe%7===0}));u(Z),x(Z);const X=yt(Z);I(X)}catch(_){console.error("Error fetching data:",_),oe(`Failed to load data: ${_ instanceof Error?_.message:String(_)}`);const T=UI(20);u(T),x(T);const Z=yt(T);I(Z)}finally{W(!1)}})()},[o]),b.useEffect(()=>{const S=new URLSearchParams(window.location.search),_={};r.forEach(X=>{const ee=S.get(X);ee&&(_[X]=ee)}),M(_);const T=S.get("q")||S.get("searchTerm")||"";T&&(A(T),jM(T));const Z={};r.forEach(X=>{const ee=S.get(X);ee&&(Z[X]=ee)}),M(Z)},[]);const CM=(S,_)=>{if(console.log("Applying date filter from URL:",S,_),_==="all")return S;const T=new Date,Z=new Date(T.getFullYear(),T.getMonth(),T.getDate());return S.filter(X=>{const ee=X[l]||X.created_at||X.published_at||X.scraped_at;if(!ee)return!1;const xe=new Date(ee);switch(_){case"today":return xe>=Z;case"this_week":{const ge=new Date(T);return ge.setDate(T.getDate()-T.getDay()),ge.setHours(0,0,0,0),xe>=ge}case"this_month":{const ge=new Date(T.getFullYear(),T.getMonth(),1);return xe>=ge}case"last_30_days":{const ge=new Date(T);return ge.setDate(T.getDate()-30),xe>=ge}case"last_90_days":{const ge=new Date(T);return ge.setDate(T.getDate()-90),xe>=ge}default:return!0}})},_2=(S,_)=>S.filter(T=>{var Z,X,ee,xe,ge;if(_.jobTypes.length>0){const be=((Z=T.department)==null?void 0:Z.toLowerCase())||"";if(!_.jobTypes.some(Gt=>be.includes(Gt)))return!1}if(_.experienceLevels.length>0){const be=((X=T.title)==null?void 0:X.toLowerCase())||"";if(!_.experienceLevels.some(Gt=>!!(Gt==="senior"&&be.includes("senior")||Gt==="mid"&&(be.includes("mid")||be.includes("mid-level"))||Gt==="entry"&&(be.includes("junior")||be.includes("entry")))))return!1}return!(_.country&&!(((ee=T.location)==null?void 0:ee.toLowerCase())||((xe=T.city)==null?void 0:xe.toLowerCase())||"").includes(_.country.toLowerCase())||_.city&&!(((ge=T.company_type)==null?void 0:ge.toLowerCase())||"").includes(_.city.toLowerCase()))});b.useEffect(()=>{if(ie){const S=p.filter(_=>E.includes(_.id||_.slug||_.link));x(S),f(1)}else{let S=p;S=Qe(S,g,C,Q),S=_2(S,vt),x(S)}},[ie,E,p,g,C,Q,vt]);const yt=S=>{const _={};S.forEach(Z=>{r.forEach(X=>{_[X]||(_[X]=new Set);const ee=Z[X];typeof ee=="string"&&ee.trim()!==""&&_[X].add(ee)})});const T={};return Object.keys(_).forEach(Z=>{T[Z]=Array.from(_[Z])}),T},Ke=S=>{const _=yt(S);I(_)},Mt=(S,_)=>{console.log("Filter changed:",S,_),M(T=>{const Z={...T};_?Z[S]=_:delete Z[S],ie&&he(!1);const X=Qe(p,Z,C,Q);return x(X),f(1),Ke(X),Z})},pt=S=>{Ae(S),ie&&he(!1);const _=Qe(p,g,C,S);x(_),f(1),Ke(_);const T=new URLSearchParams(window.location.search);S==="all"?T.delete("date_filter"):T.set("date_filter",S);const Z=`${window.location.pathname}?${T.toString()}`;window.history.replaceState({},"",Z)},Wi=S=>{if(A(S),S){const _=p.map(T=>T.title).filter((T,Z,X)=>T&&T.toLowerCase().includes(S.toLowerCase())&&X.indexOf(T)===Z).slice(0,5);O(_)}else O([])},jM=S=>{if(!S.trim())return;ie&&he(!1);const _=[...C,S.trim()];w(_);const T=Qe(p,g,_,Q);x(T),f(1),Ke(T),A("")},Et=()=>{const S=N.trim();if(!S)return;ie&&he(!1);const _=[...C,S];w(_);const T=Qe(p,g,_,Q);x(T),f(1),Ke(T),A("");const Z=new URLSearchParams(window.location.search);Z.set("q",S),Object.entries(g).forEach(([ee,xe])=>{xe&&Z.set(ee,xe)});const X=`${window.location.pathname}?${Z.toString()}`;window.history.replaceState({},"",X)},$i=S=>{S.key==="Enter"&&(S.preventDefault(),Et())},Xi=S=>{const _=C.filter(Z=>Z!==S);w(_);const T=Qe(p,g,_,Q);x(T),f(1),Ke(T)},Qe=(S,_,T,Z)=>{let X=S.filter(ee=>Object.entries(_).every(([xe,ge])=>{const be=ee[xe];return typeof be=="string"&&be.toLowerCase()===ge.toLowerCase()}));return T.length>0&&(X=X.filter(ee=>T.every(xe=>{var ge,be;return((ge=ee.title)==null?void 0:ge.toLowerCase().includes(xe.toLowerCase()))||((be=ee.overview)==null?void 0:be.toLowerCase().includes(xe.toLowerCase()))}))),X=CM(X,Z),X},Ji=()=>{ht({jobTypes:[],experienceLevels:[],country:"",minSalary:"",maxSalary:"",city:""});const S=Qe(p,g,C,Q);x(S),f(1),Ke(S)},wt=()=>{M({}),w([]),he(!1),Ae("all"),Ji(),x(p),f(1),Ke(p)},Yi=async()=>{const S=localStorage.getItem("email"),_=localStorage.getItem("leadId");if(!S||!_){oi("info","Please subscribe first to create alerts.");return}const T={jobTitle:g.title||"",location:g.city||"",techStack:g.company||""};try{await fetch(`http://localhost:5147/api/leads/${_}/preferences`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)}),oi("success","Alert created! We'll notify you about new matching jobs.")}catch(Z){console.error(Z),oi("error","Failed to create alert.")}},Ut=()=>{D(!U)},Ki=S=>{J(S),f(1)},z2=()=>{B(H==="grid"?"list":"grid")},SM=S=>{const _=S.id??S._id??S.slug??S.link;ne(T=>{const Z=T.includes(_);let X;Z?X=T.filter(ee=>ee!==_):X=[...T,_];try{localStorage.setItem("savedJobs",JSON.stringify(X))}catch(ee){console.error("Error saving to localStorage:",ee)}return X})},Qi=S=>{const _=S.id||S.slug||S.link;F(T=>{const Z=T.filter(ee=>(ee.id||ee.slug||ee.link)!==_),X=[S,...Z].slice(0,YI);try{localStorage.setItem("lastVisitedJobs",JSON.stringify(X))}catch(ee){console.error("Error saving to localStorage:",ee)}return X})},en=()=>{he(!ie)},IM=Math.ceil(k.length/G),AM=k.slice((m-1)*G,m*G);return K&&!p.length?a.jsx("div",{className:"flex-grow p-8",children:a.jsx("div",{className:"max-w-7xl mx-auto",children:a.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-800 rounded-lg p-6",children:[a.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Error Loading Jobs"}),a.jsx("p",{className:"mb-4",children:K}),a.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"})]})})}):a.jsxs("div",{className:"flex flex-col min-h-screen pb-16 md:pb-0",children:[a.jsx("div",{className:"flex-grow",children:a.jsxs("div",{className:"container mx-auto py-8 pb-20 md:pb-8",children:[a.jsx(JI,{filteredItems:k}),a.jsxs("div",{className:"relative",children:[a.jsxs("div",{className:"relative flex items-center gap-2 my-6",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:a.jsx(tt,{className:"h-4 w-4 text-indigo-500"})}),a.jsx("input",{type:"text",className:"text-sm sm:text-base lg:text-sm block w-full pl-10 pr-10 py-3 border border-gray-300 rounded-xl bg-white shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 text-gray-900",placeholder:"Search for jobs, companies, or keywords...",value:N,onChange:S=>Wi(S.target.value),onKeyDown:$i,list:"job-suggestions"}),a.jsx("button",{className:"absolute right-2 top-1/2 -translate-y-1/2 bg-indigo-500 text-white py-2 px-2 border-2 rounded-lg hover:bg-indigo-600 transition text-sm",onClick:Et,children:a.jsx(tt,{className:"h-4 w-4 text-white"})}),a.jsx("datalist",{id:"job-suggestions",children:L.map((S,_)=>a.jsx("option",{value:S},_))})]}),a.jsx("button",{className:"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:Ut,children:a.jsx(Tt,{size:16,className:"mr-1.5"})})]}),(C.length>0||Object.keys(g).length>0||Q!=="all")&&a.jsxs("div",{className:"m-4 flex flex-wrap gap-2",children:[Q!=="all"&&a.jsxs("div",{className:"inline-flex items-center bg-indigo-100 text-indigo-800 rounded-full px-3 py-1 text-sm",children:[a.jsxs("span",{className:"font-medium mr-1",children:[d,":"]}),a.jsx("span",{children:Q.replace(/_/g," ")}),a.jsx("button",{className:"ml-2 text-indigo-600 hover:text-indigo-800",onClick:()=>pt("all"),"aria-label":`Remove ${d} filter`,children:a.jsx(Ne,{size:14})})]}),C.map(S=>a.jsxs("div",{className:"inline-flex items-center bg-indigo-100 text-indigo-800 rounded-full px-3 py-1 text-sm",children:[a.jsx("span",{children:S}),a.jsx("button",{className:"ml-2 text-indigo-600 hover:text-indigo-800",onClick:()=>Xi(S),"aria-label":`Remove search filter ${S}`,children:a.jsx(Ne,{size:14})})]},`search-${S}`)),Object.entries(g).map(([S,_])=>a.jsxs("div",{className:"inline-flex items-center bg-indigo-100 text-indigo-800 rounded-full px-3 py-1 text-sm",children:[a.jsxs("span",{className:"font-medium mr-1",children:[S.replace(/_/g," "),":"]}),a.jsx("span",{children:_}),a.jsx("button",{className:"ml-2 text-indigo-600 hover:text-indigo-800",onClick:()=>Mt(S,""),"aria-label":`Remove ${S} filter`,children:a.jsx(Ne,{size:14})})]},S)),a.jsx("button",{className:"inline-flex items-center bg-gray-100 text-gray-800 hover:bg-gray-200 rounded-full px-3 py-1 text-sm",onClick:wt,children:"Clear All"}),a.jsx("button",{onClick:Yi,className:"inline-flex items-center bg-indigo-100 text-indigo-800 hover:bg-indigo-200 rounded-full px-3 py-1 text-sm font-medium",children:"🔔 Create Alert"})]})]}),c&&a.jsxs("button",{className:"md:hidden w-full mb-6 px-4 py-3 bg-indigo-600 text-white rounded-lg flex items-center justify-center",onClick:Ut,"aria-expanded":U,children:[a.jsx(Tt,{className:"w-4 h-4 mr-2"}),U?"Close Filters":"Filters"]}),a.jsxs("div",{className:"flex flex-col lg:flex-row lg:gap-6",children:[a.jsx("div",{className:"hidden lg:block lg:w-1/4 space-y-6",children:a.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-5",children:[a.jsx("h2",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Filters"}),a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium text-gray-900 mb-2",children:d}),a.jsx(vC,{activeDateFilter:Q,onDateFilterChange:pt,dateFieldLabel:""})]}),n&&a.jsxs("div",{className:"mb-6",children:[a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:a.jsx(tt,{className:"h-5 w-5 text-indigo-500"})}),a.jsx("input",{type:"text",className:"block w-full pl-10 pr-3 py-3 border border-gray-300 rounded-lg bg-white shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 text-gray-900",placeholder:"Search for jobs, companies, or keywords...",value:N,onChange:S=>Wi(S.target.value),onKeyDown:$i,list:"job-suggestions"}),a.jsx("button",{className:"absolute right-2 top-1/2 -translate-y-1/2 bg-indigo-500 text-white px-4 py-2 rounded-md hover:bg-indigo-600 transition text-sm",onClick:Et,children:"Search"}),a.jsx("datalist",{id:"job-suggestions",children:L.map((S,_)=>a.jsx("option",{value:S},_))})]}),(C.length>0||Object.keys(g).length>0||Q!=="all")&&a.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[Q!=="all"&&a.jsxs("div",{className:"inline-flex items-center bg-indigo-100 text-indigo-800 rounded-full px-3 py-1 text-sm",children:[a.jsxs("span",{className:"font-medium mr-1",children:[d,":"]}),a.jsx("span",{children:Q.replace(/_/g," ")}),a.jsx("button",{className:"ml-2 text-indigo-600 hover:text-indigo-800",onClick:()=>pt("all"),"aria-label":`Remove ${d} filter`,children:a.jsx(Ne,{size:14})})]}),C.map(S=>a.jsxs("div",{className:"inline-flex items-center bg-indigo-100 text-indigo-800 rounded-full px-3 py-1 text-sm",children:[a.jsx("span",{children:S}),a.jsx("button",{className:"ml-2 text-indigo-600 hover:text-indigo-800",onClick:()=>Xi(S),"aria-label":`Remove search filter ${S}`,children:a.jsx(Ne,{size:14})})]},`search-${S}`)),Object.entries(g).map(([S,_])=>a.jsxs("div",{className:"inline-flex items-center bg-indigo-100 text-indigo-800 rounded-full px-3 py-1 text-sm",children:[a.jsxs("span",{className:"font-medium mr-1",children:[S.replace(/_/g," "),":"]}),a.jsx("span",{children:_}),a.jsx("button",{className:"ml-2 text-indigo-600 hover:text-indigo-800",onClick:()=>Mt(S,""),"aria-label":`Remove ${S} filter`,children:a.jsx(Ne,{size:14})})]},S)),a.jsx("button",{className:"inline-flex items-center bg-gray-100 text-gray-800 hover:bg-gray-200 rounded-full px-3 py-1 text-sm",onClick:wt,children:"Clear All"}),a.jsx("button",{onClick:Yi,className:"inline-flex items-center bg-indigo-100 text-indigo-800 hover:bg-indigo-200 rounded-full px-3 py-1 text-sm font-medium",children:"🔔 Create Alert"})]})]}),r.map(S=>{var _;return a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium text-gray-900 mb-2",children:S.replace(/_/g," ")}),h.includes(S)?a.jsx(LM,{options:j[S]||[],value:g[S]||"",onChange:T=>Mt(S,T),placeholder:`Select ${S.replace(/_/g," ")}`,className:"w-full"}):a.jsxs("select",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-indigo-500 focus:border-indigo-500 bg-white",value:g[S]||"",onChange:T=>Mt(S,T.target.value),children:[a.jsxs("option",{value:"",children:["Select ",S.replace(/_/g," ")]}),(_=j[S])==null?void 0:_.map(T=>a.jsx("option",{value:T,children:T},T))]})]},S)}),a.jsx("div",{className:"mt-6",children:a.jsxs("button",{onClick:en,className:`w-full px-4 py-2 rounded-lg flex items-center justify-center ${ie?"bg-indigo-100 text-indigo-800":"bg-gray-100 text-gray-800 hover:bg-gray-200"}`,children:[a.jsx(_t,{size:16,className:"mr-2"}),a.jsxs("span",{children:["Saved Jobs (",E.length,")"]})]})})]})}),R?a.jsx(MC,{}):a.jsxs("div",{className:"lg:w-2/4 space-y-6",children:[a.jsx("div",{className:"lg:block hidden bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:a.jsxs("div",{className:"flex flex-col sm:flex-row sm:justify-between sm:items-center gap-3",children:[a.jsx("div",{className:"flex justify-between items-center",children:a.jsxs("div",{className:"view-mode-toggle flex bg-gray-100 p-1 rounded-lg",children:[a.jsxs("button",{onClick:z2,className:`px-3 py-1.5 rounded-md flex items-center justify-center transition-colors ${H==="grid"?"bg-indigo-600 text-white shadow-sm":"text-gray-700 hover:bg-gray-200"}`,"aria-label":"Grid view","aria-pressed":H==="grid",children:[a.jsx(We,{size:16,className:"mr-1.5"}),a.jsx("span",{className:"text-sm font-medium",children:"Grid"})]}),a.jsxs("button",{onClick:z2,className:`px-3 py-1.5 rounded-md flex items-center justify-center transition-colors ${H==="list"?"bg-indigo-600 text-white shadow-sm":"text-gray-700 hover:bg-gray-200"}`,"aria-label":"List view","aria-pressed":H==="list",children:[a.jsx(E2,{size:16,className:"mr-1.5"}),a.jsx("span",{className:"text-sm font-medium",children:"List"})]})]})}),a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("div",{className:"items-per-page flex items-center",children:[a.jsx("label",{htmlFor:"items-per-page",className:"mr-2 text-sm font-medium text-gray-700",children:"Show:"}),a.jsxs("select",{id:"items-per-page",value:G,onChange:S=>Ki(Number(S.target.value)),className:"px-2 py-1.5 border border-gray-300 rounded-md text-sm bg-white",children:[a.jsx("option",{value:5,children:"5"}),a.jsx("option",{value:10,children:"10"}),a.jsx("option",{value:20,children:"20"}),a.jsx("option",{value:50,children:"50"})]})]}),a.jsxs("button",{className:"md:hidden flex items-center px-3 py-1.5 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition-colors",onClick:Ut,children:[a.jsx(Tt,{size:16,className:"mr-1.5"}),a.jsx("span",{className:"text-sm font-medium",children:"Filters"})]})]})]})}),a.jsxs("div",{className:"",children:[a.jsxs("h2",{className:"text-xl font-semibold text-gray-900 m-4",children:[ie?"Saved Jobs":"Open Positions",Q!=="all"&&!ie&&a.jsxs("span",{className:"text-sm font-normal text-gray-500 ml-2",children:["(",Q.replace(/_/g," "),")"]})]}),a.jsx(ZI,{items:AM,cardType:s,viewMode:H,savedJobs:E,onSaveJob:SM,onViewJob:Qi}),k.length>0&&a.jsx("div",{className:"mt-6",children:a.jsx(fC,{currentPage:m,totalPages:IM,setCurrentPage:f})})]}),z.length>0&&a.jsx("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-5",children:a.jsx(WI,{jobs:z,onViewJob:Qi})})]}),a.jsx("div",{className:"hidden lg:block lg:w-1/4 space-y-6",children:((tn=i==null?void 0:i.sidebar)==null?void 0:tn.enabled)&&a.jsxs("div",{className:"sticky top-4",children:[a.jsx(fM,{position:"sidebar",url:i.sidebar.url,link:i.sidebar.link,alt:i.sidebar.alt}),a.jsx(mC,{api_url:y}),a.jsxs("div",{className:"mt-6 bg-white rounded-lg shadow-sm border border-gray-200 p-5",children:[a.jsx("h3",{className:"font-semibold text-lg mb-3",children:"Featured Employers"}),a.jsx("div",{className:"grid grid-cols-3 gap-2",children:[...Array(6)].map((S,_)=>a.jsx("div",{className:"flex items-center justify-center p-2 bg-gray-50 rounded-md",children:a.jsx("img",{src:`/placeholder.svg?height=40&width=40&text=${String.fromCharCode(65+_)}`,alt:`Featured employer ${_+1}`,className:"w-10 h-10 object-contain"})},_))})]})]})})]})]})}),a.jsx(XI,{activeDateFilter:Q,handleDateFilterChange:pt,filterKeys:r,searchableFilters:h,dateFieldLabel:d,activeFilters:g,handleFilterChange:Mt,toggleSavedJobsFilter:en,filtersData:j,savedJobs:E,showOnlySaved:ie,isMobileFilterOpen:U,toggleMobileFilter:Ut}),a.jsx($I,{savedJobsCount:E.length}),a.jsx(xC,{open:ii.open,type:ii.type,message:ii.message,onClose:()=>ni(S=>({...S,open:!1}))})]})},QI=()=>a.jsx("div",{children:a.jsx("h2",{children:"Welcome to the Header!"})}),eA=({articles:o})=>{const[e,r]=b.useState(0),[i,n]=b.useState(!0),c=o.filter(l=>l.isBreaking);if(b.useEffect(()=>{if(c.length>1){const l=setInterval(()=>{r(d=>(d+1)%c.length)},5e3);return()=>clearInterval(l)}},[c.length]),!i||c.length===0)return null;const s=c[e];return a.jsx("div",{className:"breaking-news bg-red-600 text-white py-2 px-4 relative",children:a.jsxs("div",{className:"max-w-7xl mx-auto flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center space-x-3 flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center space-x-2 flex-shrink-0",children:[a.jsx(jt,{className:"w-5 h-5 animate-pulse"}),a.jsx("span",{className:"font-bold text-sm uppercase tracking-wide",children:"Breaking News"})]}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsx("a",{href:s.link,target:"_blank",rel:"noopener noreferrer",className:"text-sm hover:underline truncate block",children:s.title})})]}),a.jsxs("div",{className:"flex items-center space-x-2 flex-shrink-0",children:[c.length>1&&a.jsx("div",{className:"flex space-x-1",children:c.map((l,d)=>a.jsx("button",{onClick:()=>r(d),className:`w-2 h-2 rounded-full transition-colors ${d===e?"bg-white":"bg-white/50"}`,"aria-label":`Go to breaking news ${d+1}`},d))}),a.jsx("button",{onClick:()=>n(!1),className:"p-1 hover:bg-red-700 rounded transition-colors","aria-label":"Close breaking news",children:a.jsx(at,{className:"w-4 h-4"})})]})]})})},tA=({articles:o,onArticleClick:e})=>{const[r,i]=b.useState(0),n=4,c=y=>{const p=new Date(y),k=Math.floor((new Date().getTime()-p.getTime())/(1e3*60*60));return k<1?"Just now":k<24?`${k}h ago`:p.toLocaleDateString("en-US",{month:"short",day:"numeric"})},s=y=>y>=1e3?`${(y/1e3).toFixed(1)}k`:y.toString(),l=()=>{i(y=>y+n>=o.length?0:y+n)},d=()=>{i(y=>y===0?Math.max(0,o.length-n):Math.max(0,y-n))};if(o.length===0)return null;const h=o.slice(r,r+n);return a.jsx("section",{className:"trending-news bg-white border-b border-gray-200 py-4",children:a.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(L2,{className:"w-5 h-5 text-orange-500 mr-2"}),a.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"Trending Now"})]}),o.length>n&&a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx("button",{onClick:d,className:"p-1 rounded-full hover:bg-gray-100 transition-colors","aria-label":"Previous trending articles",children:a.jsx(w2,{className:"w-4 h-4 text-gray-600"})}),a.jsx("button",{onClick:l,className:"p-1 rounded-full hover:bg-gray-100 transition-colors","aria-label":"Next trending articles",children:a.jsx(Pt,{className:"w-4 h-4 text-gray-600"})})]})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-3",children:h.map((y,p)=>a.jsx("div",{onClick:()=>e(y),className:"group bg-gray-50 rounded-lg p-3 cursor-pointer hover:bg-orange-50 hover:border-orange-200 border border-transparent transition-all duration-200",children:a.jsxs("div",{className:"flex items-start space-x-2",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx("span",{className:"inline-flex items-center justify-center w-6 h-6 bg-orange-100 text-orange-600 rounded-full text-xs font-bold group-hover:bg-orange-200",children:r+p+1})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h3",{className:"text-sm font-medium text-gray-900 line-clamp-2 mb-1 group-hover:text-orange-700",children:y.title}),a.jsxs("div",{className:"flex items-center text-xs text-gray-500 space-x-2",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(st,{className:"w-3 h-3 mr-1"}),a.jsx("span",{children:c(y.date)})]}),a.jsx("span",{children:"•"}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(B2,{className:"w-3 h-3 mr-1"}),a.jsx("span",{children:s(y.viewCount||0)})]})]})]})]})},y._id))}),o.length>n&&a.jsx("div",{className:"flex justify-center mt-3 md:hidden",children:a.jsx("div",{className:"flex space-x-1",children:Array.from({length:Math.ceil(o.length/n)}).map((y,p)=>a.jsx("button",{onClick:()=>i(p*n),className:`w-2 h-2 rounded-full transition-colors ${Math.floor(r/n)===p?"bg-orange-500":"bg-gray-300"}`,"aria-label":`Go to trending articles page ${p+1}`},p))})})]})})},aA=({filters:o,sortBy:e,categories:r,onFiltersChange:i,onSortChange:n,onClearFilters:c,totalArticles:s,filteredArticles:l})=>{const[d,h]=b.useState(!1),y=[{value:"latest",label:"Latest"},{value:"trending",label:"Trending"},{value:"most-read",label:"Most Read"},{value:"oldest",label:"Oldest"},{value:"relevance",label:"Most Relevant"}],p=[{value:[0,2],label:"Quick read (0-2 min)"},{value:[2,5],label:"Medium read (2-5 min)"},{value:[5,10],label:"Long read (5-10 min)"},{value:[10,999],label:"In-depth (10+ min)"}],u=[{value:["",""],label:"All time"},{value:[new Date(Date.now()-24*60*60*1e3).toISOString(),""],label:"Last 24 hours"},{value:[new Date(Date.now()-7*24*60*60*1e3).toISOString(),""],label:"Last week"},{value:[new Date(Date.now()-30*24*60*60*1e3).toISOString(),""],label:"Last month"}],k=g=>{const M=o.categories.includes(g)?o.categories.filter(C=>C!==g):[...o.categories,g];i({...o,categories:M})},x=g=>{i({...o,readTime:g})},m=g=>{i({...o,dateRange:g})},f=o.categories.length>0||o.tags.length>0||o.authors.length>0||o.companies.length>0||o.dateRange[0]!==""||o.readTime[0]!==0||o.readTime[1]!==999;return a.jsxs("div",{className:"news-filters bg-white rounded-lg shadow-sm border border-gray-200",children:[a.jsxs("div",{className:"p-4 border-b border-gray-200",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(O2,{className:"w-5 h-5 text-gray-600 mr-2"}),a.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Filters"}),f&&a.jsx("span",{className:"ml-2 px-2 py-1 bg-blue-100 text-blue-800 text-xs rounded-full",children:"Active"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[f&&a.jsx("button",{onClick:c,className:"text-sm text-blue-600 hover:text-blue-800",children:"Clear All"}),a.jsx("button",{onClick:()=>h(!d),className:"lg:hidden p-1 rounded-md hover:bg-gray-100",children:a.jsx(zt,{className:`w-4 h-4 transition-transform ${d?"rotate-180":""}`})})]})]}),a.jsxs("p",{className:"text-sm text-gray-600 mt-2",children:["Showing ",l," of ",s," articles"]})]}),a.jsxs("div",{className:"p-4 border-b border-gray-200",children:[a.jsx("label",{htmlFor:"sort-select",className:"block text-sm font-medium text-gray-700 mb-2",children:"Sort by"}),a.jsx("select",{id:"sort-select",value:e,onChange:g=>n(g.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-blue-500 focus:border-blue-500",children:y.map(g=>a.jsx("option",{value:g.value,children:g.label},g.value))})]}),a.jsxs("div",{className:`${d?"block":"hidden"} lg:block`,children:[a.jsxs("div",{className:"p-4 border-b border-gray-200",children:[a.jsxs("h4",{className:"text-sm font-medium text-gray-900 mb-3 flex items-center",children:[a.jsx(mi,{className:"w-4 h-4 mr-2"}),"Date Range"]}),a.jsx("div",{className:"space-y-2",children:u.map((g,M)=>a.jsxs("label",{className:"flex items-center",children:[a.jsx("input",{type:"radio",name:"dateRange",checked:o.dateRange[0]===g.value[0]&&o.dateRange[1]===g.value[1],onChange:()=>m(g.value),className:"mr-2 text-blue-600 focus:ring-blue-500"}),a.jsx("span",{className:"text-sm text-gray-700",children:g.label})]},M))})]}),a.jsxs("div",{className:"p-4 border-b border-gray-200",children:[a.jsxs("h4",{className:"text-sm font-medium text-gray-900 mb-3 flex items-center",children:[a.jsx(st,{className:"w-4 h-4 mr-2"}),"Read Time"]}),a.jsx("div",{className:"space-y-2",children:p.map((g,M)=>a.jsxs("label",{className:"flex items-center",children:[a.jsx("input",{type:"radio",name:"readTime",checked:o.readTime[0]===g.value[0]&&o.readTime[1]===g.value[1],onChange:()=>x(g.value),className:"mr-2 text-blue-600 focus:ring-blue-500"}),a.jsx("span",{className:"text-sm text-gray-700",children:g.label})]},M))})]}),a.jsxs("div",{className:"p-4",children:[a.jsx("h4",{className:"text-sm font-medium text-gray-900 mb-3",children:"Categories"}),a.jsx("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:r.map(g=>a.jsxs("label",{className:"flex items-center",children:[a.jsx("input",{type:"checkbox",checked:o.categories.includes(g.id),onChange:()=>k(g.id),className:"mr-2 text-blue-600 focus:ring-blue-500 rounded"}),a.jsxs("div",{className:"flex items-center justify-between w-full",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx("span",{className:"mr-2",children:g.icon}),a.jsx("span",{className:"text-sm text-gray-700",children:g.name})]}),a.jsxs("span",{className:"text-xs text-gray-500",children:["(",g.count,")"]})]})]},g.id))})]})]})]})},rA=({article:o,isBookmarked:e,onToggleBookmark:r,onShare:i,layout:n="card"})=>{const[c,s]=b.useState(!1),l=u=>{const k=new Date(u),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=u=>u>=1e3?`${(u/1e3).toFixed(1)}k`:u.toString(),h=u=>u.length>1?u[1]:u[0],y=(u,k)=>u.length<=k?u:u.substring(0,k).trim()+"...",p=n==="card"?"flex flex-col":"flex flex-col md:flex-row md:items-center";return a.jsxs("article",{className:`
|
|
7762
|
+
hover:text-primary-500`,children:[a.jsx(b2,{className:"w-6 h-6"}),a.jsx("span",{className:"text-xs mt-1",children:"More"})]})]})}),XI=({activeDateFilter:o,handleDateFilterChange:e,filterKeys:r,searchableFilters:i,dateFieldLabel:n,activeFilters:c,handleFilterChange:s,toggleSavedJobsFilter:l,filtersData:d,savedJobs:h,showOnlySaved:y,isMobileFilterOpen:p,toggleMobileFilter:u,dateOptions:k=[{value:"all",label:"All Time"},{value:"today",label:"Today"},{value:"this_week",label:"This Week"},{value:"this_month",label:"This Month"},{value:"last_30_days",label:"Last 30 Days"},{value:"last_90_days",label:"Last 90 Days"}]})=>a.jsx("div",{children:a.jsxs("div",{className:p?"block":"hidden",children:[a.jsx("div",{className:"fixed inset-0 bg-gray-600 bg-opacity-75 z-40",onClick:()=>u(!p)}),a.jsxs("div",{className:"fixed inset-y-0 right-0 max-w-xs w-full bg-white shadow-xl z-50 overflow-y-auto",children:[a.jsxs("div",{className:"p-4 border-b border-gray-200 flex items-center justify-between",children:[a.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"Filters"}),a.jsx("button",{onClick:()=>u(!p),className:"p-2 rounded-full hover:bg-gray-100","aria-label":"Close filters",children:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6 text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),a.jsxs("div",{className:"p-4",children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium text-gray-900 mb-2",children:n}),a.jsx(vC,{activeDateFilter:o,onDateFilterChange:e,dateFieldLabel:"",options:k})]}),r.map(x=>{var m;return a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium text-gray-900 mb-2",children:x.replace(/_/g," ")}),i.includes(x)?a.jsx(LM,{options:d[x]||[],value:c[x]||"",onChange:f=>s(x,f),placeholder:`Select ${x.replace(/_/g," ")}`,className:"w-full"}):a.jsxs("select",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-indigo-500 focus:border-indigo-500 bg-white",value:c[x]||"",onChange:f=>s(x,f.target.value),children:[a.jsxs("option",{value:"",children:["Select ",x.replace(/_/g," ")]}),(m=d[x])==null?void 0:m.map(f=>a.jsx("option",{value:f,children:f},f))]})]},x)}),a.jsx("div",{className:"mt-6",children:a.jsxs("button",{onClick:l,className:`w-full px-4 py-2 rounded-lg flex items-center justify-center ${y?"bg-indigo-100 text-indigo-800":"bg-gray-100 text-gray-800 hover:bg-gray-200"}`,children:[a.jsx(_t,{size:16,className:"mr-2"}),a.jsxs("span",{children:["Saved Jobs (",h.length,")"]})]})}),a.jsx("div",{className:"mt-6 pt-6 border-t border-gray-200",children:a.jsx("button",{onClick:()=>u(!p),className:"w-full py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition-colors",children:"Apply Filters"})})]})]})]})}),MC=({totalColumns:o=2})=>a.jsx("div",{className:"flex-grow p-8",children:a.jsx("div",{className:"max-w-7xl mx-auto",children:a.jsxs("div",{className:"animate-pulse",children:[a.jsx("div",{className:"h-8 bg-gray-200 rounded w-1/4 mb-6"}),a.jsx("div",{className:`grid grid-cols-1 md:grid-cols-${o} gap-6`,children:[...Array(4)].map((e,r)=>a.jsxs("div",{className:"bg-white rounded-lg shadow-sm p-6",children:[a.jsx("div",{className:"h-6 bg-gray-200 rounded w-3/4 mb-4"}),a.jsx("div",{className:"h-4 bg-gray-200 rounded w-1/2 mb-2"}),a.jsx("div",{className:"h-4 bg-gray-200 rounded w-1/3 mb-4"}),a.jsx("div",{className:"h-20 bg-gray-200 rounded mb-4"}),a.jsx("div",{className:"h-8 bg-gray-200 rounded w-full"})]},r))})]})})}),JI=({filteredItems:o})=>a.jsx("div",{className:"mb-6",children:a.jsxs("div",{className:"flex flex-row md:items-center justify-between",children:[a.jsx("h1",{className:"sm:text-3xl text-xl font-bold text-gray-900 md:mb-0",children:"Job Listings"}),a.jsx("div",{className:"flex items-center",children:a.jsxs("p",{className:"text-sm text-gray-600 mr-4",children:[a.jsx("span",{className:"font-semibold text-gray-900",children:o.length})," jobs found"]})})]})}),YI=6,KI=({apiUrl:o,itemsPerPage:e=12,filterKeys:r,banner:i,enableSearch:n=!0,enableMobileFilter:c=!0,cardType:s,dateField:l="created_at",dateFieldLabel:d="Published",searchableFilters:h=["companies"],notification_url:y="http://localhost:5147"})=>{var tn;const[p,u]=b.useState([]),[k,x]=b.useState([]),[m,f]=b.useState(1),[g,M]=b.useState({}),[C,w]=b.useState([]),[j,I]=b.useState({}),[N,A]=b.useState(""),[L,O]=b.useState([]),[U,D]=b.useState(!1),[G,J]=b.useState(e),[H,B]=b.useState("grid"),[E,ne]=b.useState([]),[ie,he]=b.useState(!1),[z,F]=b.useState([]),[R,W]=b.useState(!0),[K,oe]=b.useState(null),[Q,Ae]=b.useState("all"),[vt,ht]=b.useState({jobTypes:[],experienceLevels:[],country:"",minSalary:"",maxSalary:"",city:""}),[ii,ni]=b.useState({open:!1,type:"info",message:""}),oi=(S,_)=>{ni({open:!0,type:S,message:_})};b.useEffect(()=>{try{const S=localStorage.getItem("savedJobs");S&&ne(JSON.parse(S));const _=localStorage.getItem("lastVisitedJobs");_&&F(JSON.parse(_))}catch(S){console.error("Error loading data from localStorage:",S)}},[]),b.useEffect(()=>{const _=new URLSearchParams(window.location.search).get("date_filter");if(_&&_!=="all"){Ae(_);const T=Qe(p,g,C,_);x(T),f(1),Ke(T)}},[p]),b.useEffect(()=>{if(!o){oe("❌ Missing API URL for Listing component!"),W(!1);return}W(!0),oe(null),(async()=>{try{const _=await fetch(o);if(!_.ok)throw new Error(`API responded with status: ${_.status}`);const T=await _.json();if(!Array.isArray(T))throw new Error("Expected an array but received: "+typeof T);const Z=T.map((ee,xe)=>({...ee,sponsored:xe%7===0}));u(Z),x(Z);const X=yt(Z);I(X)}catch(_){console.error("Error fetching data:",_),oe(`Failed to load data: ${_ instanceof Error?_.message:String(_)}`);const T=UI(20);u(T),x(T);const Z=yt(T);I(Z)}finally{W(!1)}})()},[o]),b.useEffect(()=>{const S=new URLSearchParams(window.location.search),_={};r.forEach(X=>{const ee=S.get(X);ee&&(_[X]=ee)}),M(_);const T=S.get("q")||S.get("searchTerm")||"";T&&(A(T),jM(T));const Z={};r.forEach(X=>{const ee=S.get(X);ee&&(Z[X]=ee)}),M(Z)},[]);const CM=(S,_)=>{if(console.log("Applying date filter from URL:",S,_),_==="all")return S;const T=new Date,Z=new Date(T.getFullYear(),T.getMonth(),T.getDate());return S.filter(X=>{const ee=X[l]||X.created_at||X.published_at||X.scraped_at;if(!ee)return!1;const xe=new Date(ee);switch(_){case"today":return xe>=Z;case"this_week":{const ge=new Date(T);return ge.setDate(T.getDate()-T.getDay()),ge.setHours(0,0,0,0),xe>=ge}case"this_month":{const ge=new Date(T.getFullYear(),T.getMonth(),1);return xe>=ge}case"last_30_days":{const ge=new Date(T);return ge.setDate(T.getDate()-30),xe>=ge}case"last_90_days":{const ge=new Date(T);return ge.setDate(T.getDate()-90),xe>=ge}default:return!0}})},_2=(S,_)=>S.filter(T=>{var Z,X,ee,xe,ge;if(_.jobTypes.length>0){const be=((Z=T.department)==null?void 0:Z.toLowerCase())||"";if(!_.jobTypes.some(Gt=>be.includes(Gt)))return!1}if(_.experienceLevels.length>0){const be=((X=T.title)==null?void 0:X.toLowerCase())||"";if(!_.experienceLevels.some(Gt=>!!(Gt==="senior"&&be.includes("senior")||Gt==="mid"&&(be.includes("mid")||be.includes("mid-level"))||Gt==="entry"&&(be.includes("junior")||be.includes("entry")))))return!1}return!(_.country&&!(((ee=T.location)==null?void 0:ee.toLowerCase())||((xe=T.city)==null?void 0:xe.toLowerCase())||"").includes(_.country.toLowerCase())||_.city&&!(((ge=T.company_type)==null?void 0:ge.toLowerCase())||"").includes(_.city.toLowerCase()))});b.useEffect(()=>{if(ie){const S=p.filter(_=>E.includes(_.id||_.slug||_.link));x(S),f(1)}else{let S=p;S=Qe(S,g,C,Q),S=_2(S,vt),x(S)}},[ie,E,p,g,C,Q,vt]);const yt=S=>{const _={};S.forEach(Z=>{r.forEach(X=>{_[X]||(_[X]=new Set);const ee=Z[X];typeof ee=="string"&&ee.trim()!==""&&_[X].add(ee)})});const T={};return Object.keys(_).forEach(Z=>{T[Z]=Array.from(_[Z])}),T},Ke=S=>{const _=yt(S);I(_)},Mt=(S,_)=>{console.log("Filter changed:",S,_),M(T=>{const Z={...T};_?Z[S]=_:delete Z[S],ie&&he(!1);const X=Qe(p,Z,C,Q);return x(X),f(1),Ke(X),Z})},pt=S=>{Ae(S),ie&&he(!1);const _=Qe(p,g,C,S);x(_),f(1),Ke(_);const T=new URLSearchParams(window.location.search);S==="all"?T.delete("date_filter"):T.set("date_filter",S);const Z=`${window.location.pathname}?${T.toString()}`;window.history.replaceState({},"",Z)},Wi=S=>{if(A(S),S){const _=p.map(T=>T.title).filter((T,Z,X)=>T&&T.toLowerCase().includes(S.toLowerCase())&&X.indexOf(T)===Z).slice(0,5);O(_)}else O([])},jM=S=>{if(!S.trim())return;ie&&he(!1);const _=[...C,S.trim()];w(_);const T=Qe(p,g,_,Q);x(T),f(1),Ke(T),A("")},Et=()=>{const S=N.trim();if(!S)return;ie&&he(!1);const _=[...C,S];w(_);const T=Qe(p,g,_,Q);x(T),f(1),Ke(T),A("");const Z=new URLSearchParams(window.location.search);Z.set("q",S),Object.entries(g).forEach(([ee,xe])=>{xe&&Z.set(ee,xe)});const X=`${window.location.pathname}?${Z.toString()}`;window.history.replaceState({},"",X)},$i=S=>{S.key==="Enter"&&(S.preventDefault(),Et())},Xi=S=>{const _=C.filter(Z=>Z!==S);w(_);const T=Qe(p,g,_,Q);x(T),f(1),Ke(T)},Qe=(S,_,T,Z)=>{let X=S.filter(ee=>Object.entries(_).every(([xe,ge])=>{const be=ee[xe];return typeof be=="string"&&be.toLowerCase()===ge.toLowerCase()}));return T.length>0&&(X=X.filter(ee=>T.every(xe=>{var ge,be;return((ge=ee.title)==null?void 0:ge.toLowerCase().includes(xe.toLowerCase()))||((be=ee.overview)==null?void 0:be.toLowerCase().includes(xe.toLowerCase()))}))),X=CM(X,Z),X},Ji=()=>{ht({jobTypes:[],experienceLevels:[],country:"",minSalary:"",maxSalary:"",city:""});const S=Qe(p,g,C,Q);x(S),f(1),Ke(S)},wt=()=>{M({}),w([]),he(!1),Ae("all"),Ji(),x(p),f(1),Ke(p)},Yi=async()=>{const S=localStorage.getItem("email"),_=localStorage.getItem("leadId");if(!S||!_){oi("info","Please subscribe first to create alerts.");return}const T={jobTitle:g.title||"",location:g.city||"",techStack:g.company||""};try{await fetch(`http://localhost:5147/api/leads/${_}/preferences`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)}),oi("success","Alert created! We'll notify you about new matching jobs.")}catch(Z){console.error(Z),oi("error","Failed to create alert.")}},Ut=()=>{D(!U)},Ki=S=>{J(S),f(1)},z2=()=>{B(H==="grid"?"list":"grid")},SM=S=>{const _=S.id??S._id??S.slug??S.link;ne(T=>{const Z=T.includes(_);let X;Z?X=T.filter(ee=>ee!==_):X=[...T,_];try{localStorage.setItem("savedJobs",JSON.stringify(X))}catch(ee){console.error("Error saving to localStorage:",ee)}return X})},Qi=S=>{const _=S.id||S.slug||S.link;F(T=>{const Z=T.filter(ee=>(ee.id||ee.slug||ee.link)!==_),X=[S,...Z].slice(0,YI);try{localStorage.setItem("lastVisitedJobs",JSON.stringify(X))}catch(ee){console.error("Error saving to localStorage:",ee)}return X})},en=()=>{he(!ie)},IM=Math.ceil(k.length/G),AM=k.slice((m-1)*G,m*G);return K&&!p.length?a.jsx("div",{className:"flex-grow p-8",children:a.jsx("div",{className:"max-w-7xl mx-auto",children:a.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-800 rounded-lg p-6",children:[a.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Error Loading Jobs"}),a.jsx("p",{className:"mb-4",children:K}),a.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"})]})})}):a.jsxs("div",{className:"flex flex-col min-h-screen pb-16 md:pb-0",children:[a.jsx("div",{className:"flex-grow",children:a.jsxs("div",{className:"container mx-auto py-8 pb-20 md:pb-8",children:[a.jsx(JI,{filteredItems:k}),a.jsxs("div",{className:"relative",children:[a.jsxs("div",{className:"relative flex items-center gap-2 sm:my-6 my-2",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:a.jsx(tt,{className:"h-4 w-4 text-indigo-500"})}),a.jsx("input",{type:"text",className:"text-sm sm:text-base lg:text-sm block w-full pl-8 pr-12 py-3 border border-gray-300 rounded-xl bg-white shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 text-gray-900",placeholder:"Search for jobs, companies, or keywords...",value:N,onInput:S=>Wi(S.target.value),onKeyDown:$i,list:"job-suggestions"}),a.jsx("button",{className:"absolute right-2 top-1/2 -translate-y-1/2 bg-indigo-500 text-white py-2 px-2 border-2 rounded-lg hover:bg-indigo-600 transition text-sm",onClick:Et,children:a.jsx(tt,{className:"h-4 w-4 text-white"})}),a.jsx("datalist",{id:"job-suggestions",children:L.map((S,_)=>a.jsx("option",{value:S},_))})]}),a.jsx("button",{className:"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:Ut,children:a.jsx(Tt,{size:16,className:"mr-1.5"})})]}),(C.length>0||Object.keys(g).length>0||Q!=="all")&&a.jsxs("div",{className:"m-4 flex flex-wrap gap-2",children:[Q!=="all"&&a.jsxs("div",{className:"inline-flex items-center bg-indigo-100 text-indigo-800 rounded-full px-3 py-1 text-sm",children:[a.jsxs("span",{className:"font-medium mr-1",children:[d,":"]}),a.jsx("span",{children:Q.replace(/_/g," ")}),a.jsx("button",{className:"ml-2 text-indigo-600 hover:text-indigo-800",onClick:()=>pt("all"),"aria-label":`Remove ${d} filter`,children:a.jsx(Ne,{size:14})})]}),C.map(S=>a.jsxs("div",{className:"inline-flex items-center bg-indigo-100 text-indigo-800 rounded-full px-3 py-1 text-sm",children:[a.jsx("span",{children:S}),a.jsx("button",{className:"ml-2 text-indigo-600 hover:text-indigo-800",onClick:()=>Xi(S),"aria-label":`Remove search filter ${S}`,children:a.jsx(Ne,{size:14})})]},`search-${S}`)),Object.entries(g).map(([S,_])=>a.jsxs("div",{className:"inline-flex items-center bg-indigo-100 text-indigo-800 rounded-full px-3 py-1 text-sm",children:[a.jsxs("span",{className:"font-medium mr-1",children:[S.replace(/_/g," "),":"]}),a.jsx("span",{children:_}),a.jsx("button",{className:"ml-2 text-indigo-600 hover:text-indigo-800",onClick:()=>Mt(S,""),"aria-label":`Remove ${S} filter`,children:a.jsx(Ne,{size:14})})]},S)),a.jsx("button",{className:"inline-flex items-center bg-gray-100 text-gray-800 hover:bg-gray-200 rounded-full px-3 py-1 text-sm",onClick:wt,children:"Clear All"}),a.jsx("button",{onClick:Yi,className:"inline-flex items-center bg-indigo-100 text-indigo-800 hover:bg-indigo-200 rounded-full px-3 py-1 text-sm font-medium",children:"🔔 Create Alert"})]})]}),c&&a.jsxs("button",{className:"md:hidden w-full mb-6 px-4 py-3 bg-indigo-600 text-white rounded-lg flex items-center justify-center",onClick:Ut,"aria-expanded":U,children:[a.jsx(Tt,{className:"w-4 h-4 mr-2"}),U?"Close Filters":"Filters"]}),a.jsxs("div",{className:"flex flex-col lg:flex-row lg:gap-6",children:[a.jsx("div",{className:"hidden lg:block lg:w-1/4 space-y-6",children:a.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-5",children:[a.jsx("h2",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Filters"}),a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium text-gray-900 mb-2",children:d}),a.jsx(vC,{activeDateFilter:Q,onDateFilterChange:pt,dateFieldLabel:""})]}),n&&a.jsxs("div",{className:"mb-6",children:[a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:a.jsx(tt,{className:"h-5 w-5 text-indigo-500"})}),a.jsx("input",{type:"text",className:"block w-full pl-10 pr-3 py-3 border border-gray-300 rounded-lg bg-white shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 text-gray-900",placeholder:"Search for jobs, companies, or keywords...",value:N,onInput:S=>Wi(S.target.value),onKeyDown:$i,list:"job-suggestions"}),a.jsx("button",{className:"absolute right-2 top-1/2 -translate-y-1/2 bg-indigo-500 text-white px-4 py-2 rounded-md hover:bg-indigo-600 transition text-sm",onClick:Et,children:"Search"}),a.jsx("datalist",{id:"job-suggestions",children:L.map((S,_)=>a.jsx("option",{value:S},_))})]}),(C.length>0||Object.keys(g).length>0||Q!=="all")&&a.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[Q!=="all"&&a.jsxs("div",{className:"inline-flex items-center bg-indigo-100 text-indigo-800 rounded-full px-3 py-1 text-sm",children:[a.jsxs("span",{className:"font-medium mr-1",children:[d,":"]}),a.jsx("span",{children:Q.replace(/_/g," ")}),a.jsx("button",{className:"ml-2 text-indigo-600 hover:text-indigo-800",onClick:()=>pt("all"),"aria-label":`Remove ${d} filter`,children:a.jsx(Ne,{size:14})})]}),C.map(S=>a.jsxs("div",{className:"inline-flex items-center bg-indigo-100 text-indigo-800 rounded-full px-3 py-1 text-sm",children:[a.jsx("span",{children:S}),a.jsx("button",{className:"ml-2 text-indigo-600 hover:text-indigo-800",onClick:()=>Xi(S),"aria-label":`Remove search filter ${S}`,children:a.jsx(Ne,{size:14})})]},`search-${S}`)),Object.entries(g).map(([S,_])=>a.jsxs("div",{className:"inline-flex items-center bg-indigo-100 text-indigo-800 rounded-full px-3 py-1 text-sm",children:[a.jsxs("span",{className:"font-medium mr-1",children:[S.replace(/_/g," "),":"]}),a.jsx("span",{children:_}),a.jsx("button",{className:"ml-2 text-indigo-600 hover:text-indigo-800",onClick:()=>Mt(S,""),"aria-label":`Remove ${S} filter`,children:a.jsx(Ne,{size:14})})]},S)),a.jsx("button",{className:"inline-flex items-center bg-gray-100 text-gray-800 hover:bg-gray-200 rounded-full px-3 py-1 text-sm",onClick:wt,children:"Clear All"}),a.jsx("button",{onClick:Yi,className:"inline-flex items-center bg-indigo-100 text-indigo-800 hover:bg-indigo-200 rounded-full px-3 py-1 text-sm font-medium",children:"🔔 Create Alert"})]})]}),r.map(S=>{var _;return a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium text-gray-900 mb-2",children:S.replace(/_/g," ")}),h.includes(S)?a.jsx(LM,{options:j[S]||[],value:g[S]||"",onChange:T=>Mt(S,T),placeholder:`Select ${S.replace(/_/g," ")}`,className:"w-full"}):a.jsxs("select",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-indigo-500 focus:border-indigo-500 bg-white",value:g[S]||"",onChange:T=>Mt(S,T.target.value),children:[a.jsxs("option",{value:"",children:["Select ",S.replace(/_/g," ")]}),(_=j[S])==null?void 0:_.map(T=>a.jsx("option",{value:T,children:T},T))]})]},S)}),a.jsx("div",{className:"mt-6",children:a.jsxs("button",{onClick:en,className:`w-full px-4 py-2 rounded-lg flex items-center justify-center ${ie?"bg-indigo-100 text-indigo-800":"bg-gray-100 text-gray-800 hover:bg-gray-200"}`,children:[a.jsx(_t,{size:16,className:"mr-2"}),a.jsxs("span",{children:["Saved Jobs (",E.length,")"]})]})})]})}),R?a.jsx(MC,{}):a.jsxs("div",{className:"lg:w-2/4 space-y-6",children:[a.jsx("div",{className:"lg:block hidden bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:a.jsxs("div",{className:"flex flex-col sm:flex-row sm:justify-between sm:items-center gap-3",children:[a.jsx("div",{className:"flex justify-between items-center",children:a.jsxs("div",{className:"view-mode-toggle flex bg-gray-100 p-1 rounded-lg",children:[a.jsxs("button",{onClick:z2,className:`px-3 py-1.5 rounded-md flex items-center justify-center transition-colors ${H==="grid"?"bg-indigo-600 text-white shadow-sm":"text-gray-700 hover:bg-gray-200"}`,"aria-label":"Grid view","aria-pressed":H==="grid",children:[a.jsx(We,{size:16,className:"mr-1.5"}),a.jsx("span",{className:"text-sm font-medium",children:"Grid"})]}),a.jsxs("button",{onClick:z2,className:`px-3 py-1.5 rounded-md flex items-center justify-center transition-colors ${H==="list"?"bg-indigo-600 text-white shadow-sm":"text-gray-700 hover:bg-gray-200"}`,"aria-label":"List view","aria-pressed":H==="list",children:[a.jsx(E2,{size:16,className:"mr-1.5"}),a.jsx("span",{className:"text-sm font-medium",children:"List"})]})]})}),a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("div",{className:"items-per-page flex items-center",children:[a.jsx("label",{htmlFor:"items-per-page",className:"mr-2 text-sm font-medium text-gray-700",children:"Show:"}),a.jsxs("select",{id:"items-per-page",value:G,onChange:S=>Ki(Number(S.target.value)),className:"px-2 py-1.5 border border-gray-300 rounded-md text-sm bg-white",children:[a.jsx("option",{value:5,children:"5"}),a.jsx("option",{value:10,children:"10"}),a.jsx("option",{value:20,children:"20"}),a.jsx("option",{value:50,children:"50"})]})]}),a.jsxs("button",{className:"md:hidden flex items-center px-3 py-1.5 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition-colors",onClick:Ut,children:[a.jsx(Tt,{size:16,className:"mr-1.5"}),a.jsx("span",{className:"text-sm font-medium",children:"Filters"})]})]})]})}),a.jsxs("div",{className:"",children:[a.jsxs("h2",{className:"text-xl font-semibold text-gray-900 m-4",children:[ie?"Saved Jobs":"Open Positions",Q!=="all"&&!ie&&a.jsxs("span",{className:"text-sm font-normal text-gray-500 ml-2",children:["(",Q.replace(/_/g," "),")"]})]}),a.jsx(ZI,{items:AM,cardType:s,viewMode:H,savedJobs:E,onSaveJob:SM,onViewJob:Qi}),k.length>0&&a.jsx("div",{className:"mt-6",children:a.jsx(fC,{currentPage:m,totalPages:IM,setCurrentPage:f})})]}),z.length>0&&a.jsx("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-5",children:a.jsx(WI,{jobs:z,onViewJob:Qi})})]}),a.jsx("div",{className:"hidden lg:block lg:w-1/4 space-y-6",children:((tn=i==null?void 0:i.sidebar)==null?void 0:tn.enabled)&&a.jsxs("div",{className:"sticky top-4",children:[a.jsx(fM,{position:"sidebar",url:i.sidebar.url,link:i.sidebar.link,alt:i.sidebar.alt}),a.jsx(mC,{api_url:y}),a.jsxs("div",{className:"mt-6 bg-white rounded-lg shadow-sm border border-gray-200 p-5",children:[a.jsx("h3",{className:"font-semibold text-lg mb-3",children:"Featured Employers"}),a.jsx("div",{className:"grid grid-cols-3 gap-2",children:[...Array(6)].map((S,_)=>a.jsx("div",{className:"flex items-center justify-center p-2 bg-gray-50 rounded-md",children:a.jsx("img",{src:`/placeholder.svg?height=40&width=40&text=${String.fromCharCode(65+_)}`,alt:`Featured employer ${_+1}`,className:"w-10 h-10 object-contain"})},_))})]})]})})]})]})}),a.jsx(XI,{activeDateFilter:Q,handleDateFilterChange:pt,filterKeys:r,searchableFilters:h,dateFieldLabel:d,activeFilters:g,handleFilterChange:Mt,toggleSavedJobsFilter:en,filtersData:j,savedJobs:E,showOnlySaved:ie,isMobileFilterOpen:U,toggleMobileFilter:Ut}),a.jsx($I,{savedJobsCount:E.length}),a.jsx(xC,{open:ii.open,type:ii.type,message:ii.message,onClose:()=>ni(S=>({...S,open:!1}))})]})},QI=()=>a.jsx("div",{children:a.jsx("h2",{children:"Welcome to the Header!"})}),eA=({articles:o})=>{const[e,r]=b.useState(0),[i,n]=b.useState(!0),c=o.filter(l=>l.isBreaking);if(b.useEffect(()=>{if(c.length>1){const l=setInterval(()=>{r(d=>(d+1)%c.length)},5e3);return()=>clearInterval(l)}},[c.length]),!i||c.length===0)return null;const s=c[e];return a.jsx("div",{className:"breaking-news bg-red-600 text-white py-2 px-4 relative",children:a.jsxs("div",{className:"max-w-7xl mx-auto flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center space-x-3 flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center space-x-2 flex-shrink-0",children:[a.jsx(jt,{className:"w-5 h-5 animate-pulse"}),a.jsx("span",{className:"font-bold text-sm uppercase tracking-wide",children:"Breaking News"})]}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsx("a",{href:s.link,target:"_blank",rel:"noopener noreferrer",className:"text-sm hover:underline truncate block",children:s.title})})]}),a.jsxs("div",{className:"flex items-center space-x-2 flex-shrink-0",children:[c.length>1&&a.jsx("div",{className:"flex space-x-1",children:c.map((l,d)=>a.jsx("button",{onClick:()=>r(d),className:`w-2 h-2 rounded-full transition-colors ${d===e?"bg-white":"bg-white/50"}`,"aria-label":`Go to breaking news ${d+1}`},d))}),a.jsx("button",{onClick:()=>n(!1),className:"p-1 hover:bg-red-700 rounded transition-colors","aria-label":"Close breaking news",children:a.jsx(at,{className:"w-4 h-4"})})]})]})})},tA=({articles:o,onArticleClick:e})=>{const[r,i]=b.useState(0),n=4,c=y=>{const p=new Date(y),k=Math.floor((new Date().getTime()-p.getTime())/(1e3*60*60));return k<1?"Just now":k<24?`${k}h ago`:p.toLocaleDateString("en-US",{month:"short",day:"numeric"})},s=y=>y>=1e3?`${(y/1e3).toFixed(1)}k`:y.toString(),l=()=>{i(y=>y+n>=o.length?0:y+n)},d=()=>{i(y=>y===0?Math.max(0,o.length-n):Math.max(0,y-n))};if(o.length===0)return null;const h=o.slice(r,r+n);return a.jsx("section",{className:"trending-news bg-white border-b border-gray-200 py-4",children:a.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(L2,{className:"w-5 h-5 text-orange-500 mr-2"}),a.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"Trending Now"})]}),o.length>n&&a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx("button",{onClick:d,className:"p-1 rounded-full hover:bg-gray-100 transition-colors","aria-label":"Previous trending articles",children:a.jsx(w2,{className:"w-4 h-4 text-gray-600"})}),a.jsx("button",{onClick:l,className:"p-1 rounded-full hover:bg-gray-100 transition-colors","aria-label":"Next trending articles",children:a.jsx(Pt,{className:"w-4 h-4 text-gray-600"})})]})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-3",children:h.map((y,p)=>a.jsx("div",{onClick:()=>e(y),className:"group bg-gray-50 rounded-lg p-3 cursor-pointer hover:bg-orange-50 hover:border-orange-200 border border-transparent transition-all duration-200",children:a.jsxs("div",{className:"flex items-start space-x-2",children:[a.jsx("div",{className:"flex-shrink-0",children:a.jsx("span",{className:"inline-flex items-center justify-center w-6 h-6 bg-orange-100 text-orange-600 rounded-full text-xs font-bold group-hover:bg-orange-200",children:r+p+1})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h3",{className:"text-sm font-medium text-gray-900 line-clamp-2 mb-1 group-hover:text-orange-700",children:y.title}),a.jsxs("div",{className:"flex items-center text-xs text-gray-500 space-x-2",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(st,{className:"w-3 h-3 mr-1"}),a.jsx("span",{children:c(y.date)})]}),a.jsx("span",{children:"•"}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(B2,{className:"w-3 h-3 mr-1"}),a.jsx("span",{children:s(y.viewCount||0)})]})]})]})]})},y._id))}),o.length>n&&a.jsx("div",{className:"flex justify-center mt-3 md:hidden",children:a.jsx("div",{className:"flex space-x-1",children:Array.from({length:Math.ceil(o.length/n)}).map((y,p)=>a.jsx("button",{onClick:()=>i(p*n),className:`w-2 h-2 rounded-full transition-colors ${Math.floor(r/n)===p?"bg-orange-500":"bg-gray-300"}`,"aria-label":`Go to trending articles page ${p+1}`},p))})})]})})},aA=({filters:o,sortBy:e,categories:r,onFiltersChange:i,onSortChange:n,onClearFilters:c,totalArticles:s,filteredArticles:l})=>{const[d,h]=b.useState(!1),y=[{value:"latest",label:"Latest"},{value:"trending",label:"Trending"},{value:"most-read",label:"Most Read"},{value:"oldest",label:"Oldest"},{value:"relevance",label:"Most Relevant"}],p=[{value:[0,2],label:"Quick read (0-2 min)"},{value:[2,5],label:"Medium read (2-5 min)"},{value:[5,10],label:"Long read (5-10 min)"},{value:[10,999],label:"In-depth (10+ min)"}],u=[{value:["",""],label:"All time"},{value:[new Date(Date.now()-24*60*60*1e3).toISOString(),""],label:"Last 24 hours"},{value:[new Date(Date.now()-7*24*60*60*1e3).toISOString(),""],label:"Last week"},{value:[new Date(Date.now()-30*24*60*60*1e3).toISOString(),""],label:"Last month"}],k=g=>{const M=o.categories.includes(g)?o.categories.filter(C=>C!==g):[...o.categories,g];i({...o,categories:M})},x=g=>{i({...o,readTime:g})},m=g=>{i({...o,dateRange:g})},f=o.categories.length>0||o.tags.length>0||o.authors.length>0||o.companies.length>0||o.dateRange[0]!==""||o.readTime[0]!==0||o.readTime[1]!==999;return a.jsxs("div",{className:"news-filters bg-white rounded-lg shadow-sm border border-gray-200",children:[a.jsxs("div",{className:"p-4 border-b border-gray-200",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(O2,{className:"w-5 h-5 text-gray-600 mr-2"}),a.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Filters"}),f&&a.jsx("span",{className:"ml-2 px-2 py-1 bg-blue-100 text-blue-800 text-xs rounded-full",children:"Active"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[f&&a.jsx("button",{onClick:c,className:"text-sm text-blue-600 hover:text-blue-800",children:"Clear All"}),a.jsx("button",{onClick:()=>h(!d),className:"lg:hidden p-1 rounded-md hover:bg-gray-100",children:a.jsx(zt,{className:`w-4 h-4 transition-transform ${d?"rotate-180":""}`})})]})]}),a.jsxs("p",{className:"text-sm text-gray-600 mt-2",children:["Showing ",l," of ",s," articles"]})]}),a.jsxs("div",{className:"p-4 border-b border-gray-200",children:[a.jsx("label",{htmlFor:"sort-select",className:"block text-sm font-medium text-gray-700 mb-2",children:"Sort by"}),a.jsx("select",{id:"sort-select",value:e,onChange:g=>n(g.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-blue-500 focus:border-blue-500",children:y.map(g=>a.jsx("option",{value:g.value,children:g.label},g.value))})]}),a.jsxs("div",{className:`${d?"block":"hidden"} lg:block`,children:[a.jsxs("div",{className:"p-4 border-b border-gray-200",children:[a.jsxs("h4",{className:"text-sm font-medium text-gray-900 mb-3 flex items-center",children:[a.jsx(mi,{className:"w-4 h-4 mr-2"}),"Date Range"]}),a.jsx("div",{className:"space-y-2",children:u.map((g,M)=>a.jsxs("label",{className:"flex items-center",children:[a.jsx("input",{type:"radio",name:"dateRange",checked:o.dateRange[0]===g.value[0]&&o.dateRange[1]===g.value[1],onChange:()=>m(g.value),className:"mr-2 text-blue-600 focus:ring-blue-500"}),a.jsx("span",{className:"text-sm text-gray-700",children:g.label})]},M))})]}),a.jsxs("div",{className:"p-4 border-b border-gray-200",children:[a.jsxs("h4",{className:"text-sm font-medium text-gray-900 mb-3 flex items-center",children:[a.jsx(st,{className:"w-4 h-4 mr-2"}),"Read Time"]}),a.jsx("div",{className:"space-y-2",children:p.map((g,M)=>a.jsxs("label",{className:"flex items-center",children:[a.jsx("input",{type:"radio",name:"readTime",checked:o.readTime[0]===g.value[0]&&o.readTime[1]===g.value[1],onChange:()=>x(g.value),className:"mr-2 text-blue-600 focus:ring-blue-500"}),a.jsx("span",{className:"text-sm text-gray-700",children:g.label})]},M))})]}),a.jsxs("div",{className:"p-4",children:[a.jsx("h4",{className:"text-sm font-medium text-gray-900 mb-3",children:"Categories"}),a.jsx("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:r.map(g=>a.jsxs("label",{className:"flex items-center",children:[a.jsx("input",{type:"checkbox",checked:o.categories.includes(g.id),onChange:()=>k(g.id),className:"mr-2 text-blue-600 focus:ring-blue-500 rounded"}),a.jsxs("div",{className:"flex items-center justify-between w-full",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx("span",{className:"mr-2",children:g.icon}),a.jsx("span",{className:"text-sm text-gray-700",children:g.name})]}),a.jsxs("span",{className:"text-xs text-gray-500",children:["(",g.count,")"]})]})]},g.id))})]})]})]})},rA=({article:o,isBookmarked:e,onToggleBookmark:r,onShare:i,layout:n="card"})=>{const[c,s]=b.useState(!1),l=u=>{const k=new Date(u),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=u=>u>=1e3?`${(u/1e3).toFixed(1)}k`:u.toString(),h=u=>u.length>1?u[1]:u[0],y=(u,k)=>u.length<=k?u:u.substring(0,k).trim()+"...",p=n==="card"?"flex flex-col":"flex flex-col md:flex-row md:items-center";return a.jsxs("article",{className:`
|
|
7763
7763
|
news-card bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden
|
|
7764
7764
|
hover:shadow-md transition-shadow duration-300 ${p}
|
|
7765
7765
|
`,children:[a.jsxs("div",{className:`relative ${n==="list"?"md:w-1/3 md:flex-shrink-0":""}`,children:[a.jsx("img",{src:o.image||"/placeholder.svg?height=200&width=400&text=News",alt:o.title,className:`w-full h-48 object-cover transition-opacity duration-300 ${c?"opacity-100":"opacity-0"} ${n==="list"?"md:h-32":""}`,onLoad:()=>s(!0)}),!c&&a.jsx("div",{className:"absolute inset-0 bg-gray-200 animate-pulse flex items-center justify-center",children:a.jsx("div",{className:"w-12 h-12 text-gray-400",children:"📰"})}),a.jsxs("div",{className:"absolute top-3 left-3 flex flex-wrap gap-1",children:[o.isBreaking&&a.jsx("span",{className:"px-2 py-1 bg-red-500 text-white text-xs font-semibold rounded animate-pulse",children:"BREAKING"}),o.isTrending&&a.jsxs("span",{className:"px-2 py-1 bg-orange-500 text-white text-xs font-semibold rounded flex items-center",children:[a.jsx(L2,{className:"w-3 h-3 mr-1"}),"TRENDING"]})]}),a.jsx("button",{onClick:()=>r(o._id),className:`absolute top-3 right-3 p-2 rounded-full transition-colors ${e?"bg-blue-500 text-white":"bg-white text-gray-600 hover:bg-gray-100"}`,"aria-label":e?"Remove bookmark":"Add bookmark",children:a.jsx(_t,{className:`w-4 h-4 ${e?"fill-current":""}`})})]}),a.jsxs("div",{className:`p-4 ${n==="list"?"md:w-2/3":""}`,children:[a.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:o.categories.slice(0,2).map((u,k)=>a.jsx("span",{className:"px-2 py-1 bg-blue-100 text-blue-800 text-xs font-medium rounded-full",children:u},k))}),a.jsx("h2",{className:"text-lg font-semibold text-gray-900 mb-2 line-clamp-2 hover:text-blue-600 transition-colors",children:a.jsx("a",{href:o.link,target:"_blank",rel:"noopener noreferrer",children:o.title})}),a.jsx("p",{className:"text-sm text-gray-700 mb-3 line-clamp-3",children:y(o.content,n==="list"?150:200)}),a.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-500 mb-3",children:[a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsxs("span",{children:["By ",h(o.author)]}),a.jsx("span",{children:"•"}),a.jsx("span",{children:o.company})]}),a.jsxs("div",{className:"flex items-center space-x-3",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(st,{className:"w-4 h-4 mr-1"}),a.jsxs("span",{children:[o.readTime,"m read"]})]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(B2,{className:"w-4 h-4 mr-1"}),a.jsx("span",{children:d(o.viewCount||0)})]})]})]}),a.jsx("div",{className:"flex flex-wrap gap-1 mb-3",children:o.tags.slice(0,3).map((u,k)=>a.jsxs("span",{className:"px-2 py-1 bg-gray-100 text-gray-600 text-xs rounded",children:["#",u]},k))}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-sm text-gray-500",children:l(o.date)}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx("button",{onClick:()=>i(o),className:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-full transition-colors","aria-label":"Share article",children:a.jsx(Ai,{className:"w-4 h-4"})}),a.jsxs("a",{href:o.link,target:"_blank",rel:"noopener noreferrer",className:"flex items-center px-3 py-1.5 bg-blue-600 text-white text-sm font-medium rounded-lg hover:bg-blue-700 transition-colors",children:["Read More",a.jsx(fi,{className:"w-3 h-3 ml-1"})]})]})]})]})]})},iA=({apiUrl:o="http://localhost:5000/api/news",defaultFilters:e={categories:[],tags:[],authors:[],companies:[],dateRange:["",""],readTime:[0,999]},defaultSort:r="latest",bookmarkStorageKey:i="news-bookmarks"})=>{const[n,c]=b.useState([]),[s,l]=b.useState([]),[d,h]=b.useState(new Set),[y,p]=b.useState(r),[u,k]=b.useState("card"),[x,m]=b.useState(1),[f,g]=b.useState([]),M=12,C=H=>H.trim().toLowerCase().replace(/\s+/g,"-"),[w,j]=b.useState(e);b.useEffect(()=>{const H=localStorage.getItem(i);H&&h(new Set(JSON.parse(H)))},[i]),b.useEffect(()=>{localStorage.setItem(i,JSON.stringify(Array.from(d)))},[d,i]),b.useEffect(()=>{(async()=>{try{const ne=(await(await fetch(o)).json()).map(z=>({...z,categories:Array.isArray(z.categories)?z.categories:[]})),ie=new Set;ne.forEach(z=>{z.categories.forEach(F=>{ie.add(C(F))})});const he=Array.from(ie).map(z=>({id:z,name:z.replace(/-/g," ").replace(/\b\w/g,F=>F.toUpperCase()),icon:"📰",count:ne.filter(F=>F.categories.some(R=>C(R)===z)).length,color:"bg-gray-100 text-gray-800"}));c(ne),l(ne),g(he)}catch(B){console.error("Failed to fetch articles",B)}})()},[o]);const I=b.useMemo(()=>{let H=s;if(w.categories.length>0&&(H=H.filter(B=>B.categories.some(E=>w.categories.includes(C(E))))),w.dateRange[0]){const B=new Date(w.dateRange[0]);H=H.filter(E=>new Date(E.date)>=B)}switch((w.readTime[0]>0||w.readTime[1]<999)&&(H=H.filter(B=>{const E=B.readTime||0;return E>=w.readTime[0]&&E<=w.readTime[1]})),y){case"trending":H.sort((B,E)=>B.isTrending&&!E.isTrending?-1:!B.isTrending&&E.isTrending?1:(E.viewCount||0)-(B.viewCount||0));break;case"most-read":H.sort((B,E)=>(E.viewCount||0)-(B.viewCount||0));break;case"oldest":H.sort((B,E)=>new Date(B.date).getTime()-new Date(E.date).getTime());break;case"latest":default:H.sort((B,E)=>new Date(E.date).getTime()-new Date(B.date).getTime())}return H},[s,w,y,C]),N=b.useMemo(()=>n.filter(H=>H.isTrending).slice(0,6),[n]),A=b.useMemo(()=>n.filter(H=>H.isBreaking),[n]),L=Math.ceil(I.length/M),O=I.slice((x-1)*M,x*M),U=H=>{h(B=>{const E=new Set(B);return E.has(H)?E.delete(H):E.add(H),E})},D=H=>{navigator.share?navigator.share({title:H.title,text:H.title,url:H.link}):(navigator.clipboard.writeText(H.link),alert("Article link copied to clipboard!"))},G=H=>{window.open(H.link,"_blank","noopener,noreferrer")},J=()=>{j({categories:[],tags:[],authors:[],companies:[],dateRange:["",""],readTime:[0,999]}),m(1)};return a.jsxs("div",{className:"min-h-screen bg-gray-50",children:[a.jsx(eA,{articles:A}),a.jsx("header",{className:"bg-white shadow-sm border-b border-gray-200",children:a.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Gaming News"}),a.jsx("p",{className:"text-gray-600",children:"Latest news and insights from the gaming industry"})]}),a.jsx("div",{className:"flex items-center space-x-4",children:a.jsxs("button",{onClick:()=>k(u==="card"?"list":"card"),className:"flex items-center px-3 py-2 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition-colors",children:[u==="card"?a.jsx(E2,{className:"w-4 h-4 mr-2"}):a.jsx(We,{className:"w-4 h-4 mr-2"}),u==="card"?"List View":"Card View"]})})]})})}),a.jsx(tA,{articles:N,onArticleClick:G}),a.jsx("main",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:a.jsxs("div",{className:"flex flex-col lg:flex-row gap-8",children:[a.jsx("aside",{className:"lg:w-1/4",children:a.jsx(aA,{filters:w,sortBy:y,categories:f,onFiltersChange:j,onSortChange:p,onClearFilters:J,totalArticles:n.length,filteredArticles:I.length})}),a.jsxs("div",{className:"lg:w-3/4",children:[a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-xl font-semibold text-gray-900",children:"Latest News"}),a.jsxs("p",{className:"text-gray-600 mt-1",children:[I.length," article",I.length!==1?"s":""," found"]})]}),I.length>0?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:u==="card"?"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-6":"space-y-6",children:O.map(H=>a.jsx(rA,{article:H,isBookmarked:d.has(H._id),onToggleBookmark:U,onShare:D,layout:u},H._id))}),L>1&&a.jsx("div",{className:"mt-8 flex justify-center",children:a.jsxs("nav",{className:"flex items-center space-x-2",children:[a.jsx("button",{onClick:()=>m(Math.max(1,x-1)),disabled:x===1,className:"px-3 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),Array.from({length:Math.min(5,L)},(H,B)=>{const E=B+1;return a.jsx("button",{onClick:()=>m(E),className:`px-3 py-2 text-sm font-medium rounded-md ${x===E?"bg-blue-600 text-white":"text-gray-700 bg-white border border-gray-300 hover:bg-gray-50"}`,children:E},E)}),a.jsx("button",{onClick:()=>m(Math.min(L,x+1)),disabled:x===L,className:"px-3 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-md hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})})]}):a.jsxs("div",{className:"text-center py-12",children:[a.jsx(Li,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),a.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No articles found"}),a.jsx("p",{className:"text-gray-600 mb-4",children:"Try adjusting your search criteria or filters to find more articles."}),a.jsx("button",{onClick:J,className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:"Clear All Filters"})]})]})]})})]})},nn=[{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}],wC=({courses:o,onSearchResults:e,onTyping:r,placeholder:i="Search courses, instructors, or topics..."})=>{const[n,c]=b.useState(""),[s,l]=b.useState([]),[d,h]=b.useState(!1);b.useEffect(()=>{if(n.length>0){const k=o.filter(g=>{const M=n.toLowerCase();return g.title.toLowerCase().includes(M)||g.description.toLowerCase().includes(M)||g.instructor.toLowerCase().includes(M)||g.tags.some(C=>C.toLowerCase().includes(M))||g.category.toLowerCase().includes(M)||g.subcategory.toLowerCase().includes(M)});e(k);const x=o.filter(g=>g.title.toLowerCase().includes(n.toLowerCase())).map(g=>g.title).slice(0,3),m=o.flatMap(g=>g.tags).filter(g=>g.toLowerCase().includes(n.toLowerCase())).filter((g,M,C)=>C.indexOf(g)===M).slice(0,3),f=o.filter(g=>g.instructor.toLowerCase().includes(n.toLowerCase())).map(g=>g.instructor).filter((g,M,C)=>C.indexOf(g)===M).slice(0,2);l([...x,...m,...f]),h(!0)}else e(o),l([]),h(!1)},[n,o,e]);const y=k=>{c(k),r==null||r(k.length>0,k)},p=k=>{c(k),h(!1)},u=()=>{c(""),h(!1),r==null||r(!1,"")};return a.jsxs("div",{className:"course-search relative",children:[a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:a.jsx(tt,{className:"h-5 w-5 text-gray-400"})}),a.jsx("input",{type:"text",value:n,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-purple-500 focus:border-purple-500 text-gray-900 placeholder-gray-500",placeholder:i}),n&&a.jsx("button",{onClick:u,className:"absolute inset-y-0 right-0 pr-3 flex items-center",children:a.jsx(at,{className:"h-5 w-5 text-gray-400 hover:text-gray-600"})})]}),d&&s.length>0&&a.jsx("div",{className:"absolute z-10 w-full mt-1 bg-white border border-gray-200 rounded-lg shadow-lg",children:a.jsx("ul",{className:"py-1",children:s.map((k,x)=>a.jsx("li",{children:a.jsx("button",{onClick:()=>p(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:a.jsxs("div",{className:"flex items-center",children:[a.jsx(tt,{className:"h-4 w-4 text-gray-400 mr-2"}),k]})})},x))})}),n&&a.jsxs("div",{className:"mt-2 text-sm text-gray-600",children:['Search results for "',n,'"']})]})},nA=({title:o,subtitle:e,placeholder:r,courses:i=[],onSearchResults:n})=>a.jsx("section",{className:"bg-gradient-to-r from-purple-600 to-indigo-600 py-12",children:a.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[a.jsxs("div",{className:"text-center mb-8",children:[a.jsx("h2",{className:"text-4xl font-bold text-white mb-4",children:o||"Master the IGaming Industry"}),a.jsx("p",{className:"text-xl text-purple-100 max-w-2xl mx-auto",children:e||"Learn from industry experts and advance your career with our comprehensive course catalog"})]}),a.jsx("div",{className:"hidden lg:block max-w-2xl mx-auto",children:i&&n&&a.jsx(wC,{courses:i,onSearchResults:n,placeholder:r||"Search IGaming courses, instructors, or topics..."})})]})}),oA=({categories:o,selectedCategory:e,selectedSubcategory:r,onCategorySelect:i,onSubcategorySelect:n})=>{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),i(h)};return a.jsxs("nav",{className:"course-navigation bg-white rounded-lg shadow-sm border border-gray-200 p-4",children:[a.jsx("h2",{className:"text-lg font-semibold text-gray-900 mb-4",children:"Course Categories"}),a.jsx("div",{className:"space-y-2",children:o.map(h=>{const y=c.has(h.id),p=e===h.id;return a.jsxs("div",{className:"category-group",children:[a.jsxs("button",{onClick:()=>d(h.id),className:`
|
package/dist/index.mjs
CHANGED
|
@@ -37780,8 +37780,8 @@ const hw = ({ position: o, url: e, alt: r, link: i }) => {
|
|
|
37780
37780
|
/* @__PURE__ */ a.jsx("div", { className: "h-8 bg-gray-200 rounded w-full" })
|
|
37781
37781
|
] }, r)) })
|
|
37782
37782
|
] }) }) }), YS = ({ filteredItems: o }) => /* @__PURE__ */ a.jsx("div", { className: "mb-6", children: /* @__PURE__ */ a.jsxs("div", { className: "flex flex-row md:items-center justify-between", children: [
|
|
37783
|
-
/* @__PURE__ */ a.jsx("h1", { className: "text-3xl font-bold text-gray-900 md:mb-0", children: "Job Listings" }),
|
|
37784
|
-
/* @__PURE__ */ a.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ a.jsxs("p", { className: "text-gray-600 mr-4", children: [
|
|
37783
|
+
/* @__PURE__ */ a.jsx("h1", { className: "sm:text-3xl text-xl font-bold text-gray-900 md:mb-0", children: "Job Listings" }),
|
|
37784
|
+
/* @__PURE__ */ a.jsx("div", { className: "flex items-center", children: /* @__PURE__ */ a.jsxs("p", { className: "text-sm text-gray-600 mr-4", children: [
|
|
37785
37785
|
/* @__PURE__ */ a.jsx("span", { className: "font-semibold text-gray-900", children: o.length }),
|
|
37786
37786
|
" jobs found"
|
|
37787
37787
|
] }) })
|
|
@@ -38092,17 +38092,17 @@ const hw = ({ position: o, url: e, alt: r, link: i }) => {
|
|
|
38092
38092
|
/* @__PURE__ */ a.jsx("div", { className: "flex-grow", children: /* @__PURE__ */ a.jsxs("div", { className: "container mx-auto py-8 pb-20 md:pb-8", children: [
|
|
38093
38093
|
/* @__PURE__ */ a.jsx(YS, { filteredItems: k }),
|
|
38094
38094
|
/* @__PURE__ */ a.jsxs("div", { className: "relative", children: [
|
|
38095
|
-
/* @__PURE__ */ a.jsxs("div", { className: "relative flex items-center gap-2 my-6", children: [
|
|
38095
|
+
/* @__PURE__ */ a.jsxs("div", { className: "relative flex items-center gap-2 sm:my-6 my-2", children: [
|
|
38096
38096
|
/* @__PURE__ */ a.jsxs("div", { className: "relative flex-1", children: [
|
|
38097
38097
|
/* @__PURE__ */ a.jsx("div", { className: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none", children: /* @__PURE__ */ a.jsx(tt, { className: "h-4 w-4 text-indigo-500" }) }),
|
|
38098
38098
|
/* @__PURE__ */ a.jsx(
|
|
38099
38099
|
"input",
|
|
38100
38100
|
{
|
|
38101
38101
|
type: "text",
|
|
38102
|
-
className: "text-sm sm:text-base lg:text-sm block w-full pl-
|
|
38102
|
+
className: "text-sm sm:text-base lg:text-sm block w-full pl-8 pr-12 py-3 border border-gray-300 rounded-xl bg-white shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 text-gray-900",
|
|
38103
38103
|
placeholder: "Search for jobs, companies, or keywords...",
|
|
38104
38104
|
value: q,
|
|
38105
|
-
|
|
38105
|
+
onInput: (j) => Xi(j.target.value),
|
|
38106
38106
|
onKeyDown: Ji,
|
|
38107
38107
|
list: "job-suggestions"
|
|
38108
38108
|
}
|
|
@@ -38239,7 +38239,7 @@ const hw = ({ position: o, url: e, alt: r, link: i }) => {
|
|
|
38239
38239
|
className: "block w-full pl-10 pr-3 py-3 border border-gray-300 rounded-lg bg-white shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 text-gray-900",
|
|
38240
38240
|
placeholder: "Search for jobs, companies, or keywords...",
|
|
38241
38241
|
value: q,
|
|
38242
|
-
|
|
38242
|
+
onInput: (j) => Xi(j.target.value),
|
|
38243
38243
|
onKeyDown: Ji,
|
|
38244
38244
|
list: "job-suggestions"
|
|
38245
38245
|
}
|
package/package.json
CHANGED