6 lines
6.7 KiB
JavaScript
6 lines
6.7 KiB
JavaScript
import{a as D}from"./chunk-YEESETR2.js";import{c as I,f as k,i as M}from"./chunk-ZEULGWAI.js";import{a as T}from"./chunk-MBEC6LK4.js";import{Aa as w,Ba as x,Eb as l,Fa as a,Gb as s,Oa as v,T as p,Ta as y,U as u,Ya as g,ca as f,db as h,fb as _,jb as m,kb as n,lb as r,mb as o,nb as b,ob as C,qc as E,rc as A,sb as d,xc as S}from"./chunk-TVKQFRWX.js";import"./chunk-DAQOROHW.js";function U(i,t){i&1&&(n(0,"div",0)(1,"div",3)(2,"div",4),o(3,"div",5)(4,"div",6)(5,"div",7),n(6,"div",8),o(7,"div",9)(8,"div",9)(9,"div",10),r()()()())}function R(i,t){if(i&1&&(n(0,"p",23),l(1),r()),i&2){let e=d(2);a(),s(" ",e.article().summary," ")}}function V(i,t){if(i&1&&o(0,"img",31),i&2){let e=t.$implicit,c=d(2).ngIf,L=d(2);m("src",L.getImageUrl(e.imageUrl),x)("alt",c.title)}}function z(i,t){if(i&1&&(b(0),n(1,"div",29),g(2,V,1,2,"img",30),r(),C()),i&2){let e=d().ngIf;a(2),m("ngForOf",e.images)}}function B(i,t){if(i&1&&(b(0),n(1,"div",32),p(),n(2,"svg",33),o(3,"path",34),r(),u(),n(4,"p",35),l(5),r(),n(6,"a",36),l(7," Ouvrir le PDF "),r()(),C()),i&2){let e=d().ngIf,c=d(2);a(5),s(" ",e.title," "),a(),m("href",c.getImageUrl(e.featuredImage),x)}}function F(i,t){if(i&1&&(n(0,"div",27),g(1,z,3,1,"ng-container",28)(2,B,8,2,"ng-container",28),r()),i&2){let e=t.ngIf;a(),m("ngIf",e.category==="ACTUALITE"&&e.images.length>0),a(),m("ngIf",e.category!=="ACTUALITE")}}function H(i,t){if(i&1&&(n(0,"section",1)(1,"div",3)(2,"div",11)(3,"div",12)(4,"h1",13),l(5),r(),o(6,"hr",14),n(7,"div",15)(8,"span",16),p(),n(9,"svg",17),o(10,"path",18),r(),l(11),r(),u(),n(12,"span",19),l(13),r(),n(14,"span",16),p(),n(15,"svg",20),o(16,"path",21)(17,"path",22),r(),l(18),r()(),u(),o(19,"hr",14),h(20,R,2,1,"p",23),g(21,F,3,2,"div",24),n(22,"article",25),o(23,"div",26),r()()()()()),i&2){let e=d();a(5),s(" ",e.article().title," "),a(6),s(" ",e.formatDate(e.article().publishedAt||e.article().createdAt)," "),a(2),s(" ",e.getCategoryLabel(e.article().category)," "),a(5),s(" ",e.article().viewCount," vues "),a(2),_(e.article().summary?20:-1),a(),m("ngIf",e.article()),a(2),m("innerHTML",e.formatContent(e.article().content),w)}}function N(i,t){i&1&&(n(0,"div",2),p(),n(1,"svg",37),o(2,"path",38),r(),u(),n(3,"h2",39),l(4,"Article non trouv\xE9"),r(),n(5,"p",40),l(6,"L'article que vous recherchez n'existe pas ou a \xE9t\xE9 supprim\xE9."),r(),n(7,"a",41),l(8,"Voir toutes les actualit\xE9s"),r()())}var j=class i{constructor(t,e){this.route=t;this.apiService=e}article=f(null);loading=f(!0);API_URL=T.FileUrl;ngOnInit(){let t=this.route.snapshot.params.id;t&&this.loadArticle(+t)}loadArticle(t){this.apiService.getArticleById(t).subscribe({next:e=>{e.success&&this.article.set(e.data),this.loading.set(!1)},error:()=>this.loading.set(!1)})}getCategoryLabel(t){return{ACTUALITE:"Actualit\xE9",COMMUNIQUE:"Communiqu\xE9",EVENEMENT:"\xC9v\xE9nement",PROJET:"Projet",RAPPORT:"Rapport",DISCOURS:"Discours"}[t]||t}formatDate(t){return t?new Date(t).toLocaleDateString("fr-FR",{day:"numeric",month:"long",year:"numeric"}):""}formatContent1(t){return t?t.split(`
|
|
|
|
`).map(e=>`<p>${e}</p>`).join(""):""}formatContent(t){return t?(t=t.replace(/\r\n/g,`
|
|
`).replace(/\r/g,`
|
|
`),t.split(/\n+/).map(c=>`<p>${c.trim()}</p>`).join("")):""}getImageUrl(t){return console.log(t),t?this.API_URL+t:null}static \u0275fac=function(e){return new(e||i)(v(I),v(D))};static \u0275cmp=y({type:i,selectors:[["app-detail-article"]],decls:3,vars:1,consts:[[1,"py-20"],[1,"py-12","bg-neutral-50"],[1,"py-20","text-center"],[1,"container","mx-auto","px-4"],[1,"max-w-3xl","mx-auto","animate-pulse"],[1,"h-8","bg-neutral-200","rounded","w-1/4","mb-4"],[1,"h-12","bg-neutral-200","rounded","w-3/4","mb-6"],[1,"h-64","bg-neutral-200","rounded-xl","mb-8"],[1,"space-y-4"],[1,"h-4","bg-neutral-200","rounded","w-full"],[1,"h-4","bg-neutral-200","rounded","w-2/3"],[1,"grid","grid-cols-1","lg:grid-cols-3","gap-8"],[1,"lg:col-span-2","space-y-6"],[1,"text-3xl","lg:text-4xl","font-bold","text-black","leading-tight"],[1,"border-t-2","border-gray-300","my-2"],[1,"flex","items-center","gap-4","text-sm","text-neutral-500","mb-2"],[1,"flex","items-center","gap-1"],["fill","none","stroke","currentColor","viewBox","0 0 24 24",1,"w-4","h-4","inline-block"],["stroke-linecap","round","stroke-linejoin","round","stroke-width","2","d","M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"],[1,"px-2","py-0.5","bg-[#00843B]/10","text-[#00843B]","font-semibold","rounded-full"],["fill","none","stroke","currentColor","viewBox","0 0 24 24",1,"w-4","h-4"],["stroke-linecap","round","stroke-linejoin","round","stroke-width","2","d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"],["stroke-linecap","round","stroke-linejoin","round","stroke-width","2","d","M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"],[1,"text-black","text-lg","leading-relaxed","text-justify","mb-6"],["class","flex items-center justify-center overflow-hidden",4,"ngIf"],[1,"max-w-none","text-black","content-article","text-base","leading-relaxed","text-justify"],[3,"innerHTML"],[1,"flex","items-center","justify-center","overflow-hidden"],[4,"ngIf"],[1,"w-full","h-full","flex","flex-col","gap-4","p-2"],["class","w-full max-h-[450px] object-cover rounded-xl shadow-md transition-transform duration-300 hover:scale-[1.02]",3,"src","alt",4,"ngFor","ngForOf"],[1,"w-full","max-h-[450px]","object-cover","rounded-xl","shadow-md","transition-transform","duration-300","hover:scale-[1.02]",3,"src","alt"],[1,"flex","flex-col","items-center","justify-center","bg-[#E6F5EB]","border","border-gray-200","rounded-xl","w-full","h-full","p-6","text-center"],["fill","none","stroke","currentColor","viewBox","0 0 24 24",1,"w-12","h-12","text-red-600","mb-4"],["stroke-linecap","round","stroke-linejoin","round","stroke-width","2","d","M12 2a2 2 0 00-2 2v16a2 2 0 002 2h8a2 2 0 002-2V8l-6-6H12z"],[1,"font-medium","text-gray-800","mb-2","truncate"],["target","_blank",1,"px-4","py-2","bg-[#00843B]","text-white","rounded","hover:bg-[#006830]","transition-colors",3,"href"],["fill","none","stroke","currentColor","viewBox","0 0 24 24",1,"w-16","h-16","text-neutral-300","mx-auto","mb-4"],["stroke-linecap","round","stroke-linejoin","round","stroke-width","2","d","M9.172 16.172a4 4 0 015.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"],[1,"text-xl","font-semibold","text-neutral-700","mb-2"],[1,"text-neutral-500","mb-6"],["routerLink","/articles",1,"btn-primary"]],template:function(e,c){e&1&&h(0,U,10,0,"div",0)(1,H,24,7,"section",1)(2,N,9,0,"div",2),e&2&&_(c.loading()?0:c.article()?1:2)},dependencies:[S,E,A,M,k],styles:[".content-article p{margin-bottom:1.5em;text-align:justify;line-height:1.6} .content-article{word-wrap:break-word;overflow-wrap:break-word;word-break:break-word} .content-article img{max-width:100%;height:auto} .content-article p{margin-bottom:1rem}"]})};export{j as DetailArticleComponent};
|