PageSourceSearch

https://i4u-client-io6g2.ondigitalocean.app/assets/MyPostsCard-9DK4ghRn.js

js i4u-client-io6g2.ondigitalocean.app collected 2026-10-03 14:54:40 UTC 6,770 bytes, 1 lines download raw bytes

1import{v as R,u as E,x as Z,i as q,E as U,s as W,r as c,h as J,w as Q,o as r,b as a,d as e,m as $,t as l,f as b,F as S,g as D,C as X,S as Y,e as ee}from"./index-BNUSfvSO.js";import{u as B}from"./GetArticlesStore-DV_i4idy.js";import{u as te}from"./PublishArticleStore-BOglTkzP.js";import{i as I}from"./index-BdSYyQzq.js";const se=R("deleteArticleStore",{state:()=>({}),getters:{},actions:{async deleteArticle(x){const v=E(),d=Z(),w=B();try{const u=await q.delete(`article/${x}`,{headers:{Authorization:`Bearer ${v.getUserData.token}`}});d.getProfile(),w.getAllArticles(),I.error("Article Deleted")}catch(u){console.log(u),I.error("Error deleting article")}}}}),oe={class:"mb-10 rounded-md bg-white p-5"},ne=e("p",{class:"text-center text-xl"},"Filter",-1),le=e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-6"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 6.75 12 3m0 0 3.75 3.75M12 3v18"})],-1),re=e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-6"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 13.5 12 21m0 0-7.5-7.5M12 21V3"})],-1),ae={class:"grid grid-cols-12 gap-6"},ie=e("div",{class:"i4u-accent bg-accent"},null,-1),ce={class:"subpage-h3 h-22 mb-5 line-clamp-2"},de={class:"text-xs font-bold"},ue={key:0,class:"badge rounded bg-green-500 px-2 py-1 text-white"},pe={key:1,class:"badge rounded bg-gray-500 px-2 py-1 text-white"},he=["innerHTML"],me=["innerHTML"],ge={class:"bg-neutral flex flex-row flex-wrap justify-between gap-2 rounded-full p-4 text-sm text-neutral-500 shadow-inner"},be=["onClick"],ve={class:"dropdown dropdown-end h-0"},ye=["onClick"],_e=e("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"h-6 w-6"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 6.75a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5ZM12 12.75a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5ZM12 18.75a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5Z"})],-1),we=[_e],fe={tabindex:"0",class:"dropdown-content menu bg-base-100 rounded-box z-[1] w-56 p-2 shadow"},ke=["onClick"],xe={class:"form-control"},Ae={class:"dropdown"},Ce={key:0,class:"dropdown-menu border-2 p-3"},Pe={class:"label cursor-pointer"},$e={class:"label-text mr-2"},Se=["id","value","onChange","checked"],De=["onClick"],Ie={id:"deleteArticleModal",class:"modal"},Ee={class:"i4u-card w-96 bg-white"},Be=e("div",{class:"i4u-accent bg-accent"},null,-1),Me={class:"mb-2 text-center text-xl"},Te={class:"mb-4"},je={class:"flex flex-row justify-between gap-4"},Ke={__name:"MyPostsCard",setup(x){const v=U(),d=B(),w=E(),u=te(),M=se(),T=w.userData.organisation.ecosystems,{ecosystemsToPublishTo:p}=W(u),y=c([]);J(async()=>{await d.getAllArticles()}),Q(()=>d.organisationArticles.myOrganisationArticles,s=>{y.value=s.slice()},{immediate:!0});const h=c(!1),A=()=>{h.value?y.value=d.organisationArticles.myOrganisationArticles.slice():y.value=d.organisationArticles.myOrganisationArticles.slice().reverse(),h.value=!h.value},_=c(!1),j=()=>{_.value=!_.value,p.value=[]},L=c([]),N=(s,o)=>o.some(t=>t.ecosystemId===s.ecosystemId),O=(s,o,t,n)=>{if(s.target.checked){p.value.push({name:o.name,ecosystemId:o.ecosystemId});const i=[];p.value.forEach(g=>{i.push({ecosystemId:g.ecosystemId,name:g.name})}),n.publishedIn.forEach(g=>{i.push({ecosystemId:g.ecosystemId,name:g.name})}),u.publishArticleToEcosystem(t,i)}else p.value=p.value.filter(i=>i.ecosystemId!==o.ecosystemId),u.unPublishArticleInEcosystem(t,o.ecosystemId)},G=s=>{const o=s,t=new Date().getTime();v.push({name:"article-details",params:{slug:o},query:{t}})},K=s=>{const o=new Date(s);if(isNaN(o))return"Invalid Date";const t={hour:"2-digit",minute:"2-digit",day:"numeric",month:"numeric",year:"numeric"},n=o.toLocaleString("en-GB",t).replace(",",""),[i,P]=n.split(" ");return`${P}<span class="mx-2 border-r border-neutral-400"></span>${i}`},m=c(!1),V=s=>{m.value=!1,m.value=!m.value,_.value=!1},z=s=>{const t=`${s}--31DBA9A61A385DE438EEDCB1DC43E`,n=new Date().getTime();v.push({name:"article-details",params:{slug:t},query:{t:n}})},f=c(""),k=c(""),H=s=>{f.value=s.title,k.value=s._id,deleteArticleModal.showModal()},C=()=>{f.value="",k.value="",m.value=!1,deleteArticleModal.close()},F=()=>{M.deleteArticle(k.value),C()};return(s,o)=>(r(),a("div",null,[e("section",oe,[ne,h.value?(r(),a("button",{key:0,class:"btn mr-5",onClick:o[0]||(o[0]=t=>A())},[$(l(s.$t("extraKeys.orgPostsSeeNewestPost"))+" ",1),le])):b("",!0),h.value?b("",!0):(r(),a("button",{key:1,class:"btn",onClick:o[1]||(o[1]=t=>A())},[$(l(s.$t("extraKeys.orgPostsSeeOldestPost"))+" ",1),re]))]),e("div",ae,[(r(!0),a(S,null,D(y.value,t=>
1(r(),a("div",{key:t._id,class:"i4u-card col-span-12 flex flex-col justify-between bg-white md:col-span-6 lg:col-span-6 xl:col-span-4"},[e("div",null,[ie,e("h3",ce,l(t.title),1),e("p",de,l(t.subject),1),t.publishedIn.length>0?(r(),a("span",ue,l(s.$t("postPage.publishedText")),1)):b("",!0),t.publishedIn.length===0?(r(),a("span",pe,l(s.$t("postPage.unpublishedText")),1)):b("",!0),e("p",{class:"mb-2 mt-2 text-sm text-gray-500",innerHTML:K(t.updatedAt)},null,8,he),e("div",{class:"mb-3 line-clamp-3",innerHTML:t.content},null,8,me)]),e("div",ge,[e("button",{class:"i4u-link",onClick:n=>G(t._id)},l(s.$t("postPage.seePostButton")),9,be),e("div",ve,[e("div",{tabindex:"0",role:"button",class:"btn btn-circle btn-xs border-none duration-200 ease-in-out hover:bg-neutral-300",onClick:n=>V()},we,8,ye),X(e("ul",fe,[e("li",null,[e("p",{class:"text-blue-600 hover:bg-gray-200",onClick:n=>z(t._id)},l(s.$t("postPage.editPostButton")),9,ke)]),e("li",null,[e("label",xe,[e("div",Ae,[e("button",{onClick:j,class:"dropdown-button"},l(s.$t("extraKeys.orgPostsSelectEcosystem")),1),_.value?(r(),a("div",Ce,[(r(!0),a(S,null,D(ee(T),n=>(r(),a("div",{class:"form-control",key:n.ecosystemId},[e("label",Pe,[e("span",$e,l(n.name),1),e("input",{type:"checkbox",id:`eco-${n.ecosystemId}`,value:n.ecosystemId,onChange:i=>O(i,n,t._id,t),checked:N(n,t.publishedIn),ref_for:!0,ref_key:"checkboxes",ref:L,class:"checkbox checkbox-primary checkbox-sm"},null,40,Se)])]))),128))])):b("",!0)])])]),e("li",null,[e("p",{onClick:n=>H(t),class:"text-red-600 hover:bg-gray-200"},l(s.$t("postPage.deletePostButton")),9,De)])],512),[[Y,m.value]])])])]))),128)),e("dialog",Ie,[e("div",Ee,[Be,e("p",Me,l(f.value),1),e("p",Te,l(s.$t("postPage.deleteWarningText")),1),e("div",je,[e("button",{class:"btn btn-error text-white",onClick:o[2]||(o[2]=t=>F())},l(s.$t("postPage.deleteButton")),1),e("button",{class:"btn btn-primary",onClick:o[3]||(o[3]=t=>C())}
1,l(s.$t("postPage.closeButton")),1)])])])])]))}};export{Ke 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.