1import{u as K,a as Q,b as U,j as e,f as V,T as W,e as X}from"./index-C1k2hFQU.js";import{r as f,o as Z,C as F,p as ee,h as te,i as le,G as ie,P as ae}from"./vendor-icons-CuibVgs-.js";import{u as se}from"./useGetTimeline-CSgO4Mgc.js";import{C as ne}from"./CheckboxDropdown-Cm117nju.js";const me=()=>{var I,H,M,P,R;const{t:l}=K(),{setLoading:w}=Q(),{rounds:b}=U(),{loading:C,getTimeline:A}=se(),[d,S]=f.useState([{_id:1,text:l("timeline.category_filter.options.planner"),name:"planner",icon:e.jsx(Z,{}),checked:!0,applied:!0},{_id:2,text:l("timeline.category_filter.options.web"),name:"web",icon:e.jsx(F,{}),checked:!0,applied:!0},{_id:3,text:l("timeline.category_filter.options.sem"),name:"sem",icon:e.jsx(ee,{}),checked:!0,applied:!0},{_id:4,text:l("timeline.category_filter.options.email"),name:"email",icon:e.jsx(te,{}),checked:!0,applied:!0},{_id:6,text:l("smm_label"),name:"smm",icon:e.jsx(le,{}),checked:!0,applied:!0},{_id:8,text:l("community_label"),name:"cm",icon:e.jsx(ie,{}),checked:!0,applied:!0},{_id:5,text:l("timeline.category_filter.options.affiliate"),name:"affiliate",icon:e.jsx(ae,{}),checked:!0,applied:!0}]),[r,k]=f.useState({active:{_id:-1,text:l("terms.round.filter.all")},options:[{_id:-1,text:l("terms.round.filter.all")}],selected:{_id:-1,text:l("terms.round.filter.all")}}),[m,L]=f.useState({value:"",applied:""}),[n,g]=f.useState({active:null,applied:null}),[y,E]=f.useState([]),[v,T]=f.useState(!1),D=[{id:1,text:l("timeline.tag_types.insertion"),default_display:!0,search_text:"created a new marketing plan",field_id:1},{id:2,text:l("timeline.tag_types.removal"),active:!1,search_text:"deleted a marketing plan",field_id:1},{id:3,text:l("timeline.tag_types.insertion"),default_display:!0,search_text:"created the %% page",field_id:2},{id:4,text:l("timeline.tag_types.removal"),default_display:!0,search_text:"deleted the %% page",field_id:2},{id:5,text:l("timeline.tag_types.price_edit"),default_display:!0,search_text:"changed the price for the %% product",field_id:2},{id:6,text:l("timeline.tag_types.content_edit"),active:!1,search_text:"modified the %% content on the %% page",field_id:2},{id:7,text:l("timeline.tag_types.content_removal"),active:!1,search_text:"deleted the %% element",field_id:2},{id:8,text:l("timeline.tag_types.insertion"),default_display:!0,search_text:"campaign has %% keywords",field_id:3},{id:9,text:l("timeline.tag_types.removal"),active:!1,search_text:"deleted the %% campaign",field_id:3},{id:10,text:l("timeline.tag_types.edit"),active:!1,search_text:"modified the %% campaign",field_id:3},{id:11,text:l("timeline.tag_types.insertion"),default_display:!0,search_text:"created an affiliate campaign",field_id:5},{id:12,text:l("timeline.tag_types.removal"),active:!1,search_text:"deleted the affiliate campaign",field_id:5},{id:13,text:l("timeline.tag_types.edit"),active:!1,search_text:"updated %% affiliate",field_id:5}].filter(t=>{var s,x;let a=!0,i=!1;for(let c=0;c<d.length;c++){const{_id:h,checked:u}=d[c];h===(t==null?void 0:t.field_id)&&u&&(i=!0),u||(a=!1)}return((s=n==null?void 0:n.active)==null?void 0:s.id)===(t==null?void 0:t.id)||((x=n==null?void 0:n.applied)==null?void 0:x.id)===(t==null?void 0:t.id)?!0:a?t.default_display:!!i});let p=!0;if(p)for(let t=0;t<d.length;t++){const{checked:a,applied:i}=d[t];if(a!==i){p=!1;break}}p&&m.value!==m.applied&&(p=!1),p&&((I=n==null?void 0:n.active)==null?void 0:I.id)!==((H=n==null?void 0:n.applied)==null?void 0:H.id)&&(p=!1),p&&((M=r==null?void 0:r.active)==null?void 0:M._id)!==((P=r==null?void 0:r.selected)==null?void 0:P._id)&&(p=!1);let N=d.filter(t=>t.applied).map(t=>t.text).join(", ");N||(N=l("all"));const $=t=>{let a=!0;for(let i=0;i<d.length;i++){const{checked:s}=d[i];if(!s){a=!1;break}}S(i=>i.map(s=>a?s._id===t._id?{...s,checked:!0}:{...s,checked:!1}:s._id===t._id?{...s,checked:!s.checked}:s)),g(i=>({...i,active:null}))},B=t=>{k(a=>({...a,selected:t}))},Y=t=>{var a;((a=n==null?void 0:n.active)==null?void 0:a.id)===(t==null?void 0:t.id)?g(i=>({...i,active:null})):g(i=>({...i,active:t}))},O=async(t,a,i,s,x,c)=>{if(C)return;w(!0);let h=s;x&&(h=`${x}%%${s}`);let u=null,_=null;c._id!==-1&&(u=c.no,c.practice?_=1:_=0);try{const o=await A(t,a,h,i,u,_);typeof(o==null?void 0:o.timeline)=="string"?T(!0):typeof(o==null?void 0:o.timeline)=="object"&&E(j=>[...j,...o.timeline]),w(!1)}catch(o){console.log(o),w(!1)}},G=()=>{var a;const t=d.filter(i=>i.checked).map(i=>i.name).join(",").toLocaleLowerCase();S(i=>i.map(s=>({...s,applied:s.checked}))),L(i=>({...i,applied:i.value})),g(i=>({...i,applied:i.active})),E([]),T(!1),k(i=>({...i,active:i.selected})),O(0,10,t,m==null?void 0:m.value,(a=n==null?void 0:n.active)==null?void 0:a.search_text,r.selected)};return f.useEffect(()=>{if(b.available.length){const t=b.available.map(a=>({...a,text:a.name_long}));k(a=>
1({...a,options:[...t,{_id:-1,text:l("terms.round.filter.all")}],active:{_id:-1,text:l("terms.round.filter.all")},selected:{_id:-1,text:l("terms.round.filter.all")}}))}},[b]),f.useEffect(()=>{G()},[]),f.useEffect(()=>{if(!v){const t=()=>{var a;if(window.innerHeight+window.scrollY>=document.documentElement.scrollHeight){const i=d.filter(s=>s.applied).map(s=>s.name).join(",").toLocaleLowerCase();O(y.length,10,i,m==null?void 0:m.applied,(a=n==null?void 0:n.applied)==null?void 0:a.search_text,r==null?void 0:r.active)}};return window.addEventListener("scroll",t),()=>{window.removeEventListener("scroll",t)}}},[v,y,d,m,n,r]),e.jsxs("div",{className:"p-5 w-full mx-auto max-w-[1400px] flex flex-col gap-5 min-h-[calc(100vh-64px)]",children:[e.jsx("h1",{className:"text-primary-dark font-semibold text-2xl md:text-4xl",children:l("timeline.header")}),e.jsxs("section",{className:"grid grid-cols-1 min-[500px]:grid-cols-2 gap-5 md:grid-cols-3 lg:flex items-end",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("h2",{className:"font-medium text-primary-dark px-5 max-w-52",children:l("timeline.category_filter.title",{selected_options:e.jsx("span",{className:"text-gray-500 font-normal text-xs",dangerouslySetInnerHTML:{__html:N}})})}),e.jsx(ne,{textContent:l("timeline.category_filter.dropdown_title"),options:d,selectOption:$})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("h2",{className:"font-medium text-primary-dark ml-5",children:l("terms.round.filter.title")}),e.jsx(V,{textContent:((R=r==null?void 0:r.selected)==null?void 0:R.text)||l("terms.round.filter.default_value"),options:r.options,selectOption:B,activeOption:r.selected,className:"min-w-[160px]"})]}),e.jsxs("div",{className:"flex flex-col gap-1 col-span-full md:col-span-1 md:max-w-[264px] w-full",children:[e.jsx("h2",{className:"font-medium text-primary-dark ml-5",children:l("timeline.search_filter.title")}),e.jsx("input",{type:"text",className:"input w-full",placeholder:l("search_min_3_characters"),value:m.value,onChange:t=>L(a=>({...a,value:t.target.value}))})]}),e.jsx("button",{className:"btn-primary border border-primary transition-[colors,opacity] uppercase col-span-full w-full lg:w-max disabled:bg-white disabled:text-primary disabled:opacity-30",onClick:G,disabled:C||p,children:l("terms.apply_filters_btn")})]}),e.jsx("section",{className:"flex items-center flex-wrap gap-2.5",children:D.map(t=>{var x;const{id:a,field_id:i,text:s}=t;return e.jsxs("button",{className:"px-3 pr-2 py-1 bg-primary-dark text-primary-foreground rounded-full flex items-center gap-1 text-sm opacity-40 transition-opacity data-[active=true]:opacity-100 hover:opacity-100 data-[active=true]:bg-orange-500","data-active":((x=n==null?void 0:n.active)==null?void 0:x.id)===a,onClick:()=>Y(t),children:[s,e.jsx("span",{className:"text-xl",children:d.find(c=>c._id===i).icon})]},a)})}),y.length===0&&!v?e.jsx(W,{}):e.jsx("ul",{className:"flex flex-col overflow-hidden gap-2.5",children:y.map((t,a)=>{const{fName:i,lName:s,team_color:x,category_icon:c,message:h,courseName:u,round_no:_,date:o,old_msg:j,new_msg:z,old_date:q}=t,J=i+" "+s;return e.jsxs("li",{className:"w-full bg-slate-50 p-5 shadow-md rounded-md flex flex-col gap-5 relative even:bg-gray-200",children:[e.jsxs("header",{className:"col-span-full flex items-center justify-between flex-wrap gap-2.5",children:[e.jsxs("div",{className:"flex items-center gap-5",children:[e.jsx(X,{src:c,alt:"action category ilustration",width:28,height:28}),e.jsx("h3",{style:{backgroundColor:x,textShadow:"0 0 5px black"},className:"text-white px-4 py-1 rounded-full",children:J})]}),e.jsx("p",{className:"font-medium md:text-lg text-center",children:l("timeline.entry.course_name",{course_name:e.jsx("span",{className:"font-normal",children:u})})}),e.jsx("p",{className:"font-medium md:text-lg text-center",children:l("timeline.entry.round_name",{round_no:e.jsx("span",{className:"font-normal",children:_})})}),e.jsx("p",{className:"font-medium md:text-lg text-center",children:l("timeline.entry.date",{date:e.jsx("span",{className:"font-normal",children:o})})})]}),e.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center gap-5",children:[e.jsx("h3",{dangerouslySetInnerHTML:{__html:h},className:"text-primary text-lg first-letter:capitalize text-center"}),q&&z&&j?e.jsxs("div",{className:"grid grid-cols-2 w-full",children:[e.jsxs("div",{className:"p-2 border-r border-gray-600 flex flex-wrap justify-center gap-5",children:[e.jsx("h4",{className:"text-primary-dark font-semibold text-xl text-center",children:l("timeline.entry.new_value_label")}),e.jsx("div",{className:"text-center text-xl font-medium text-primary text-wrap overflow-hidden break-words flex items-center justify-center",dangerouslySetInnerHTML:{__html:z}})]}),e.jsxs("div",{className:"p-2 flex flex-wrap justify-center gap-5",children:[e.jsx("h4",{className:"text-primary-dark font-semibold text-xl text-center",children:l("timeline.entry.old_value_label")}),e.jsx("div",{className:"text-center text-xl font-medium text-primary text-wrap overflow-hidden break-words flex items-center justify-center",dangerouslySetInnerHTML:{__html:j}})]})]}):null]})]},a)})}),v?e.jsx("h2",{className:"text-red-700 text-2xl md:text-4xl text-center mx-auto py-6",children:l("timeline.end")}):null]})};export{me 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.