PageSourceSearch

https://zone-critique.com/982-57d1651bf1b8de6efa47.js

js zone-critique.com collected 2026-10-02 11:14:34 UTC 8,818 bytes, 26 lines download raw bytes

1(self.webpackChunkzc_front=self.webpackChunkzc_front||[]).push([[982],{47601:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return I}});var n=a(63375),r=a.n(n),l=a(96540),s=a(99571),o=a(39938),c=a(39708),m=a(95964),i=a(8025),d=a(46942),u=a.n(d),p=a(17392),f=a(70892),E=a(2642),b=a(44985),x=a(82695);function v(e,t,a){const n=(0,E.a)(e),r=(0,E.a)(t),l=(0,x.q)(),s=a?.locale??l.locale??b.c,o=a?.weekStartsOn??a?.locale?.options?.weekStartsOn??l.weekStartsOn??l.locale?.options?.weekStartsOn??0,c=(0,p.m)(n,r);if(isNaN(c))throw new RangeError("Invalid time value");let m;m=c<-6?"other":c<-1?"lastWeek":c<0?"yesterday":c<1?"today":c<2?"tomorrow":c<7?"nextWeek":"other";const i=s.formatRelative(m,n,r,{locale:s,weekStartsOn:o});return(0,f.GP)(n,i,{locale:s,weekStartsOn:o})}var g=a(20888),y=a(10900),h=a(97708),N=a(49493),C=a(52293),k=a(5047),w=a(51428);const S=e=>{let{comment:t,onClickReply:a,handleDeleteComment:n,isLast:r}=e;const{user:s}=(0,h.Ay)(),{0:o,1:c}=(0,l.useState)(!1),m="<p>__DELETED__</p>\n"===t.content;return l.createElement("div",{key:t.date,className:u()(r?"border-transparent":"border-black ","flex w-full flex-col border-b py-4 font-raleway")},l.createElement("div",{className:"flex items-center space-x-2"},l.createElement(k.Y,{user:t.author.node,type:"comment"},(0,C.IM)(t.author.node)),l.createElement("div",{className:"font-bold"},t.author.node.name),l.createElement("div",{className:"text-black"},v(new Date(t.date),new Date,{locale:g.fr}))),l.createElement("p",{className:"py-2 font-almarai"},m?l.createElement("span",{className:"text-gray-500"},"Ce commentaire a été supprimé par son auteur"):(0,y.Ay)(t.content)),!m&&l.createElement("div",{className:"flex space-x-4 "},!!s&&l.createElement("button",{disabled:!s,className:"cursor-pointer ",onClick:a},"Répondre"),!!s&&(null==s?void 0:s.id)===t.author.node.id&&l.createElement("button",{className:"cursor-pointer",onClick:o?n:()=>c(!0)},o?"Confirmer la suppression":"Supprimer")))},D=e=>{let{addComment:t,loading:a,parent:n=null,replyTo:r=null}=e;const s=(0,l.useRef)(),{0:o,1:c}=(0,l.useState)("");(0,l.useEffect)((()=>{s.current.focus()}),[]);const m=()=>t({content:o,parent:n,replyTo:r});return l.createElement("div",{className:"relative flex w-full items-stretch pt-4"},l.createElement("textarea",{onKeyDown:e=>{"Enter"===e.key&&e.ctrlKey&&m()},ref:s,className:"h-[80px] flex-1 rounded-md border border-black px-4 py-2 font-raleway",value:o,onChange:e=>c(e.target.value)}),l.createElement("button",{disabled:!o.length||a,title:"Envoyer",className:"absolute bottom-2 right-2 flex items-center justify-center rounded border border-black bg-creations-bg p-1",onClick:m},a?l.createElement("span",{className:"flex items-center justify-center space-x-2"},l.createElement("span",{className:"pt-[3px]"},"Chargement "),l.createElement(w.y,{color:"text-black"})):l.createElement("img",{src:"/icons/arrow-right.svg",alt:""})))};var I=e=>{var t,a,n,d;let{post:p}=e;if("open"!==p.commentStatus)return null;const f=(0,l.useRef)(),{globalSettings:E,user:b}=(0,h.Ay)(),{0:x,1:v}=(0,l.useState)(3),{0:g,1:y}=(0,l.useState)(!1),{0:C,1:k}=(0,l.useState)({orderBy:"COMMENT_DATE",order:"DESC"}),{0:I,1:T}=(0,l.useState)(null),{0:_,1:$}=(0,l.useState)([]);(0,l.useEffect)((()=>{g&&T(null)}),[g]),(0,l.useEffect)((()=>{I&&y(!1)}),[I]);const{0:A,1:O}=(0,l.useState)([]),[R,{loading:M,data:L,reset:j,error:z}]=(0,o.n)(c.J1`
2    mutation addComment(
3      $parent: ID
4      $content: String!
5      $email: String!
6      $postId: Int!
7    ) {
8      createComment(
9        input: {
10          content: $content
11          commentOn: $postId
12          authorEmail: $email
13          parent: $parent
14        }
15      ) {
16        success
17      }
18    }
19  `),[B,P]=(0,o.n)(c.J1`
20    mutation deleteComment($id: ID!) {
21      updateComment(input: { id: $id, content: "__DELETED__" }) {
22        success
23      }
24    }
25  `),V=e=>{B({variables:{id:e.id}}).then((()=>{(0,s.oR)("Votre commentaire a bien été supprimé",{type:"success"}),G()}))},{data:q,loading:J,fetchMore:K,refetch:W}=(0,m.IT)(N._D,{variables:{postId:p.id,limit:x,after:null,...C},notifyOnNetworkStatusChange:!0}),F=(0,i.useLocation)();(0,l.useEffect)((()=>{W({limit:3,after:null}),T(null)}),[F]);const G=()=>{T(null),W({limit:q.comments.nodes.length,after:null,...C})};(0,l.useEffect)((()=>{q&&(f.current=q.comments.pageInfo)}),[q]);const Y=e=>{let{content:t,parent:a,replyTo:n}=e;const{email:l}=b,o={email:l,postId:p.databaseId,parent:a,content:n?`<strong>@${n}</strong> ${t}`:t};R({variables:o,onError:e=>{(0,s.oR)(e.message,{type:"error"})},onCompleted:()=>{(0,s.oR)("Votre message a bien été envoyé",{type:"success"}),y(!1),G(),a&&O(r()(A.concat(a)))}})};(0,l.useEffect)((()=>{var e,t;W({...C,limit:(null==q||null===(e=q.comments)||void 0===e||null===(t=e.nodes)||void 0===t?void 0:t.length)||3,after:null})}),[C]);return l.createElement("div",{className:"sm:my-16"},l.createElement("div",{className:u()("relative flex w-full flex-col")},l.createElement("div",{className:"flex-1 font-anton text-[40px] uppercase lg:text-4xl lg:text-5xl"},"Commentaires"),l.createElement("p",{className:"font-raleway font-bold lg:mt-8"},E.comments.incentiveLabel),g?l.createElement(D,{post:p,addComment:Y,loading:M}):l.createElement("button",{className:u()(!b&&"cursor-not-allowed","my-4 flex items-center justify-center rounded-xl border border-black bg-creations-bg py-4 font-raleway font-extrabold transition-all duration-[350ms] hover:bg-white"),disabled:!b,title:!b&&"Vous devez vous connecter pour commenter",onClick:()=>y(!0)},b?E.comments.buttonLabel:"Inscrivez-vous pour participer à la discussion"),l.createElement("div",{className:"flex flex-col pt-4"},l.createElement("div",{className:"flex self-start"},(null==q||null===(t=q.comments)||void 0===t||null===(a=t.nodes)||void 0===a?void 0:a.length)>0&&l.createElement("span",{onClick:()=>{return e="COMMENT_DATE",void k((t=>({orderBy:e,order:t.orderBy===e?"ASC"===t.order?"DESC":"ASC":"DESC"})));var e},className:"flex shrink cursor-pointer items-center justify-center space-x-2 bg-white px-2 font-bebas text-[21px]"},l.createElement("span",{className:"pt-[3px]"},"Les plus"," ","COMMENT_DATE"===C.orderBy&&"ASC"===C.order?"anciens":"récents"," "),l.createElement("img",{src:"/icons/arrow-down.svg",alt:"",className:u()("transition-all","COMMENT_DATE"===C.orderBy&&"ASC"===C.order&&"rotate-180")}
25))),((null==q||null===(n=q.comments)||void 0===n?void 0:n.nodes)||[]).map(((e,t)=>{const a=A.find((t=>t===e.databaseId));return l.createElement("div",{key:e.date,className:u()(J||P.loading&&"animate-pulse")},l.createElement(S,{isLast:t+1===q.comments.nodes.length,liked:_.includes(e.id),onClickReply:()=>T(e.id),handleDeleteComment:()=>V(e),comment:e}),I===e.id&&l.createElement(D,{post:p,replyTo:e.author.node.name,addComment:Y,loading:M,parent:e.databaseId}),e.replies.nodes.length>0&&l.createElement("div",{className:"flex"},l.createElement("p",{className:"mr-4 h-[10.5px] w-[15px] self-start border border-b-black pt-[15px]"}),l.createElement("div",{className:"flex grow flex-col"},l.createElement("span",{className:"flex cursor-pointer items-center justify-center space-x-2 self-start font-bebas",onClick:()=>{return t=e.databaseId,void(A.find((e=>e===t))?O(A.filter((e=>e!==t))):O(A.concat(t)));var t}},l.createElement("span",{className:"pt-[3px] font-bebas text-[21px]"},a?"Masquer les réponses":`Afficher ${e.replies.nodes.length} Réponse${e.replies.nodes.length>1?"s":""}`),l.createElement("img",{src:"/icons/arrow-down.svg",alt:"",className:u()(a&&"rotate-180","transition-all")})),a&&e.replies.nodes.map(((t,a)=>l.createElement(l.Fragment,null,l.createElement(S,{isLast:a+1===e.replies.nodes.length,key:t.date,comment:t,liked:_.includes(t.id),handleDeleteComment:()=>V(t),onClickReply:()=>T(t.id)}),I===t.id&&l.createElement(D,{post:p,addComment:Y,replyTo:t.author.node.name,loading:M,parent:e.databaseId})))))))})),(null===(d=f.current)||void 0===d?void 0:d.hasNextPage)&&l.createElement("div",{className:"absolute bottom-0 z-10 flex w-full bg-zc-gray py-6"},l.createElement("div",{className:"shrink cursor-pointer bg-white px-2 font-bebas text-[21px]",onClick:()=>(async()=>{var e;J||K({variables:{postId:p.id,limit:5,after:null===(e=f.current)||void 0===e?void 0:e.endCursor}})})()},J?l.createElement("span",{className:"flex items-center justify-center space-x-2"},l.createElement("span",{className:"pt-[3px]"},"Chargement "),l.createElement(w.y,{color:"text-black"})):l.createElement("span",{className:"flex items-center justify-center space-x-2"},l.createElement("span",{className:"pt-[3px]"},"Plus de commentaires "),l.createElement("img",{src:"/icons/arrow-down.svg",alt:""})))))))}},63375:function(e,t,a){var n=a(55765);e.exports=function(e){return e&&e.length?n(e):[]}}}]);
26//# sourceMappingURL=982-57d1651bf1b8de6efa47.js.map

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.