PageSourceSearch

https://mgbase.org/dist/assets/index-DoURpb0f.js

js mgbase.org collected 2026-10-04 02:20:49 UTC 10,761 bytes, 1 lines download raw bytes

1import{r as l,R as Q}from"./loadcontainer-B527L2Bl.js";import{u as B,R as H,L as Y}from"./LoadingSpinner-CZT6yKvm.js";import{S as ee}from"./SearchInput-C9Wc8hXI.js";import{j as s,a as e,c as m,F as T}from"./clsx-BPjMV_GL.js";import{a as O,b as $}from"./index-Bbt1RjNQ.js";import{u as G}from"./UseIntersectionObservable-C8OhJUNP.js";import"./main-58z99rzH.js";const te=({searchTerm:o,setSearchTerm:f,selectedStatus:t,setSelectedStatus:i,selectedStudyType:u,setSelectedStudyType:x,studyTypes:b,statuses:d})=>{const c=B(992);return s("div",{className:m(c?"grid":"flex","w-full gap-[16px] max-w-full mb-8"),children:[e(ee,{value:o,onChange:f,placeholder:"Search..."}),s("div",{className:m(c?"w-full":"w-1/4","transition-all duration-300"),children:[e("label",{className:"block mb-1 text-sm font-medium text-gray-700",children:"Study type"}),e(H,{options:b,placeholder:"All",selected:u,onSelect:n=>{x(n.id)}})]}),s("div",{className:m(c?"w-full":"w-1/4","transition-all duration-300"),children:[e("label",{className:"block mb-1 text-sm font-medium text-gray-700",children:"Status"}),e(H,{placeholder:"All",options:d,selected:t,onSelect:n=>i(n)})]})]})},ae=()=>s("div",{className:m("hidden lg:flex w-full gap-[16px] bg-[rgba(var(--footer-bg-color1),1)] text-white font-bold text-[1rem] leading-[1.5rem] p-[16px] rounded z-0"),children:[e("div",{className:"flex-1 shrink basis-0",children:e("span",{className:"body-sm_tight",children:"Sub-study"})}),e("div",{className:"w-[120px]",children:e("span",{className:"body-sm_tight",children:"Date started"})}),e("div",{className:"w-[200px]",children:e("span",{className:"body-sm_tight",children:"Group leader"})}),e("div",{className:"w-[100px] text-center",children:e("span",{className:"body-sm_tight",children:"Centres"})}),e("div",{className:"w-[90px] text-center",children:e("span",{className:"body-sm_tight",children:"Patients"})}),e("div",{className:"w-[48px]"})]}),F=({text:o,children:f})=>{const[t,i]=l.useState(!1);return s("div",{style:{position:"relative",display:"inline-block",cursor:"pointer"},onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:[f," ",t&&s("div",{style:{position:"absolute",top:"100%",left:"50%",transform:"translateX(-50%)",backgroundColor:"white",color:"black",textAlign:"center",padding:"4px 16px",borderRadius:"4px",boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.15)",border:"1px solid #ddd",whiteSpace:"nowrap",zIndex:"99999",fontSize:"12px",lineHeight:"175%",fontWeight:700,opacity:t?1:0,visibility:t?"visible":"hidden",transition:"opacity 0.2s ease-in-out, visibility 0.2s ease-in-out"},children:[o," ",e("div",{style:{content:'""',position:"absolute",bottom:"100%",left:"50%",transform:"translateX(-50%)",borderWidth:"8px",borderStyle:"solid",borderColor:"transparent transparent white transparent"}})]})]})},_=()=>e("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M13.0008 2.03003V4.05003C17.3908 4.59003 20.5008 8.58003 19.9608 12.97C19.5008 16.61 16.6408 19.5 13.0008 19.93V21.93C18.5008 21.38 22.5008 16.5 21.9508 11C21.5008 6.25003 17.7308 2.50003 13.0008 2.03003ZM11.0008 2.06003C9.05078 2.25003 7.19078 3.00003 5.67078 4.26003L7.10078 5.74003C8.22078 4.84003 9.57078 4.26003 11.0008 4.06003V2.06003ZM4.26078 5.67003C3.01122 7.18785 2.24187 9.04334 2.05078 11H4.05078C4.24078 9.58003 4.80078 8.23003 5.69078 7.10003L4.26078 5.67003ZM15.5008 8.50003L10.6208 13.38L8.50078 11.26L7.44078 12.32L10.6208 15.5L16.5608 9.56003L15.5008 8.50003ZM2.06078 13C2.26078 14.96 3.03078 16.81 4.27078 18.33L5.69078 16.9C4.80763 15.7697 4.24464 14.4227 4.06078 13H2.06078ZM7.10078 18.37L5.67078 19.74C7.18575 21.0024 9.04014 21.7887 11.0008 22V20C9.57816 19.8162 8.23114 19.2532 7.10078 18.37Z",fill:"white"})}),z=()=>e("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M10.6 16.6L17.65 9.55L16.25 8.15L10.6 13.8L7.75 10.95L6.35 12.35L10.6 16.6ZM12 22C10.6167 22 9.31667 21.7373 8.1 21.212C6.88334 20.6867 5.825 19.9743 4.925 19.075C4.025 18.1757 3.31267 17.1173 2.788 15.9C2.26333 14.6827 2.00067 13.3827 2 12C1.99933 10.6173 2.262 9.31733 2.788 8.1C3.314 6.88267 4.02633 5.82433 4.925 4.925C5.82367 4.02567 6.882 3.31333 8.1 2.788C9.318 2.26267 10.618 2 12 2C13.382 2 14.682 2.26267 15.9 2.788C17.118 3.31333 18.1763 4.02567 19.075 4.925C19.9737 5.82433 20.6863 6.88267 21.213 8.1C21.7397 9.31733 22.002 10.6173 22 12C21.998 13.3827 21.7353 14.6827 21.212 15.9C20.6887 17.1173 19.9763 18.1757 19.075 19.075C18.1737 19.9743 17.1153 20.687 15.9 21.213C14.6847 21.739 13.3847 22.0013 12 22Z",fill:"white"})}),se=Q.memo(({index:o,expandedRows:f,study:t,onToggleExpand:i,isHighlighted:u,animationSettings:x})=>{const[b,d]=l.useState(!1),c=B(991),n=f[o]||!1,w=m(c?"gap-[0.5rem]":"gap-[1rem]",u||b||n?"bg-[rgba(var(--c1-bg-color1),1)]":"bg-transparent",c?"grid":"flex"),p=m("self-stretch flex items-center justify-center gap-2 w-[48px] h-[48px] my-auto p-[12px] rounded-full relative !z-[99999]",t.isComplete===!1?"c4-bg":"bg-[rgba(150,202,79,1)]"),{isVisible:v,elementRef:L}=G(0),{animationClass:k="",animationStyle:C="",animationDelay:M=0,animationDuration:I=0}=x||{};return s("div",{ref:L,className:`!border-b !border-b-[#e5e5e5] ${k} ${v?`animated ${C}`:""}`,"data-os-animation":C,"data-os-animation-delay":M,"data-os-animation-duration":I,children:[e("div",{className:m(w,"w-full items-center cursor-pointer flex-wrap p-[16px] text-base font-normal"),onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),onClick:()=>i(o),children:c?s(T,{children:[s("div",{className:"flex w-full gap-[16px]",children:[e("div",{className:"text-base font-bold tracking-normal self-stretch my-auto flex-1 flex-shrink flex-grow-[6%]",children:t.title}),e("div",{className:p,children:e(F,{text:t.isComplete?"Complete":"Ongoing",children:e("div",{className:p,children:t.isComplete?e(z,{}):e(_,{})})})})]}),e("div",{className:"w-full text-sm font-normal",children:e("div",{className:"flex flex-col gap-2",children:[{label:"Date started:",value:t.date},{label:"Group leader:",value:t.leader},{label:"Centres:",value:t.centres},{label:"Patients:",value:t.patients}].map((h,R)=>s("div",{className:"flex max-w-full w-[252px] items-start gap-3 flex-wrap",children:[e("div",{className:"w-[92px] flex-shrink-0 flex",children:h.label}),e("div",{className:"flex-1 flex-shrink basis-0 my-auto break-words",children:h.value})]},R))})}),!n&&s("a",{onClick:h=>{h.stopPropagation(),i(o)},className:"btn boxed-btn btn-md c1-btn-bg c1-btn-bg-solid c1-btn-bg-hover-solid c1-btn-text c1-btn-borders w-full mt-4",children:[e("span",{}),"Objectives ",e(O,{})]})]}):s(T,{children:[e("div",{className:p,children:e(F,{text:t.isComplete?"Complete":"Ongoing",children:e("div",{className:p,children:t.isComplete?e(z,{}):e(_,{})})})}),e("div",{className:"tracking-normal self-stretch my-auto flex-1 flex-shrink flex-grow-[6%]",children:t.title}),e("div",{className:"self-stretch w-[120px] my-auto text-left",children:t.date}),e("div",{className:"self-stretch w-[200px] my-auto text-left",children:t.leader}),e("div",{className:"self-stretch w-[100px] my-auto text-center",children:t.centres}),e("div",{className:"self-stretch w-[100px] my-auto text-center",children:t.patients}),e("button",{onClick:h=>{h.stopPropagation(),i(o)},className:m("!border !border-[rgba(var(--base-btn-borders),1)] !rounded-full w-10 h-10 flex items-center justify-center text-[rgba(var(--base-heading),
11)]",b||n?"bg-[rgba(var(--base-btn-bg-color1),1)]":"bg-transparent"),children:n?e($,{}):e(O,{})})]})}),t.objectives&&s("div",{className:m("sub-study-details flex w-full text-base font-normal tracking-normal flex-wrap px-[16px] pt-0 bg-[rgba(var(--c1-bg-color1),1)] overflow-hidden",n?"row-expanded pb-3":"row-collapsed"),children:[s("div",{className:m(c?"grid":"flex","bg-white w-full p-6 rounded-lg transition-all duration-300 ease-in-out"),children:[e("div",{className:"leading-7 w-[120px] font-bold mb-2",children:"Objectives"}),e("div",{className:"leading-6 flex-1 w-full flex-shrink",children:t.objectives})]}),c&&n&&s("a",{onClick:()=>i(o),className:"btn boxed-btn btn-md base-btn-bg base-btn-bg-solid base-btn-bg-hover-solid base-btn-text base-btn-borders w-full mt-4",children:[e("span",{}),"Close ",e($,{})]})]})]})}),be=({apiEndpoint:o,animationClass:f,animationDelay:t,animationDuration:i,animationStyle:u})=>{const[x,b]=l.useState(!0),[d,c]=l.useState(""),[n,w]=l.useState("All"),[p,v]=l.useState(0),[L]=l.useState(["All","Ongoing","Complete"]),[k]=l.useState([{id:0,name:"All"},{id:1,name:"Thematic"},{id:2,name:"Regional"},{id:3,name:"Collaborative"}]),{isVisible:C,elementRef:M}=G(0),[I,h]=l.useState(!1),[R,le]=l.useState(null),[A,U]=l.useState([]),[P,j]=l.useState([]),[D,E]=l.useState(1),[W,X]=l.useState({}),S=12;l.useEffect(()=>{(async()=>{try{b(!0);const a=await fetch(o);if(!a.ok)throw new Error("Network response was not ok");const g=(await a.json()).map(Z=>({...Z,date:new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric"}).format(new Date(Z.date))}));U(g),j(g.slice(0,S)),b(!1)}catch(a){console.error("Error fetching data:",a),b(!1)}})()},[o]);const V=()=>{let r=A;if(d&&(r=r.filter(a=>a.title.toLowerCase().includes(d.toLowerCase())||a.date.toLowerCase().includes(d.toLowerCase())||a.leader.toLowerCase().includes(d.toLowerCase()))),p!==0&&(r=r.filter(a=>a.category===p)),n!=="All"){const a=n==="Complete";r=r.filter(y=>y.isComplete===a)}return r},q=async()=>{h(!0);const r=D+1,a=D*S,y=a+S;await new Promise(g=>setTimeout(g,500)),j(g=>[...g,...V().slice(a,y)]),E(r),h(!1)},N=V(),J=()=>{c(""),w("All"),v(0)},K=r=>{X(a=>({...a,[r]:!a[r]}))};return l.useEffect(()=>{j(N.slice(0,S)),E(1)},[d,n,p,A]),s("div",{className:"relative min-h-[400px]",children:[(x||I)&&e(Y,{}),e(te,{searchTerm:d,setSearchTerm:c,selectedStatus:n,setSelectedStatus:w,selectedStudyType:p,setSelectedStudyType:v,statuses:L,studyTypes:k}),e("div",{ref:M,className:`relative flex flex-col w-full items-stretch max-w-full ${f} ${C?`animated ${u}`:""}`,"data-os-animation":u,"data-os-animation-delay":t,"data-os-animation-duration":i,children:N.length>0?s(T,{children:[e(ae,{}),P.map((r,a)=>e(se,{study:r,index:a,expandedRows:W,onToggleExpand:K,isHighlighted:R===a,animationSettings:{animationClass:f,animationStyle:u,animationDelay:t,animationDuration:i}},a)),P.length<N.length&&e("div",{className:"flex justify-center mt-4",children:s("button",{className:"btn boxed-btn btn-md base-btn-bg-solid base-btn-bg-hover-solid base-btn-text base-btn-borders base-btn-bg",onClick:q,children:[e("span",{}),"Load More"]})})]}):s("div",{className:"text-center mt-8 text-lg",children:["No data found",N.length<1&&e("p",{className:"cursor-pointer",children:e("u",{children:e("a",{onClick:J,children:"Clear filters"})})})]})})]})};export{be 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.