1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[521],{28691:function(e,s,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/editor/stories",function(){return t(75472)}])},36110:function(e,s,t){"use strict";t.d(s,{Z:function(){return r}});const r=(0,t(97979).Z)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},32727:function(e,s,t){"use strict";t.d(s,{Z:function(){return r}});const r=(0,t(97979).Z)("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]])},89654:function(e,s,t){"use strict";t.d(s,{Z:function(){return r}});const r=(0,t(97979).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},39650:function(e,s,t){"use strict";t.d(s,{Z:function(){return r}});const r=(0,t(97979).Z)("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])},33112:function(e,s,t){"use strict";t.d(s,{Z:function(){return r}});const r=(0,t(97979).Z)("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]])},37776:function(e,s,t){"use strict";t.d(s,{Z:function(){return r}});const r=(0,t(97979).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},45605:function(e,s,t){"use strict";t.d(s,{I:function(){return i}});var r=t(52676),a=t(75271),n=t(90073);const i=a.forwardRef(((e,s)=>{let{className:t,type:a,...i}=e;return(0,r.jsx)("input",{type:a,className:(0,n.cn)("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm text-foreground shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),ref:s,...i})}));i.displayName="Input"},51218:function(e,s,t){"use strict";t.d(s,{Bw:function(){return h},Ph:function(){return c},Ql:function(){return x},i4:function(){return d},ki:function(){return o}});var r=t(52676),a=t(75271),n=t(39344),i=t(84020),l=t(90073);const c=i.fC,o=(i.ZA,i.B4),d=a.forwardRef(((e,s)=>{let{className:t,children:a,...c}=e;return(0,r.jsxs)(i.xz,{ref:s,className:(0,l.cn)("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...c,children:[a,(0,r.jsx)(i.JO,{asChild:!0,children:(0,r.jsx)(n.jnn,{className:"h-4 w-4 opacity-50"})})]})}));d.displayName=i.xz.displayName;const u=a.forwardRef(((e,s)=>{let{className:t,...a}=e;return(0,r.jsx)(i.u_,{ref:s,className:(0,l.cn)("flex cursor-default items-center justify-center py-1",t),...a,children:(0,r.jsx)(n.g8U,{})})}));u.displayName=i.u_.displayName;const m=a.forwardRef(((e,s)=>{let{className:t,...a}=e;return(0,r.jsx)(i.$G,{ref:s,className:(0,l.cn)("flex cursor-default items-center justify-center py-1",t),...a,children:(0,r.jsx)(n.v4q,{})})}));m.displayName=i.$G.displayName;const h=a.forwardRef(((e,s)=>{let{className:t,children:a,position:n="popper",...c}=e;return(0,r.jsx)(i.h_,{children:(0,r.jsxs)(i.VY,{ref:s,className:(0,l.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
1de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===n&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...c,children:[(0,r.jsx)(u,{}),(0,r.jsx)(i.l_,{className:(0,l.cn)("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:a}),(0,r.jsx)(m,{})]})})}));h.displayName=i.VY.displayName;a.forwardRef(((e,s)=>{let{className:t,...a}=e;return(0,r.jsx)(i.__,{ref:s,className:(0,l.cn)("px-2 py-1.5 text-sm font-semibold",t),...a})})).displayName=i.__.displayName;const x=a.forwardRef(((e,s)=>{let{className:t,children:a,value:c="",...o}=e;return""===c&&(console.error("A <Select.Item /> must have a value prop that is not an empty string"),c="default_value"),(0,r.jsxs)(i.ck,{ref:s,className:(0,l.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),value:c,...o,children:[(0,r.jsx)("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,r.jsx)(i.wU,{children:(0,r.jsx)(n.nQG,{className:"h-4 w-4"})})}),(0,r.jsx)(i.eT,{children:a})]})}));x.displayName=i.ck.displayName;a.forwardRef(((e,s)=>{let{className:t,...a}=e;return(0,r.jsx)(i.Z0,{ref:s,className:(0,l.cn)("-mx-1 my-1 h-px bg-muted",t),...a})})).displayName=i.Z0.displayName},75472:function(e,s,t){"use strict";t.r(s),t.d(s,{default:function(){return y}});var r=t(52676),a=t(75271),n=t(67981),i=t(75071),l=t(41853),c=t(45605),o=t(51218),d=t(88433),u=t(34453),m=t(89654),h=t(32727),x=t(39650),p=t(36110),f=t(33112),j=t(37776),v=t(9101);function y(){const{data:e,status:s}=(0,n.useSession)(),t=(0,i.useRouter)(),[y,g]=(0,a.useState)([]),[N,w]=(0,a.useState)([]),[b,k]=(0,a.useState)(!0),[E,A]=(0,a.useState)(""),[C,Z]=(0,a.useState)("ALL"),[S,_]=(0,a.useState)("ALL"),[L,R]=(0,a.useState)(1),[z,I]=(0,a.useState)(1);(0,a.useEffect)((()=>{var r;"loading"!==s&&(e?["ADMIN","EDITOR"].includes(null===(r=e.user)||void 0===r?void 0:r.role)?(D(),P()):t.push("/"):t.push("/auth/signin"))}),[e,s,t,L,C,S,E]);const D=async()=>{try{var s;const t=new URLSearchParams({page:L.toString(),limit:"10",status:C,categoryId:"ALL"===S?"":S,search:E,..."EDITOR"===(null===e||void 0===e||null===(s=e.user)||void 0===s?void 0:s.role)&&{authorId:e.user.id}}),r=await fetch("/api/admin/stories?".concat(t));if(!r.ok)throw new Error("Erreur lors du chargement des stories");const a=await r.json();g(a.stories),I(a.pagination.pages)}catch(t){console.error("Erreur:",t),v.Am.error("Erreur lors du chargement des stories")}finally{k(!1)}},P=async()=>{try{const e=await fetch("/api/admin/categories");if(!e.ok)throw new Error("Erreur lors du chargement des cat\xe9gories");const s=await e.json();w(s.categories||[])}catch(e){console.error("Erreur:",e)}},M=e=>(0,r.jsx)(u.C,{variant:{PUBLISHED:"default",DRAFT:"secondary",ARCHIVED:"destructive"}[e]||"secondary",children:e}),T=e=>new Date(e).toLocaleDateString("fr-FR",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"});return b?(0,r.jsx)("div",{className:"container mx-auto px-4 py-8",children:(0,r.jsx)("div",{className:"flex items-center justify-center h-64",children:(0,r.jsx)("div",{className:"text-lg",children:"Chargement..."})})}):(0,r.jsx)("div",{className:"container mx-auto px-4 py-8",children:(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"flex justify-between items-center",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-3xl font-bold",children:"Mes Stories"}),(0,r.jsx)("p",{className:"text-muted-foreground",children:"G\xe9rez vos stories"})]}),(0,r.jsxs)(l.z,{onClick:()=>t.push("/editor/stories/new"),children:[(0,r.jsx)(m.Z,{className:"w-4 h-4 mr-2"}),"Nouvelle Story"]})]}),(0,r.jsxs)(d.Zb,{children:[(0,r.jsx)(d.Ol,{children:(0,r.jsxs)(d.ll,{className:"flex items-center gap-2",children:[(0,r.jsx)(h.Z,{className:"w-4 h-4"}),"Filtres"]})}),(0,r.jsx)(d.aY,{children:(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(x.Z,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),(0,r.jsx)(c.I,{placeholder:"Rechercher...",value:E,onChange:e=>A(e.target.value),className:"pl-10"})]}),(0,r.jsxs)(o.Ph,{value:C,onValueChange:Z,children:[(0,r.jsx)(o.i4,{children:(0,r.jsx)(o.ki,{placeholder:"Statut"})}),(0,r.jsxs)(o.Bw,{children:[(0,r.jsx)(o.Ql,{value:"ALL",children:"Tous les statuts"}),(0,r.jsx)(o.Ql,{value:"PUBLISHED",children:"Publi\xe9"}),(0,r.jsx)(o.Ql,{value:"DRAFT",children:"Brouillon"}),(0,r.jsx)(o.Ql,{value:"ARCHIVED",children:"Archiv\xe9"})]})]}),(0,r.jsxs)(o.Ph,{value:S,onValueChange:_,children:[(0,r.jsx)(o.i4,{children:(0,r.jsx)(o.ki,{placeholder:"Cat\xe9gorie"})}),(0,r.jsxs)(o.Bw,{children:[(0,r.jsx)(o.Ql,{value:"ALL",children:"Toutes les cat\xe9gories"}),N.map((e=>(0,r.jsx)(o.Ql,{value:e.id,children:e.name},e.id)))]})]}),(0,r.jsx)(l.z,{variant:"outline",onClick:()=>{A(""),Z("ALL"),_("ALL"),R(1)},children:"R\xe9initialiser"})]})})]}),(0,r.jsx)("div",{className:"grid gap-4",children:0===y.length?(0,r.jsx)(d.Zb,{children:(0,r.jsxs)(d.aY,{className:"text-center py-8",children:[(0,r.jsx)("p",{className:"text-muted-foreground",children:"Aucune story trouv\xe9e"}),(0,r.jsx)(l.z,{className:"mt-4",onClick:()=>t.push("/editor/stories/new"),children:"Cr\xe9er votre premi\xe8re story"})]})}):y.map((e=>(0,r.jsx)(d.Zb,{children:(0,r.jsx)(d.aY,{className:"p-6",children:(0,r.jsxs)("div",{className:"flex items-start justify-between",children:[(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,r.jsx)("h3",{className:"text-lg font-semibold",children:e.title}),M(e.status),!e.isActive&&(0,r.jsx)(u.C,{variant:"outline",children:"Inactif"}),e.expiresAt&&new Date(e.expiresAt)<new Date&&(0,r.jsx)(u.C,{variant:"destructive",children:"Expir\xe9"})]}),(0,r.jsxs)("p",{className:"text-sm text-muted-foreground mb-3 line-clamp-2",children:[e.content.substring(0,150),"..."]}),(0,r.jsxs)("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.category&&(0,r.jsx)("span",{children:e.category.name}),(0,r.jsxs)("span",{children:["\u2022 ",T(e.createdAt)]}),(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)(p.Z,{className:"w-3 h-3"}),e.viewCount," vues"]}),(0,r.jsxs)("span",{children:["Ordre: ",e.order]})]}),e.mediaUrl&&(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(u.C,{variant:"outline",children:"VIDEO"===e.mediaType?"Vid\xe9o":"Image"})}),e.expiresAt&&(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:["Expire le: ",T(e.expiresAt)]})})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 ml-4",children:[(0,r.jsx)(l.z,{variant:"outline",size:"sm",onClick:()=>t.push("/editor/stories/".concat(e.id)),children:(0,r.jsx)(f.Z,{className:"w-4 h-4"})}),(0,r.jsx)(l.z,{variant:"outline",size:"sm",onClick:()=>(async e=>{if(confirm("\xcates-vous s\xfbr de vouloir supprimer cette story ?"))try{if(!(await fetch("/api/admin/stories/".concat(e),{method:"DELETE"})).ok)throw new Error("Erreur lors de la suppression");v.Am.success("Story supprim\xe9e avec succ\xe8s"),D()}catch(s){console.error("Erreur:",s),v.Am.error("Erreur lors de la suppression")}})(e.id),className:"text-red-600 hover:text-red-700",children:(0,r.jsx)(j.Z,{className:"w-4 h-4"})})]})]})})},e.id)))}),z>1&&(0,r.jsxs)("div",{className:"flex justify-center gap-2",children:[(0,r.jsx)(l.z,{variant:"outline",onClick:()=>R((e=>Math.max(1,e-1))),disabled:1===L,children:"Pr\xe9c\xe9dent"}),(0,r.jsxs)("span",{className:"flex items-center px-4",children:["Page ",L," sur ",z]}),(0,r.jsx)(l.z,{variant:"outline",onClick:()=>R((e=>Math.min(z,e+1))),disabled:L===z,children:"Suivant"})]})]})})}}},function(e){e.O(0,[4020,9101,2888,9774,179],(function(){return s=28691,e(e.s=s);var s}));var s=e.O();_N_E=s}]);
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.