1import{z as f,L as i,p as g,A as b,x as j,a as o}from"./chunk-C37GKA54-D2LK5B3g.js";import{j as e}from"./jsx-runtime-D_zvdyIk.js";import{F as N}from"./index.es-DUobflWi.js";import{a as w}from"./index-BkXaYIu9.js";import{J as y}from"./JobSearchForm-JMA66mg7.js";import{L as v}from"./Loading-DMYIjeI-.js";const S=({resultsCount:t,keyword:r})=>t>0?e.jsxs("div",{className:"font-extralight border rounded-[5px] border-[#e3e3e3] bg-[#f5f5f5] p-4.5 mt-5 mb-4.5",children:["Found ",e.jsx("span",{className:"font-semibold",children:t})," result",t>1?"s":"",' for "',e.jsx("span",{className:"font-semibold",children:r}),'"']}):e.jsx("div",{className:"font-extralight border rounded-[5px] border-[#e3e3e3] bg-[#f5f5f5] p-4.5 mt-5",children:"There are no results matching your search criteria. Please try searching again."}),L=({results:t})=>{const r=f();return t.length===0?null:e.jsx("ul",{className:"font-semibold",children:t.map(a=>e.jsxs("li",{className:"group relative border-b border-b-[#cccccc] p-5 hover:bg-[#1e8cd3] hover:text-white",children:[e.jsx("h3",{className:"text-[23px] pb-4.5",children:e.jsxs(i,{to:`/job-details/${a.id}`,state:r.search,children:[e.jsx("span",{className:"absolute inset-0 z-10"}),a.jobTitle]})}),e.jsxs("p",{className:"text-[14.4px] mb-2.5",children:["Closing Date: ",e.jsx("span",{className:"text-[#777777] group-hover:text-white",children:new Date(a.closingDate).toLocaleDateString()})]}),e.jsxs("p",{className:"text-[14.4px] mb-2.5",children:["Location: ",e.jsx("span",{className:"text-[#777777] group-hover:text-white",children:a.location})]}),e.jsxs("p",{className:"text-[14.4px] mb-2.5",children:["Salary: ",e.jsx("span",{className:"text-[#777777] group-hover:text-white",children:a.salary})]})]},a.id))})},J=g(()=>{const[t]=b(),r=t.get("keyword"),a=j(),[n,d]=o.useState([]),[x,c]=o.useState(!1),[l,m]=o.useState(null);return o.useEffect(()=>{r&&(c(!0),fetch(`/jobs/search?keyword=${encodeURIComponent(r)}`).then(s=>{if(!s.ok)throw new Error(`Error: ${s.status} ${s.statusText}`);return s.json()}).then(s=>{const h=s.sort((p,u)=>new Date(p.closingDate).getTime()-new Date(u.closingDate).getTime());d(h)}).catch(s=>m(`An unexpected error occurred: ${s.message}`)).finally(()=>c(!1)))},[r]),e.jsxs(e.Fragment,{children:[e.jsx("title",{children:"Research - Search results"}),e.jsx("h1",{className:"text-[39px] font-extralight pt-5 pb-4",children:"Search results"}),e.jsx(y,{onSubmit:s=>a(`/results?keyword=${encodeURIComponent(s)}`)}),x?e.jsx(v,{}):e.jsxs(e.Fragment,{children:[e.jsx(S,{resultsCount:n.length,keyword:r}),e.jsx(L,{results:n})]}),l&&e.jsx("div",{className:"text-red-500 py-2",children:l}),e.jsx("div",{className:"py-10",children:e.jsx(i,{to:"/",children:e.jsxs("button",{className:`rounded-[5px] border border-header-grey bg-header-grey text-white 2 text-[14px] font-semibold h-1/3 w-full md:w-1/4 px-2.5 py-[5px] cursor-pointer`,children:[e.jsx(N,{icon:w})," Home"]})})})]})});export{J as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.