"use strict";(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[3701],{2735:function(e,t,r){r.d(t,{Qj:function(){return j},zx:function(){return N}});var n=r(65443),a=r.n(n),l=r(94159),o=r(6285);function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;ta()("leading-none","align-middle","py-2","px-4","no-select",e.className,{[d]:"pill"===e.buttonStyle,[m]:"roundrect"===e.buttonStyle,[b]:"authn"===e.buttonStyle,[h]:"cherry"===e.color,[g]:"strawberry"===e.color,[p]:"mango"===e.color,[v]:"not-black"===e.color,[f]:"red"===e.color,[E]:"accent"===e.color,[y]:"green"===e.color,[x]:"secondary"===e.color,[k]:"authn-primary"===e.color,[w]:"authn-other"===e.color}),N=l.forwardRef((({buttonStyle:e,color:t,className:r,...n},a)=>{const o=S({buttonStyle:e,color:t,className:r,...n});return l.createElement("button",c({},n,{className:o,ref:a}),n.children)}));N.displayName="Button";const j=l.forwardRef((({buttonStyle:e,color:t,...r},n)=>{const a=S({buttonStyle:e,color:t,...r});return l.createElement("a",c({},r,{className:a,ref:n}),r.children)}));j.displayName="LinkButton"},27028:function(e,t,r){r.r(t);var n=r(12093),a=r(46202),l=r(84879),o=r(94159),c=r(90275),s=r(6553),u=r(58397),i=r(2735),d=r(71860),m=r(81150),b=r(99838);function h(){return h=Object.assign?Object.assign.bind():function(e){for(var t=1;t{const e=d.S.moderation.user.unactivatedUsers.useInfiniteQuery({limit:50},{suspense:!0,getNextPageParam:e=>e.nextCursor}),t=d.S.moderation.user.activateMany.useMutation(),r=d.S.moderation.user.banMany.useMutation(),{register:a,handleSubmit:l,watch:c}=(0,b.cI)(),s=c("users",[]);let u=!1;for(const e of s)if(e?.selected){u=!0;break}const m=(0,o.useCallback)((async e=>{const r=e.users.map(((e,t)=>({userId:t,selected:e.selected}))).filter((e=>e.selected)).map((e=>e.userId));await t.mutateAsync({userIds:r}),location.reload()}),[t]),g=(0,o.useCallback)((async e=>{const t=e.users.map(((e,t)=>({userId:t,selected:e.selected}))).filter((e=>e.selected)).map((e=>e.userId));await r.mutateAsync({userIds:t,reason:e.banReason}),location.reload()}),[r]);return o.createElement(o.Fragment,null,o.createElement("table",null,o.createElement("thead",null,o.createElement("tr",null,o.createElement("th",null,"select"),o.createElement("th",null,"e-mail"),o.createElement("th",null,"self-project handle"),o.createElement("th",null,"actions"))),o.createElement("tbody",null,e.data?.pages.map((e=>e.users.map((e=>o.createElement("tr",{key:e.userId},o.createElement("td",null,o.createElement("input",h({type:"checkbox"},a(`users.${e.userId}.selected`)))),o.createElement("td",null,e.email),o.createElement("td",null,e.selfProject.handle),o.createElement("td",null,o.createElement("ul",null,o.createElement("li",null,o.createElement("a",{href:n.ZP.public.moderation.manageUser({userId:e.userId}).toString()},"manage user")),o.createElement("li",null,o.createElement("a",{href:n.ZP.public.moderation.manageProject({projectHandle:e.selfProject.handle}).toString()},"manage project"))))))))))),e.hasNextPage&&o.createElement(i.zx,{buttonStyle:"authn",color:"authn-other",onClick:()=>e.fetchNextPage(),disabled:e.isFetchingNextPage},"load more"),o.createElement(i.zx,{buttonStyle:"authn",color:"authn-other",disabled:!u,onClick:l(m)},"activate selected users"),o.createElement("div",{className:"mt-3 flex max-w-fit flex-col gap-2 rounded-lg border border-accent p-3"},o.createElement("label",null,"reason for banning users:"),o.createElement("textarea",a("banReason")),o.createElement(i.zx,{buttonStyle:"authn",color:"authn-other",disabled:!u,onClick:l(g)},"ban selected users")))};t.default=({numUnactivated:e,numUnactivatable:t,mostRecentInviteDate:r})=>{const b=(0,o.useId)(),h=d.S.useContext();return(0,o.useEffect)((()=>{h.moderation.user.unactivatedUsers.prefetchInfinite({limit:50})}),[h.moderation.user.unactivatedUsers]),o.createElement(o.Fragment,null,o.createElement(c.ql,{title:"bulk activate"}),o.createElement("div",null,o.createElement("h1",null,"Bulk user activation"),o.createElement("a",{href:n.ZP.public.moderation.home().toString()},o.createElement(a.Z,{className:"inline h-6 w-6"}),"back to moderation home"),o.createElement("p",null,"There are currently ",e," unactivated users. (",t," without verified email)"),o.createElement("p",null,"Last invite generated"," ",l.ou.fromISO(r).toRelative({style:"long"})),o.createElement("form",{method:"post",className:"my-3 flex flex-col gap-3 rounded-lg border border-accent p-3"},o.createElement("input",{type:"hidden",value:0,name:"numToActivate"}),o.createElement(s.p,{as:"button",type:"submit"},"activate all users")),o.createElement("form",{method:"post",className:"my-3 flex flex-col gap-3 rounded-lg border border-accent p-3"},o.createElement("fieldset",{className:"flex flex-col gap-1"},o.createElement("label",{htmlFor:`${b}:numToActivate`},"number to activate"),o.createElement("input",{type:"number",min:1,max:Math.min(e,999),step:1,id:`${b}:numToActivate`,name:"numToActivate",defaultValue:Math.min(e,999)})),o.createElement(s.p,{as:"button",type:"submit"},"activate users"))),o.createElement("hr",null),o.createElement("div",null,o.createElement(u.p,null,o.createElement(u.p.Button,{as:i.zx,buttonStyle:"authn",color:"authn-primary"},"show unactivated users"),o.createElement(u.p.Panel,null,o.createElement(o.Suspense,{fallback:o.createElement(m.g,null)},o.createElement(g,null))))))}},46202:function(e,t,r){var n=r(94159);const a=n.forwardRef((function({title:e,titleId:t,...r},a){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",ref:a,"aria-labelledby":t},r),e?n.createElement("title",{id:t},e):null,n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5L8.25 12l7.5-7.5"}))}));t.Z=a}}]); //# sourceMappingURL=client-preact-components-pages-moderation-bulk-activate.1c2204147bb871923837.js.map