Plugin Directory

Changeset 3182560


Ignore:
Timestamp:
11/05/2024 05:33:36 PM (15 months ago)
Author:
kantbtrue
Message:

Fixed the issue where tasks were not displaying on the kanban board.

Location:
wpnakama
Files:
67 added
5 edited

Legend:

Unmodified
Added
Removed
  • wpnakama/trunk/admin/app/build/618.js

    r3180973 r3182560  
    1 "use strict";(globalThis.webpackChunkwpnakama=globalThis.webpackChunkwpnakama||[]).push([[618],{911:(e,t,a)=>{a.d(t,{A:()=>E});var l=a(1609),n=a(6087),r=a(9739),s=a(5727),i=a(4051),c=a(5216),d=a(6062),m=a(8926),o=a(8723),u=a(2498),p=a(3845),g=a(6622);function E({selectedDate:e,setSelectedDate:t}){const[a]=(0,n.useState)(new Date((0,r.R)())),[E,f]=(0,n.useState)(e||a),{areDatesEqual:x}=(0,u.A)();let h=Number((0,s.GP)(a,"MM")),w=Number((0,s.GP)(a,"dd")),v=Number((0,s.GP)(E,"MM")),_=(0,s.GP)(E,"MMMM"),b=Number((0,s.GP)(E,"yyyy")),N=(0,i.P)(new Date(E));const k=[];for(let t=1;t<=N;t++){let a={};a.id=t,a.num=t,a.value=new Date(b,Number((0,s.GP)(E,"MM"))-1,t,(0,c.q)(new Date),(0,d.O)(new Date),(0,m.S)(new Date)),a.isToday=a.id==w,a.realMonth=v==h,a.isSelected=x(e,a.value),k.push(a)}let y;switch((0,o.P)(new Date(b,--v,1))){case 0:y="col-start-1";break;case 1:y="col-start-2";break;case 2:y="col-start-3";break;case 3:y="col-start-4";break;case 4:y="col-start-5";break;case 5:y="col-start-6";break;case 6:y="col-start-7";break;default:y="col-start-0"}function S(e){t(e.target.getAttribute("data-value"))}return(0,l.createElement)("div",{className:"flex flex-col gap-3 w-full"},(0,l.createElement)("div",{className:"p-3 font-medium text-base leading-6 flex gap-4 justify-between"},(0,l.createElement)("div",null,`${_} ${b}`),(0,l.createElement)("div",null,(0,l.createElement)(p.e2,{size:"sm"},(0,l.createElement)(p.e2.Item,{onClick:function(){f(new Date(0<=v<=11?b:b-1,v-1,w))},after:(0,l.createElement)(g.YJP,null)}),(0,l.createElement)(p.e2.Item,{onClick:function(){f(new Date(0<=v<=11?b:b+1,v+1,w))},after:(0,l.createElement)(g.vKP,null)})))),(0,l.createElement)("div",{className:"flex flex-col gap-4"},(0,l.createElement)("div",{className:"grid grid-cols-7 justify-center text-center"},(0,l.createElement)("div",{className:"text-sm leading-5 text-surface-300 font-medium"},"S"),(0,l.createElement)("div",{className:"text-sm leading-5 text-surface-300 font-medium"},"M"),(0,l.createElement)("div",{className:"text-sm leading-5 text-surface-300 font-medium"},"T"),(0,l.createElement)("div",{className:"text-sm leading-5 text-surface-300 font-medium"},"W"),(0,l.createElement)("div",{className:"text-sm leading-5 text-surface-300 font-medium"},"T"),(0,l.createElement)("div",{className:"text-sm leading-5 text-surface-300 font-medium"},"F"),(0,l.createElement)("div",{className:"text-sm leading-5 text-surface-300 font-medium"},"S")),(0,l.createElement)("div",{className:"grid grid-cols-7 grid-rows-6"},k.map((e=>(0,l.createElement)(n.Fragment,{key:e.id},(0,l.createElement)("div",{className:`text-center relative ${1==e.id&&y}`},e.isToday&&e.realMonth&&(0,l.createElement)("div",{className:"absolute top-1.5 left-[18px] w-1 h-1 bg-secondary rounded-full transition-all"}),(0,l.createElement)("div",{title:e.value,"data-value":e.value,className:"p-2 w-10 h-10 cursor-pointer text-slate-700 transition hover:bg-primary-50 hover:text-primary rounded-full text-sm leading-6 "+(e.isSelected?"bg-primary text-white":""),onClick:S},e.num))))))))}},9351:(e,t,a)=>{a.d(t,{A:()=>i});var l=a(1609),n=a(7723),r=a(3845),s=a(6622);function i({license:e,devPosition:t=(0,n.__)("soon","wpnakama")}){return(0,l.createElement)(l.Fragment,null,"not found"===e?.status&&(0,l.createElement)(s.XAi,{className:"!text-secondary !opacity-100 size-5"}),"inactive"===e?.status&&(0,l.createElement)(s.wUM,{className:"!text-secondary !opacity-100 size-5"}),"active"===e?.status&&(0,l.createElement)(r.Ex,{className:"py-0.25 px-1",size:"sm",shape:"pill",color:"yellow",stroke:!0},t))}},7813:(e,t,a)=>{a.d(t,{A:()=>c});var l=a(1609),n=a(6087),r=a(3845),s=a(9523),i=a(7143);function c({capabilities:e="edit_posts",userNums:t=2,size:a="xs"}){const c=(0,n.useContext)(s.t),{users:m}=(0,i.useSelect)((t=>({users:t(c).getEntityRecords("WPNakama","user",{capabilities:e})})));return(0,l.createElement)(r.Z7.Root,null,m?(0,l.createElement)(l.Fragment,null,m?.slice(0,t).map((e=>(0,l.createElement)(d,{name:e.name,avatarUrl:e.avatar_urls[48],size:a}))),t<m?.length&&(0,l.createElement)(r.Z7.Label,{size:a,className:"bg-surface text-surface-400"},"+"+(m?.length-t))):(0,l.createElement)(l.Fragment,null,(0,l.createElement)(r.Z7.Item,{alt:"",initials:"",size:a}),(0,l.createElement)(r.Z7.Item,{alt:"",initials:"",size:a}),(0,l.createElement)(r.Z7.Label,{size:a,className:"bg-surface text-surface-400"})))}const d=({name:e,avatarUrl:t,size:a})=>{const n=function(e){let t="",a=e.split(" ");for(;a.length;)t+=a.shift()[0].toUpperCase();return t}(e);return(0,l.createElement)(r.Z7.Item,{alt:e,initials:n,size:a,src:t})}},7266:(e,t,a)=>{a.d(t,{A:()=>n});var l=a(6087);function n(){const[e,t]=(0,l.useState)({});return{action:e,handleAction:(e=-1,a="")=>{t(0>e?{}:{id:e,type:a})}}}},6397:(e,t,a)=>{function l(){return{truncate:(e,t)=>e.length>t?e.substr(0,t-1)+"..":e}}a.d(t,{A:()=>l})},725:(e,t,a)=>{a.d(t,{A:()=>n});var l=a(1609);const n=(0,a(6087).forwardRef)(((e,t)=>(0,l.createElement)("svg",{...e,fill:"none",height:"24",ref:t,viewBox:"0 0 24 24",width:"24"},(0,l.createElement)("circle",{cx:"12",cy:"12",r:"4",fill:"currentColor"}))))},3913:(e,t,a)=>{a.r(t),a.d(t,{default:()=>Y});var l=a(1609),n=a(7723),r=a(6087),s=a(9785),i=a(7266),c=a(2498),d=a(6074),m=a(5038),o=a(9446),u=a(9e3),p=a(3845),g=a(6622),E=a(7813),f=a(725),x=a(9739),h=a(7494),w=a(2599),v=a(6397),_=a(6427),b=a(9523),N=a(7143),k=a(9730);const y=(0,r.createContext)();function S({children:e,action:t,handleAction:a}){return(0,l.createElement)(y.Provider,{as:"View",value:{action:t,handleAction:a}},e)}const C=({children:e,id:t,title:a,isFinishResolving:s=!0})=>{var i;const[c,d]=(0,r.useState)(!1),[m,o]=(0,r.useState)(!1),{truncate:u}=(0,v.A)(),E=(0,r.useContext)(b.t),{edited:f}=(0,N.useSelect)((e=>({edited:e(E).getEditedEntityRecord("WPNakama","phase",t)})),[t]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"p-4 w-72 h-full flex flex-col gap-8"},s?(0,l.createElement)("div",{className:"bg-white px-3 py-2 shadow-sm rounded-xl"},c?(0,l.createElement)(A,{id:t,handleOpen:d}):(0,l.createElement)("div",{className:"flex justify-between items-center"},(0,l.createElement)("div",{className:"text-base leading-5 text-primary font-medium",onClick:()=>d(!0)},u(null!==(i=f?.title)&&void 0!==i?i:a,25)),(0,l.createElement)(p.rI,null,(0,l.createElement)(p.rI.Trigger,{asChild:!0},(0,l.createElement)(p.$n,{before:(0,l.createElement)(g.Mgv,null),variant:"transparent",size:"md"})),(0,l.createElement)(p.rI.Content,{className:"min-w-[140px] bg-white z-10"},(0,l.createElement)(p.rI.Group,null,(0,l.createElement)(p.rI.Item,{onClick:()=>d(!0)},(0,l.createElement)(g.qUP,null),(0,l.createElement)("span",{className:"text-sm leading-6"},(0,n.__)("Rename","wpnakama")))),(0,l.createElement)(p.rI.Separator,null),(0,l.createElement)(p.rI.Group,null,(0,l.createElement)(p.rI.Item,{className:"!text-red",onClick:()=>o(!0)},(0,l.createElement)(g.ucK,{className:"!text-red-500 !opacity-100"}),(0,l.createElement)("span",{className:"text-sm leading-6"},"Delete"))))))):(0,l.createElement)(D,null),(0,l.createElement)("div",{className:"h-full w-full"},e)),(0,l.createElement)(R,{id:t,boardId:f?.board_id,open:m,handleOpen:o}))},A=({id:e,handleOpen:t})=>{var a;const{handleAction:i}=(0,r.useContext)(y),{register:c,handleSubmit:d,formState:{errors:o}}=(0,s.mN)(),u=(0,r.useContext)(b.t),{editEntityRecord:E,saveEditedEntityRecord:f,undo:x}=(0,N.useDispatch)(u),{edited:h,isSaving:w,saveError:v}=(0,N.useSelect)((t=>({edited:t(u).getEditedEntityRecord("WPNakama","phase",e),isSaving:t(u).isSavingEntityRecord("WPNakama","phase",e),saveError:t(u).getLastEntitySaveError("WPNakama","phase",e)})),[e]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"flex justify-between items-center gap-1"},(0,l.createElement)("div",{className:"grow text-sm leading-5 px-1 py-1 rounded-sm"},(0,l.createElement)(p.pd,{className:`p-1 bg-surface-100 shadow-none border-0 w-[140px] ${null!==(a=h?.title)&&void 0!==a?a:" cursor-wait animate-pulse"}`,...c("editedTitle",{required:!0,minLength:3,maxLength:15}),destructive:!!o.editedTitle,disabled:w,defaultValue:h.title,autoFocus:!!h?.title})),(0,l.createElement)("div",{className:"flex gap-1 items-center"},(0,l.createElement)(p.$n,{variant:"outline",onClick:d((async function({editedTitle:a}){await async function(t){await E("WPNakama","phase",e,{board_id:h.board_id,title:t})}(a),await f("WPNakama","phase",e,{board_id:h.board_id})?(i(e,"edit"),m.Ay.success((0,n.__)("Successfuly renamed the kanban list","wpnakama")),t(!1),i()):(x(),m.Ay.error((0,n.__)("Something went wrong!","wpnakama")))})),disabled:w,size:"xs-icon",className:"px-[6px] py-2 !leading-[0]",title:(0,n.__)("Save the edited board title","wpnakama")},w?(0,l.createElement)(p.Rh,{type:"line",size:"xxs",className:"text-surface-100"}):(0,l.createElement)(g.Srz,{className:"w-4 h-4"})),(0,l.createElement)(p.$n,{variant:"outline",onClick:()=>t(!1),size:"xs-icon",className:"px-[6px] py-2 !leading-[0]",disabled:w,title:(0,n.__)("Disable rename mode","wpnakama")},(0,l.createElement)(g.USm,{className:"w-4 h-4"})))),(v||o.editedTitle)&&(0,l.createElement)("div",{className:"m-auto mt-1 w-full text-left"},(0,l.createElement)(p.Fc,{before:(0,l.createElement)(g.STI,null),color:"error",title:(0,n.__)("There was a problem with your submission","wpnakama"),variant:"expanded",className:"p-2"},(0,l.createElement)("div",null,"required"===o.editedTitle?.type?(0,n.__)("Title is required.","wpnakama"):"minLength"===o.editedTitle?.type?(0,n.__)("At least have 3 characters.","wpnakama"):"maxLength"===o.editedTitle?.type?(0,n.__)("Not more than 15 charaters.","wpnakama"):v))))},D=()=>(0,l.createElement)("div",{className:"transition-all bg-white px-3 py-2 shadow-sm rounded-xl flex items-center justify-between"},(0,l.createElement)("div",{className:"animate-pulse w-3/4 h-4 rounded-sm bg-surface-100"}),(0,l.createElement)("div",{className:"animate-pulse"},(0,l.createElement)(p.$n,{before:(0,l.createElement)(g.Mgv,null),variant:"transparent",size:"md",disabled:!0}))),T=({handleOpen:e,boardId:t,position:a,open:i=!1})=>{var c;const{handleAction:d,action:u}=(0,r.useContext)(y),{register:E,handleSubmit:f,watch:x,formState:{errors:h},reset:w}=(0,s.mN)(),v=x(),k=(0,r.useContext)(b.t),{saveEntityRecord:S,undo:C}=(0,N.useDispatch)(k),A=["WPNakama","phase",{board_id:t}],{isSaving:D,saveError:T}=(0,N.useSelect)((e=>({isSaving:e(k).isSavingEntityRecord(...A),saveError:e(k).getLastEntitySaveError(...A)})),[]);function R(){e(!1),w()}return(0,l.createElement)(l.Fragment,null,i&&(0,l.createElement)(_.Modal,{title:(0,n.__)("Add list"),size:"small",shouldCloseOnEsc:!0,shouldCloseOnClickOutside:!0,isDismissible:!0,onRequestClose:R,__experimentalHideHeader:!0,className:"rounded-lg border border-surface p-4 !min-w-[300px]"},(0,l.createElement)("div",{className:"flex flex-col gap-5 text-center text-sm text-surface-500"},(0,l.createElement)("div",{className:"text-sm leading-6 font-medium flex gap-4 items-end justify-between"},(0,l.createElement)(p.JU,{required:!0,htmlFor:"title"},(0,n.__)("Title","wpnakama")),(0,l.createElement)("div",{className:"text-xs font-normal leading-tight "+("maxLength"===h.title?.type||v?.title?.length<3||v?.title?.length>25?"text-wg-red":"text-surface-500")},(0,o.count)(null!==(c=v?.title)&&void 0!==c?c:"","characters_including_spaces")," ","/ 25")),(0,l.createElement)(p.pd,{required:!0,id:"title",...E("title",{required:!0,minLength:3,maxLength:25}),destructive:!!h.title,helperText:"required"===h.title?.type?(0,n.__)("List title is required.","wpnakama"):"minLength"===h.title?.type?(0,n.__)("At least have 3 characters.","wpnakama"):"maxLength"===h.title?.type?(0,n.__)("At most have 25 characters.","wpnakama"):(0,n.__)("A self explanatory title is good to have for a list.","wpnakama"),placeholder:(0,n.__)("List title","wpnkama"),autoFocus:!0}),T&&(0,l.createElement)("div",{className:"m-auto mt-6 max-w-sm text-left"},(0,l.createElement)(p.Fc,{before:(0,l.createElement)(g.STI,null),color:"error",title:(0,n.__)("Something went wrong while saving list.","wpnakama"),variant:"expanded",className:"p-2"},(0,l.createElement)("div",null,T))),(0,l.createElement)("div",{className:"flex gap-2 justify-end"},(0,l.createElement)(p.$n,{variant:"tertiary",onClick:R,disabled:D,className:"flex-shrink"},(0,n.__)("Cancel","wpnakama")),(0,l.createElement)(p.$n,{before:D?(0,l.createElement)(p.Rh,{type:"line",className:"text-primary-800",size:"xs"}):(0,l.createElement)(g.c11,null),variant:"primary",disabled:D,onClick:f((async function({title:e}){d(0,"add");const l=await S("WPNakama","phase",{board_id:t,title:e,position:a});R(),l?(d(l.data.phase_id,"add"),m.Ay.success((0,n.__)("List added","wpnakama")),d()):(C(),m.Ay.error((0,n.__)("Something went wrong while saving the kanban list","wpnakama")))})),className:"flex-grow"},D?(0,n.__)("Adding","wpnakama"):(0,n.__)("Add","wpnakama"))))))},R=({id:e,boardId:t,handleOpen:a,open:s=!1})=>{const{handleAction:i}=(0,r.useContext)(y),[c,d]=(0,r.useState)(!1),o=(0,r.useContext)(b.t),{deleteEntityRecord:u,undo:E}=(0,N.useDispatch)(o),f=["WPNakama","phase",e,{board_id:t}],{isDeleting:x,deleteError:h}=(0,N.useSelect)((e=>({isDeleting:e(o).isDeletingEntityRecord(...f),deleteError:e(o).getLastEntityDeleteError(...f)})),[e]);function w(){a(!1)}return(0,l.createElement)(l.Fragment,null,s&&(0,l.createElement)(_.Modal,{title:(0,n.__)("Delete List"),size:"small",shouldCloseOnEsc:!0,shouldCloseOnClickOutside:!0,isDismissible:!0,onRequestClose:w,__experimentalHideHeader:!0,className:"rounded-lg border border-surface p-4 !min-w-72 !max-w-72"},(0,l.createElement)("div",{className:"flex flex-col gap-5 text-center text-sm text-surface-500"},(0,l.createElement)("div",null,(0,l.createElement)("h2",{className:"text-base text-black font-medium"},(0,n.__)("Are you sure?","wpnakama")),(0,l.createElement)("p",null,(0,n.__)("Deleting a list will delete all its data from server.","wpnakama"))),h&&(0,l.createElement)("div",{className:"m-auto mt-6 max-w-sm text-left"},(0,l.createElement)(p.Fc,{before:(0,l.createElement)(g.STI,null),color:"error",title:(0,n.__)("Something went wrong while deleting list.","wpnakama"),variant:"expanded",className:"p-2"},(0,l.createElement)("div",null,h))),(0,l.createElement)("div",{className:"flex gap-2 justify-end"},(0,l.createElement)(p.$n,{variant:"tertiary",onClick:w,disabled:x,className:"flex-shrink"},(0,n.__)("Cancel","wpnakama")),(0,l.createElement)(p.$n,{before:c?(0,l.createElement)(p.Rh,{type:"line",className:"text-wg-red-300",size:"xs"}):(0,l.createElement)(g.ucK,null),variant:"primary",disabled:x,onClick:async function(){d(!0);const l=await u(...f);a(!1),d(!1),l?(i(e,"delete"),m.Ay.success((0,n.__)("List deleted","wpnakama")),await(0,k.wM)("/WPNakama/v1/cards",{board_id:t,phase_id:e}),i()):(E(),m.Ay.error((0,n.__)("Something went wrong while deleting the list","wpnakama")))},destructive:!0,className:"flex-grow"},(0,n.__)("Delete","wpnakama"))))))};var I;S.List=({children:e})=>(0,l.createElement)(_.__experimentalScrollable,{scrollDirection:"x",className:"w-full relative -left-4"},(0,l.createElement)("div",{className:"flex gap-12 mb-4"},e)),S.ListItem=C,S.ListItemWithLoader=(I=C,e=>{const t=(0,r.useContext)(b.t),{isSaving:a,isDeleting:n}=(0,N.useSelect)((a=>({isSaving:a(t).isSavingEntityRecord("WPNakama","phase",e.id),isDeleting:a(t).isDeletingEntityRecord("WPNakama","phase",e.id)})),[]);return e.isFinishResolving=!(a||n),(0,l.createElement)("div",{className:"relative"},(0,l.createElement)(w.P.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.35,delay:0},exit:{opacity:0},className:"h-full"},(0,l.createElement)(I,{...e})))}),S.ListItemLoading=D,S.Add=({boardId:e,position:t})=>{const[a,s]=(0,r.useState)(!1);function i(e){s((t=>null!=e?e:!t))}return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"p-4"},(0,l.createElement)(p.$n,{before:(0,l.createElement)(g.c11,{className:"text-surface-500 opacity-100 hover:text-surface-700 text-sm"}),variant:"link",onClick:i,className:"bg-white px-6 w-64 justify-start py-4 text-nowrap text-left shadow-nakama rounded-xl text-surface-500 hover:text-surface-700 text-sm"},(0,n.__)("Create list","wpnakama"))),(0,l.createElement)(T,{open:a,handleOpen:i,boardId:e,position:t}))},S.AddV2=({boardId:e,position:t})=>{const[a,s]=(0,r.useState)(!1);function i(e){s((t=>null!=e?e:!t))}return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(p.$n,{before:(0,l.createElement)(g.c11,null),variant:"outline",onClick:i,className:"bg-white flex gap-1"},(0,n.__)("Create list","wpnakama")),(0,l.createElement)(T,{open:a,handleOpen:i,boardId:e,position:t}))},S.ListAddTask=({boardId:e,listId:t,position:a})=>{const{action:i,handleAction:c}=(0,r.useContext)(y),[d,o]=(0,r.useState)(!1),{register:u,handleSubmit:E,formState:{errors:f},reset:x,clearErrors:h}=(0,s.mN)(),w=(0,r.useContext)(b.t),{saveEntityRecord:v,undo:_}=(0,N.useDispatch)(w),{isSaving:k,saveError:S}=(0,N.useSelect)((a=>({isSaving:a(w).isSavingEntityRecord("WPNakama","card",{board_id:e,phase_id:t}),saveError:a(w).getLastEntitySaveError("WPNakama","card",{board_id:e,phase_id:t})})),[]);function C(){o(!1),x(),h()}return(0,l.createElement)(l.Fragment,null,d?(0,l.createElement)("div",{className:"flex flex-col gap-2 p-4"},(0,l.createElement)(p.TM,{required:!0,...u("title",{required:!0,minLength:3}),className:"rounded-xl transition "+(f.title?"focus:shadow-wg-red-500 focus:outline-2 focus:outline-wg-red-500":"focus:shadow-primary focus:outline-2 focus:outline-primary"),destructive:!!f.title,disabled:k,helperText:"required"===f.title?.type?(0,n.__)("No empty task please.","wpnakama"):"minLength"===f.title?.type?(0,n.__)("At least have 3 characters.","wpnakama"):"",autoFocus:!0}),S&&(0,l.createElement)("div",{className:"m-auto mt-6 max-w-sm text-left"},(0,l.createElement)(p.Fc,{before:(0,l.createElement)(g.STI,null),color:"error",title:(0,n.__)("There was a problem with your submission","wpnakama"),variant:"expanded"},(0,l.createElement)("div",null,S))),(0,l.createElement)("div",{className:"flex gap-1"},(0,l.createElement)(p.$n,{variant:"primary",onClick:E((async function({title:l}){const r=await v("WPNakama","card",{board_id:e,phase_id:t,title:l,position:a});r?(c(r.data.id,"add"),m.Ay.success((0,n.__)("Task added","wpnakama")),C(),c()):(_(),m.Ay.error((0,n.__)("Something went wrong while saving the task","wpnakama")))})),className:"flex-grow px-[6px] py-2 text-sm leading-5",title:(0,n.__)("Save the task","wpnakama")},k?(0,l.createElement)(l.Fragment,null,(0,l.createElement)(p.Rh,{type:"line",size:"xxs",className:"text-surface-100"}),(0,n.__)("Adding","wpnakama")):(0,l.createElement)(l.Fragment,null,(0,n.__)("Add task","wpnakama"))),(0,l.createElement)(p.$n,{variant:"outline",onClick:C,className:"flex-shrink px-[6px] py-2 text-sm leading-5 bg-white",title:(0,n.__)("Back","wpnakama")},(0,n.__)("Cancel","wpnakama")))):(0,l.createElement)("div",{className:"flex justify-center"},(0,l.createElement)(p.$n,{before:(0,l.createElement)(g.GYj,null),variant:"link",onClick:()=>o(!0),size:"xs-icon"})))},S.NoData=({children:e})=>(0,l.createElement)("div",{className:"flex flex-col gap-6"},(0,l.createElement)("div",{className:"text-[72px] leading-[80px] tracking-tighter"},(0,l.createElement)("div",{className:"text-center text-surface-300 font-medium"},(0,n.__)("Select Board Style","wpnakama"))),(0,l.createElement)("div",{className:"mt-10"},e));var L=a(9765),P=a(7767);const F=(0,r.createContext)();function z({children:e,action:t,handleAction:a}){return(0,l.createElement)(F.Provider,{value:{action:t,handleAction:a,location:(0,P.zy)(),navigate:(0,P.Zp)()}},e)}const W=({id:e,boardId:t,title:a,deadline:s,isDragging:i=!1,isResolving:m=!1})=>{var o,u;const{location:E,navigate:f}=(0,r.useContext)(F),[h,w]=(0,r.useState)(!1),[_,k]=(0,r.useState)(!1),{isDeadLinePassed:y,displayDateFormat:S}=(0,c.A)(),C=(0,r.useRef)(!1),{truncate:A}=(0,v.A)(),D=(0,r.useContext)(b.t),T=["WPNakama","card",e,{board_id:t}],R=["WPNakama","task",{order_by:"position",board_id:t,card_id:e,per_page:51}],{editedTask:I,todos:P,completedTodo:z,isTodosResolved:W}=(0,N.useSelect)((e=>{const t=e(D).getEntityRecords(...R);return{editedTask:e(D).getEditedEntityRecord(...T),todos:t,completedTodo:t?.filter((e=>(0,L.A)(e.is_completed))),isTodosResolved:e(D).hasFinishedResolution("getEntityRecords",R)}}),[e]),U=(0,d.f)(new Date(s))?s:S(new Date((0,x.R)()));W&&!C.current&&(C.current=!0);const j=null!==(o=P?.length)&&void 0!==o?o:0;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"transition px-5 py-3 shadow-nakama rounded-2xl w-64 h-full flex flex-col gap-4 cursor-pointer "+(i?"bg-primary-100/70":"bg-white"),onClick:function(){const t=new URLSearchParams(E.search);t.set("taskId",e),f(`${E.pathname}?${t}`)}},(0,l.createElement)("div",{className:"flex flex-col gap-0 h-full"},(0,l.createElement)("div",{className:"cursor-auto",onClick:e=>e.stopPropagation()},_?(0,l.createElement)($,{id:e,boardId:t,handleOpen:k}):(0,l.createElement)("div",{className:"flex justify-between items-center"},(0,l.createElement)("div",{className:"text-sm leading-5 text-primary font-medium flex flex-col items-start gap-1",onClick:()=>k(!0)},A(null!==(u=I?.title)&&void 0!==u?u:a,40)),(0,l.createElement)(p.rI,null,(0,l.createElement)(p.rI.Trigger,{asChild:!0},(0,l.createElement)(p.$n,{before:(0,l.createElement)(g.Mgv,null),variant:"transparent",size:"md"})),(0,l.createElement)(p.rI.Content,{className:"min-w-[140px] bg-white z-10"},(0,l.createElement)(p.rI.Group,null,(0,l.createElement)(p.rI.Item,{onClick:()=>k(!0)},(0,l.createElement)(g.qUP,null),(0,l.createElement)("span",{className:"text-sm leading-6"},(0,n.__)("Rename","wpnakama")))),(0,l.createElement)(p.rI.Separator,null),(0,l.createElement)(p.rI.Group,null,(0,l.createElement)(p.rI.Item,{className:"!text-red",onClick:()=>w(!0)},(0,l.createElement)(g.ucK,{className:"!text-red-500 !opacity-100"}),(0,l.createElement)("span",{className:"text-sm leading-6"},"Delete"))))))),(0,l.createElement)("div",null,m?(0,l.createElement)(p.Ex,{before:(0,l.createElement)(g.Nl1,{className:"animate-spin"}),stroke:!0,size:"sm",shape:"pill",className:"p-1"}):(0,l.createElement)(l.Fragment,null,Number(I?.is_completed)?(0,l.createElement)(p.Ex,{before:(0,l.createElement)(g.Srz,null),shape:"pill",size:"sm",color:"green",stroke:!0},(0,n.__)("Completed","wpnakama")):(0,l.createElement)("div",{className:"text-xs font-normal flex items-center justify-start gap-1 "+(y(U)?"text-wg-red-500":"text-gray-400")},(0,l.createElement)(g.CTc,{className:"w-4 h-auto text-inherit"}),"Deadline - "+S(U),!(0,d.f)(new Date(s))&&(0,l.createElement)(p.m_,{animation:!0,content:(0,n.__)("Deadline is not set, showing current date by default.","wpnakama"),delayDuration:0}))))),(0,l.createElement)("div",{className:"flex flex-col gap-0.5"},(0,l.createElement)("div",null,W||C.current?(0,l.createElement)(l.Fragment,null,0<j?(0,l.createElement)(p.Ex,{before:(0,l.createElement)(g.Srz,null),shape:"pill",size:"sm",color:z?.length===j?"green":"gray",stroke:!0},z?.length+"/"+j):(0,l.createElement)(l.Fragment,null)):(0,l.createElement)(p.Ex,{before:(0,l.createElement)(g.Nl1,{className:"animate-spin"}),stroke:!0,size:"sm",shape:"pill",className:"p-1"})),(0,l.createElement)("div",{className:"flex justify-between"},(0,l.createElement)("div",{className:"flex-shrink"}),(0,l.createElement)("div",{className:"flex-shrink"},(0,l.createElement)("div",{className:"flex gap-2"},I?.notes&&(0,l.createElement)(p.m_,{animation:!0,content:"Notes",delayDuration:0},(0,l.createElement)("div",null,(0,l.createElement)(g.dsF,{className:"text-surface-300 size-5"})))))))),(0,l.createElement)(M,{id:e,boardId:t,title:a,open:h,handleOpen:w}))},$=({id:e,boardId:t,handleOpen:a})=>{var i;const{handleAction:d}=(0,r.useContext)(F),{datetime:o}=(0,c.A)(),{register:u,handleSubmit:E,formState:{errors:f}}=(0,s.mN)(),x=(0,r.useContext)(b.t),{editEntityRecord:h,saveEditedEntityRecord:w,undo:v}=(0,N.useDispatch)(x),{edited:_,isSaving:k,saveError:y}=(0,N.useSelect)((a=>({edited:a(x).getEditedEntityRecord("WPNakama","card",e,{board_id:t}),isSaving:a(x).isSavingEntityRecord("WPNakama","card",e,{board_id:t}),saveError:a(x).getLastEntitySaveError("WPNakama","card",e,{board_id:t})})),[e]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"flex justify-between items-center gap-1 -mx-4"},(0,l.createElement)("div",{className:"grow text-sm leading-5 px-1 py-1 rounded-sm"},(0,l.createElement)(p.pd,{className:`p-1 bg-surface-100 shadow-none border-0 w-[114px] ${null!==(i=_.title)&&void 0!==i?i:" cursor-wait animate-pulse"}`,...u("editedTitle",{required:!0,minLength:3,maxLength:50}),destructive:!!f.editedTitle,disabled:k,defaultValue:_.title,placeholder:_.title?_.title:(0,n.__)("Task","wpnakama"),autoFocus:!0})),(0,l.createElement)("div",{className:"flex gap-1 items-center"},(0,l.createElement)(p.$n,{variant:"outline",onClick:E((async function({editedTitle:l}){await async function(a){await h("WPNakama","card",e,{title:a,card_modify_date:o,board_id:t})}(l),await w("WPNakama","card",e,{board_id:t})?(d(e,"edit"),m.Ay.success((0,n.__)("Successfuly renamed the task","wpnakama")),a(!1),d()):(v(),m.Ay.error((0,n.__)("Something went wrong!","wpnakama")))})),disabled:k,size:"xs-icon",className:"px-[6px] py-2 !leading-[0]",title:(0,n.__)("Save the edited board title","wpnakama")},k?(0,l.createElement)(p.Rh,{type:"line",size:"xxs",className:"text-surface-100"}):(0,l.createElement)(g.Srz,{className:"w-4 h-4"})),(0,l.createElement)(p.$n,{variant:"outline",onClick:()=>a(!1),size:"xs-icon",className:"px-[6px] py-2 !leading-[0]",disabled:k,title:(0,n.__)("Disable rename mode","wpnakama")},(0,l.createElement)(g.USm,{className:"w-4 h-4"})))),(y||f.editedTitle)&&(0,l.createElement)("div",{className:"m-auto mt-1 w-full text-left"},(0,l.createElement)(p.Fc,{before:(0,l.createElement)(g.STI,null),color:"error",title:(0,n.__)("There was a problem with your submission","wpnakama"),variant:"expanded",className:"p-2"},(0,l.createElement)("div",null,"required"===f.editedTitle?.type?(0,n.__)("Title is required.","wpnakama"):"minLength"===f.editedTitle?.type?(0,n.__)("At least have 3 characters.","wpnakama"):"maxLength"===f.editedTitle?.type?(0,n.__)("Not more than 50 charaters.","wpnakama"):y))))},M=({id:e,boardId:t,title:a,handleOpen:s,open:i=!0})=>{const{handleAction:c}=(0,r.useContext)(F),[d,o]=(0,r.useState)(!1),u=(0,r.useContext)(b.t),{deleteEntityRecord:E,undo:f}=(0,N.useDispatch)(u),x=["WPNakama","card",e,{board_id:t}],{isDeleting:h,deleteError:w}=(0,N.useSelect)((e=>({isDeleting:e(u).isDeletingEntityRecord(...x),deleteError:e(u).getLastEntityDeleteError(...x)})),[e]);function v(){s(!1)}return(0,l.createElement)(l.Fragment,null,i&&(0,l.createElement)(_.Modal,{title:(0,n.__)("Delete Board"),size:"small",shouldCloseOnEsc:!0,shouldCloseOnClickOutside:!0,isDismissible:!0,onRequestClose:v,__experimentalHideHeader:!0,className:"rounded-lg border border-surface p-4 !min-w-72 !max-w-72"},(0,l.createElement)("div",{className:"flex flex-col gap-5 text-center text-sm text-surface-500"},(0,l.createElement)("div",null,(0,l.createElement)("h2",{className:"text-base text-black font-medium"},(0,n.__)("Are you sure?","wpnakama")),(0,l.createElement)("p",null,(0,n.__)("Deleting a task will delete all its data from server.","wpnakama"))),w&&(0,l.createElement)("div",{className:"m-auto mt-6 max-w-sm text-left"},(0,l.createElement)(p.Fc,{before:(0,l.createElement)(g.STI,null),color:"error",title:(0,n.__)("Something went wrong while deleting board.","wpnakama"),variant:"expanded",className:"p-2"},(0,l.createElement)("div",null,w))),(0,l.createElement)("div",{className:"flex gap-2 justify-end"},(0,l.createElement)(p.$n,{variant:"tertiary",onClick:v,disabled:h,className:"flex-shrink"},(0,n.__)("Cancel","wpnakama")),(0,l.createElement)(p.$n,{before:d?(0,l.createElement)(p.Rh,{type:"line",className:"text-wg-red-300",size:"xs"}):(0,l.createElement)(g.ucK,null),variant:"primary",disabled:h,onClick:async function(){o(!0);const t=await E(...x);s(!1),o(!1),t?(c(e,"delete"),m.Ay.success((0,n.__)("Task deleted","wpnakama")),c()):(f(),m.Ay.error((0,n.__)("Something went wrong while deleting the task","wpnakama")))},destructive:!0,className:"flex-grow"},(0,n.__)("Delete","wpnakama"))))))};z.List=({children:e})=>(0,l.createElement)("div",{className:"flex gap-4 flex-wrap w-full h-full"},e),z.Card=W,z.CardWithLoader=(e=>t=>{const a=(0,r.useContext)(b.t),{isSaving:n,isDeleting:s}=(0,N.useSelect)((e=>({isSaving:e(a).isSavingEntityRecord("WPNakama","card",t.id,{board_id:t.boardId}),isDeleting:e(a).isDeletingEntityRecord("WPNakama","card",t.id,{board_id:t.boardId})})),[]),i=n||s;return t.isResolving=i,(0,l.createElement)("div",{className:"relative w-64"},(0,l.createElement)(w.P.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.35,delay:0},exit:{opacity:0},className:"h-full"},(0,l.createElement)(e,{...t})),i&&(0,l.createElement)("div",{className:"absolute top-0 bottom-0 left-0 right-0 z-10 w-full h-full animate-pulse shadow-nakama rounded-3xl bg-white"}))})(W),z.CardLoading=()=>(0,l.createElement)("div",{className:"bg-white h-full min-h-[139px] px-5 py-4 shadow-nakama rounded-3xl w-72 flex flex-col gap-4"},(0,l.createElement)("div",{className:"flex flex-col gap-2 h-full"},(0,l.createElement)("div",{className:"flex flex-col gap-5"},(0,l.createElement)("div",{className:"animate-pulse w-3/4 h-4 rounded-sm bg-surface-100"}),(0,l.createElement)("div",{className:"animate-pulse w-full h-3 rounded-sm bg-surface-100"})),(0,l.createElement)("div",{className:"animated-pulse flex justify-between mt-auto"},(0,l.createElement)("div",{className:"animate-pulse w-10 h-6 rounded-sm bg-surface-100"}),(0,l.createElement)("div",{className:"animate-pulse w-6 h-6 rounded-sm bg-surface-100"}))));const U=(0,r.createContext)();function j({children:e,boardId:t,action:a,handleAction:n}){return(0,l.createElement)(U.Provider,{as:"View",className:"wpnakama-boards",value:{boardId:t,action:a,handleAction:n}},e)}j.List=({children:e})=>(0,l.createElement)(_.__experimentalScrollable,{scrollDirection:"x",className:"w-full relative px-3 py-5"},(0,l.createElement)("div",{className:"flex gap-16 justify-center items-center"},e)),j.ListItem=({title:e,description:t,bgImage:a,lists:s=[],tasks:i=[],todos:c=[]})=>{const{boardId:d,action:o,handleAction:u}=(0,r.useContext)(U),E=(0,r.useRef)(null),f=(0,r.useContext)(b.t),{saveEntityRecord:x}=(0,N.useDispatch)(f),{isSaving:h,saveError:w}=(0,N.useSelect)((e=>({isSaving:e(f).isSavingEntityRecord("WPNakama","phase",d),saveError:e(f).getLastEntitySaveError("WPNakama","phase",d)})),[]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"min-w-64 w-64 flex flex-col gap-10 bg-white rounded-xl py-3 px-4 shadow-nakama"},(0,l.createElement)("div",{className:"flex flex-col gap-3"},(0,l.createElement)("div",{className:"w-full rounded-xl shadow-nakama h-32 "+(a?"bg-cover bg-center":"bg-surface-100"),style:{backgroundImage:"url('"+a+"')"}}),(0,l.createElement)("div",{className:"flex flex-col gap-3"},(0,l.createElement)("h3",{className:"text-primary text-base leading-5 font-medium"},e),(0,l.createElement)("p",{className:"text-sm leading-5 text-gray-500"},t))),w&&(0,l.createElement)("div",{className:"m-auto mt-6 max-w-sm text-left"},(0,l.createElement)(p.Fc,{before:(0,l.createElement)(g.STI,null),color:"error",title:(0,n.__)("Something went wrong while impleting the board style.","wpnakama"),variant:"expanded"},(0,l.createElement)("div",null,w))),(0,l.createElement)("div",{className:"text-center"},(0,l.createElement)(p.$n,{before:(0,l.createElement)("div",{ref:E},(0,l.createElement)(g.c11,null)),variant:"primary",onClick:function(){let e=!1;s?.map((async({title:t},a)=>{e=await x("WPNakama","phase",{title:t,board_id:d,position:a}),u(e.data.phase_id,"add"),0===a&&0!==i.length&&i?.map((async({title:t,description:a},l)=>{const r=await x("WPNakama","card",{board_id:d,title:t,description:a,phase_id:e.data.phase_id,position:l});u(r.data.card_id,"add"),r?0!==c.length&&c?.map((async({title:e,is_completed:t},a)=>{await x("WPNakama","task",{card_id:r.data.card_id,board_id:d,content:e,is_completed:t,position:a})})):m.Ay.error((0,n.__)("Something went wrong while implementing the board style","wpnakamas"))})),a===s.length-1&&(e?(u(),(0,m.Ay)((0,n.__)("Implementing the board style","wpnakama"))):m.Ay.error((0,n.__)("Something went wrong while implementing the board style","wpnakamas")))})),(0,r.render)((0,l.createElement)(p.Rh,{type:"line",className:"text-primary-800",size:"xs"}),E.current)},disabled:h||!!o?.type},(0,n.__)("Use Style","wpnakama")))))},j.ListItemLoading=()=>(0,l.createElement)("div",{className:"wpnakama-kanbanListItem__loading p-4 w-72 h-full flex flex-col gap-8"},(0,l.createElement)("div",{className:"bg-white px-3 py-2 shadow-nakama rounded-xl"},(0,l.createElement)("div",{className:"animate-pulse w-3/4 h-4 rounded-sm bg-surface-100"}),(0,l.createElement)("div",{className:"animate-pulse w-10 h-10 rounded-sm bg-surface-100"})));var q=a(9896);const O=[{id:"to-do",title:"To Do",description:"Classic kanban view with todo, doing and done phases.",image:a.p+"images/to-do.a6018bbe.jpg",lists:[{id:"1",title:"Initial"},{id:"2",title:"Doing"},{id:"3",title:"Done"}],tasks:[{id:"1",title:"Task 1",description:"Description for task 1"}],todos:[{id:"1",title:"Todo 1",is_completed:!1},{id:"2",title:"Todo 2",is_completed:!0},{id:"3",title:"Todo 3",is_completed:!1}]},{id:"roadmap",title:"Roadmap",description:"Plan your project roadmap with this template.",image:a.p+"images/roadmap.897f4354.jpg",lists:[{id:"1",title:"Planning"},{id:"2",title:"In Progress"},{id:"3",title:"Beta Version"},{id:"4",title:"Released"}],tasks:[{id:"1",title:"Task 1",description:"Description for task 1"}],todos:[{id:"1",title:"Todo 1",is_completed:!1},{id:"2",title:"Todo 2",is_completed:!0},{id:"3",title:"Todo 3",is_completed:!1}]}];function B({boardId:e,tasks:t,isTasksResolved:a,lists:n,isListsResolved:s,action:i,handleAction:d}){var o,p;const[g,E]=(0,r.useState)([]),{sqlDateFormat:f}=(0,c.A)();async function w(e,t){await(0,k.Qt)("/WPNakama/v1/cards",e.card_id,{board_id:t,position:e.position,phase_id:e.phase_id,card_modify_date:f(new Date((0,x.R)()))}).catch((()=>{m.Ay.error(__("Something went wrong while doing auto updating.","wpnakama"))}))}(0,r.useEffect)((()=>{let e=!1;return e||E(t),()=>{e=!0}}),[t]);const v=null!==(o=n?.length)&&void 0!==o?o:0,_=null!==(p=t?.length)&&void 0!==p?p:0;return(0,l.createElement)(S,{action:i,handleAction:d},0===v?(0,l.createElement)(l.Fragment,null,s?(0,l.createElement)(S.NoData,null,(0,l.createElement)(j,{boardId:e,action:i,handleAction:d},(0,l.createElement)(j.List,null,O?(0,l.createElement)(l.Fragment,null,O?.map((e=>(0,l.createElement)(j.ListItem,{title:e.title,description:e.description,bgImage:e.image,lists:e.lists,tasks:e.tasks,todos:e.todos})))):(0,l.createElement)(j.ListItemLoading,null)))):(0,l.createElement)(u.A,null)):(0,l.createElement)(q.JY,{onDragEnd:function(t){const a=(0,h.createQueue)();let l=t.destination.index,n=t.destination.droppableId,r=t.source.index,s=t.source.droppableId,i=g?.filter((e=>e.phase_id==n)),c=i.length;if(n!=s){let t=i.slice(0,l),d=i.slice(l,c);d=d.map((t=>(t.position=Number(t.position)+1,a.add({...t},(()=>w(t,e))),t)));let m=g?.filter((e=>e.phase_id==s)),o=m[r];m.splice(r,1),o.position=l,o.phase_id=n;let u=[o];a.add({...o},(()=>w(o,e)));let p=t.concat(u,d),f=g?.filter((e=>e.phase_id!=s&&e.phase_id!=n));E([...p,...m,...f])}else if(n==s&&r<l){let t=g?.filter((e=>e.phase_id!=n)),d=g?.filter((e=>e.phase_id==s)),m=d[r];d.splice(r,1),m.position=l,m.phase_id=n,a.add({...m},(()=>w(m,e)));let o=[m],u=i.slice(0,r),p=i.slice(r+1,l+1);p=p.map((t=>(t.position=Number(t.position)-1,a.add({...t},(()=>w(t,e))),t)));let f=i.slice(l+1,c),x=u.concat(p,o,f);E([...x,...t])}else if(n==s&&r>l){let t=g?.filter((e=>e.phase_id!=n)),d=g?.filter((e=>e.phase_id==s)),m=d[r];d.splice(r,1),m.position=l,m.phase_id=n,a.add({...m},(()=>w(m,e)));let o=[m],u=i.slice(0,l),p=i.slice(l,r);p=p.map((t=>(t.position=Number(t.position)+1,a.add({...t},(()=>w(t,e))),t)));let f=i.slice(r+1,c),x=u.concat(o,p,f);E([...x,...t])}return g.map((async e=>{})),!0}},(0,l.createElement)(S.List,null,n?.map((t=>{const n=(r=t?.phase_id,r&&g?g?.filter((e=>e.phase_id==r)):[]);var r;return(0,l.createElement)("div",{className:"flex flex-col gap-3"},(0,l.createElement)(S.ListItemWithLoader,{key:t.phase_id,id:t.phase_id,title:t.title,position:t.position},(0,l.createElement)(z,{action:i,handleAction:d},0===_?(0,l.createElement)(l.Fragment,null,null!=a?a:(0,l.createElement)(z.CardLoading,null)):(0,l.createElement)(l.Fragment,null,(0,l.createElement)(q.gL,{key:t.phase_id,droppableId:t.phase_id},(({droppableProps:a,innerRef:r,placeholder:s},{isDraggingOver:i})=>(0,l.createElement)("div",{ref:r,...a,className:`w-full h-full transition ${i?"bg-secondary-100/50":"bg-secondary-100/0"} ${n.length?"":"min-h-28"}`},(0,l.createElement)(z.List,null,n?.map(((a,n)=>(0,l.createElement)(q.sx,{key:a.card_id,draggableId:a.card_id,index:n},(({draggableProps:n,dragHandleProps:r,innerRef:s},{isDragging:i})=>(0,l.createElement)("div",{...n,...r,ref:s,className:"relative"},(0,l.createElement)(G,{taskId:a.card_id,listId:t.phase_id}),(0,l.createElement)(z.CardWithLoader,{id:a.card_id,boardId:e,listId:a.phase_id,title:a.title,deadline:a.card_deadline_date,isDragging:i})))))),s))))))),(0,l.createElement)(S.ListAddTask,{boardId:e,listId:t.phase_id,position:n.length}))})),"add"===i.type&&!s&&(0,l.createElement)(S.ListItemLoading,null),(0,l.createElement)(S.Add,{boardId:e,position:v}))))}const G=({taskId:e,listId:t})=>(0,l.createElement)("div",{"data-before-task":e||"-1","data-list":t,className:"absolute -top-[0.65rem] my-0.5 w-full h-0.5 bg-primary-500/60 opacity-0"});var V=a(911),H=a(9351),Z=a(2506),J=a(6703),K=a(6744);function Y(){var e,t,a,x,h;const w=(0,r.useRef)(!1),v=(0,r.useRef)(null),{goToPage:_,goToBoardsPage:y}=(0,J.A)(),{boardId:S}=(0,Z.S)(),{action:C,handleAction:A}=(0,i.A)(),{license:D}=(0,K.A)(),{isDeadLinePassed:T,sqlDateFormat:R,displayDateFormat:I,isSecondBigThanFirst:L}=(0,c.A)(),{copyTextToClipboard:P}=function(){if(!navigator.clipboard){const e=document.createElement("textarea");return e.style.position="fixed",e.style.left="-9999px",e.style.top="-9999px",e.style.width=0,e.style.height=0,e.style.opacity=0,document.body.appendChild(e),{copyTextToClipboard:t=>(e.value=t,e.focus(),e.select(),document.execCommand("copy"),document.body.removeChild(e),Promise.resolve()),copyReadTextToClipboard:()=>(e.focus(),e.select(),document.execCommand("paste"),document.body.removeChild(e),Promise.resolve(e.value))}}return{copyTextToClipboard:e=>navigator.clipboard.writeText(e),copyReadTextToClipboard:()=>navigator.clipboard.readText()}}(),F=(0,r.useContext)(b.t),{editEntityRecord:z,saveEditedEntityRecord:W,undo:$}=(0,N.useDispatch)(F),M=["WPNakama","board",S],U=["WPNakama","phase",{_fields:"phase_id,title,board_id",board_id:S,order_by:"position",order:"asc"}],j=["WPNakama","kanbancard",{order_by:"position",board_id:S,per_page:51}],{board:q,isResolved:O,isBoardSaving:G,boardHasSaveErrors:Y,isBoardDeleting:Q,lists:X,isListsResolved:ee,tasks:te,isTasksResolved:ae}=(0,N.useSelect)((e=>({board:e(F).getEntityRecord(...M),isResolved:e(F).hasFinishedResolution("getEntityRecord",M),isBoardSaving:e(F).isSavingEntityRecord(...M),isBoardDeleting:e(F).isDeletingEntityRecord(...M),boardHasSaveErrors:e(F).getLastEntitySaveError(...M),lists:e(F).getEntityRecords(...U),isListsResolved:e(F).hasFinishedResolution("getEntityRecords",U),tasks:e(F).getEntityRecords(...j),isTasksResolved:e(F).hasFinishedResolution("getEntityRecords",j)})),[S]),{boardEdited:le,boardHasEdited:ne}=(0,N.useSelect)((e=>({boardEdited:e(F).getEditedEntityRecord(...M),boardHasEdited:e(F).hasEditsForEntityRecord(...M)})),[S]),{register:re,watch:se,handleSubmit:ie,formState:{errors:ce},reset:de,clearErrors:me}=(0,s.mN)(),oe=se(),ue={start:!(!le.start_date||!(0,d.f)(new Date(le.start_date)))&&new Date(le.start_date),end:!(!le.end_date||!(0,d.f)(new Date(le.end_date)))&&new Date(le.end_date)},pe=ne?le?.is_global:q?.is_global,ge=!!ue.start&&I(ue.start),Ee=!!ue.end&&I(ue.end),fe=!!ue.end&&T(ue.end),xe=(0,d.f)(new Date(le.start_date))&&(0,d.f)(new Date(le.end_date))&&!L(new Date(le.start_date),new Date(le.end_date));O&&ee&&!w.current&&(w.current=!0);const he=null!==(e=X?.length)&&void 0!==e?e:0,we=null!==(t=te?.length)&&void 0!==t?t:0;return(0,l.createElement)(l.Fragment,null,O||w.current?(0,l.createElement)("div",{className:"relative -top-2"},(0,l.createElement)("div",{className:"flex justify-between items-center"},(0,l.createElement)("div",{className:"text-xs leading-5 text-surface-300 flex gap-1 items-center"},(0,l.createElement)("div",{className:"cursor-pointer hover:text-surface-500 focus:text-surface-400",onClick:()=>y()},(0,n.__)("Boards","wpnakama")),(0,l.createElement)(g.vKP,{className:"w-5 h-5 text-surface-400"}),(0,l.createElement)("div",{className:"text-surface-500 font-medium"},q?.title))),(0,l.createElement)("div",{className:"mt-6"},(0,l.createElement)(p.tU,{variant:"contained-bottom",defaultValue:"tasks"},(0,l.createElement)("div",{className:"header-subpage flex gap-3 items-end justify-between"},(0,l.createElement)("div",{className:"w-full max-w-56 flex flex-col gap-3"},(0,l.createElement)("h2",{className:"font-semibold text-lg leading-6"},ne?le.title:(0,l.createElement)(l.Fragment,null,null!==(a=q?.title)&&void 0!==a?a:(0,l.createElement)("div",{className:"animate-pulse w-full h-4 rounded-sm"}))),(0,l.createElement)(p.tU.List,{className:"border-none font-medium dark:border-none bg-transparent dark:bg-transparent !shadow-none dark:shadow-none"},(0,l.createElement)(p.tU.Trigger,{before:(0,l.createElement)(g.CTc,{className:"w-5 h-5 "+(fe?"text-wg-red-500":"text-gray-600")}),value:"settings",className:"bg-surface-200/25 hover:bg-surface-200/50 border-1 border-surface-600 text-surface-500 hover:text-surface-500 data-[state=active]:text-surface-500 text-sm px-2 pt-1 pb-2",onClick:()=>v.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},(0,d.f)(new Date(le.start_date))?(0,l.createElement)("div",{className:"text-sm leading-6 flex items-center "+(fe?"text-wg-red-500":"text-gray-500")},ge," - ",(0,l.createElement)("span",{className:xe?"inline-flex gap-1 items-center underline decoration-wavy decoration-secondary-500":""},Ee,xe&&(0,l.createElement)(p.m_,{animation:!0,content:(0,n.__)("Ending date have to greater than starting date.","wpnakama"),size:"sm",align:"end"}))):(0,n.__)("Select deadline","wpnakama")))),(0,l.createElement)("div",{className:"w-fit"},(0,l.createElement)(p.tU.List,{className:"bg-white"},(0,l.createElement)(p.m_,{content:(0,l.createElement)(p.$n,{variant:"link",className:"text-sm leading-5 text-white",onClick:()=>_("wpnakama_license")},(0,n.__)("Upcoming Pro Feature","wpnakama")),color:"primary"},(0,l.createElement)(p.tU.Trigger,{before:(0,l.createElement)(g.b1v,null),after:(0,l.createElement)(H.A,{license:D}),value:"message",disabled:!0},(0,n.__)("Message Board","wpnakama"))),(0,l.createElement)(p.tU.Trigger,{before:(0,l.createElement)(g.GYj,null),after:ae?(0,l.createElement)(p.Ex,{stroke:!0,size:"sm",shape:"pill"},we):(0,l.createElement)(p.Ex,{before:(0,l.createElement)(g.Nl1,{className:"animate-spin"}),stroke:!0,size:"sm",shape:"pill",className:"p-1"}),value:"tasks"},(0,n.__)("Tasks","wpnakama")),(0,l.createElement)(p.tU.Trigger,{before:(0,l.createElement)(g.Zes,null),value:"settings"},(0,n.__)("Settings","wpnakama")),(0,l.createElement)(p.m_,{content:(0,l.createElement)(p.$n,{variant:"link",className:"text-sm leading-5 text-white",onClick:()=>_("wpnakama_license")},(0,n.__)("Upcoming Pro Feature","wpnakama")),color:"primary"},(0,l.createElement)(p.tU.Trigger,{before:(0,l.createElement)(g.oSV,null),after:(0,l.createElement)(H.A,{license:D}),value:"attachments",disabled:!0},(0,n.__)("Files Attached","wpnakama")))))),(0,l.createElement)("div",null,(0,l.createElement)(p.tU.Content,{value:"tasks"},(0,l.createElement)("div",{className:"flex flex-col gap-4 mt-4"},(0,l.createElement)("div",{className:"flex gap-4 justify-between items-center"},(0,l.createElement)("div",{className:"flex gap-4"},(0,l.createElement)(E.A,{size:"xs"}),(0,l.createElement)("div",{className:"flex items-center gap-0.5"},(0,l.createElement)(p.Ex,{before:(0,l.createElement)(f.A,{className:pe?"text-wg-green-500":"text-primary-500"}),shape:"pill",color:pe?"green":"primary",stroke:!0,className:"text-sm leading-5 text-surface-600 bg-surface-100"},pe?(0,n.__)("Public","wpnakama"):(0,n.__)("Private","wpnakama")),(0,l.createElement)(p.m_,{animation:!0,content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",null,le?.is_global?(0,n.__)("The board is visible to team members and clients."):(0,n.__)("The board is only visible to team members."))),delayDuration:0}))),(0,l.createElement)("div",{className:"flex gap-4"},(0,l.createElement)(p.AM,null,(0,l.createElement)(p.AM.Trigger,{asChild:!0},(0,l.createElement)(p.$n,{variant:"outline",before:(0,l.createElement)(g.liv,{className:"w-4 h-4 text-black"}),className:"bg-white text-black rounded-full px-4"},(0,n.__)("Share","wpnakama"))),(0,l.createElement)(p.AM.Content,{className:"min-w-[250px] p-4 z-10",align:"end"},(0,l.createElement)("div",{className:"flex flex-col gap-4"},(0,l.createElement)("div",{className:"flex-grow"},(0,l.createElement)(p.dO,{alignLabel:"start",label:(0,l.createElement)("div",{className:"flex-grow flex gap-1 text-sm font-medium items-center"},G?(0,l.createElement)(p.Rh,{className:"w-5 h-5 p-0.2 opacity-50"}):(0,l.createElement)(g.fCU,{className:"w-5 h-5"}),(0,n.__)("Share Public Link","wpnakama")),checked:le.is_global,onCheckedChange:async function(e){!async function(e){q?.global_id&&await z("WPNakama","board",S,{title:ne?le?.title:le?.title+" ",is_global:e})}(e),await(0,k.Qt)("/WPNakama/v1/boards",S,{is_global:e})?m.Ay.success((0,n.__)("Successfully saved the changes.","wpnakama")):($(),m.Ay.error((0,n.__)("Something went wrong while saving the board, please refresh the page and try again.","wpnakama")))},className:"flex justify-between items-center",disabled:G||0===he})),(0,l.createElement)("div",{className:"flex-grow relative"},(0,l.createElement)(p.pd,{id:"public-url",name:"public-url",defaultValue:q?.public_url,className:"w-full pr-10 disabled:text-surface-400 disabled:cursor-text "+(le?.is_global?"blur-0":" blur-[2px] select-none"),disabled:!0}),(0,l.createElement)(p.$n,{variant:"outline",className:"absolute right-0 top-0 mt-1 mr-1",disabled:!le?.is_global,before:(0,l.createElement)(g.TdU,null),size:"sm",onClick:()=>P(q?.public_url).then((()=>m.Ay.success((0,n.__)("Board public URL copied to clipboard.","wpnakama")))).catch((()=>m.Ay.error((0,n.__)("Failed to copy the board public URL to clipboard.","wpnakama"))))})),0===he?(0,l.createElement)(p.Fc,{before:(0,l.createElement)(g.STI,null),color:"warning",title:(0,n.__)("No board style found","wpnakama"),variant:"expanded",className:"w-72"},(0,n.__)("Please select a style to the board before sharing it with clients.","wpnakama")):(0,l.createElement)(l.Fragment,null,"inactive"===D?.status||"not found"===D?.status?(0,l.createElement)(p.Fc,{before:(0,l.createElement)(g.XAi,{className:"text-secondary-500"}),after:(0,l.createElement)(p.$n,{variant:"link",className:"text-secondary-800",onClick:()=>_("wpnakama_license")},(0,n.__)("Pro","wpnakama")),color:"warning",title:(0,n.__)(" Restrict Access with Password","wpnakama"),className:"w-72"}):(0,l.createElement)(p.Fc,{after:(0,l.createElement)(p.$n,{variant:"link",className:"text-secondary-800",onClick:()=>_("wpnakama_license")},(0,n.__)("soon","wpnakama")),color:"warning",title:(0,n.__)(" Restrict Access with Password","wpnakama"),className:"w-72"}))))))),(0,l.createElement)(B,{boardId:S,tasks:te,isTasksResolved:ae,lists:X,isListsResolved:ee,action:C,handleAction:A}))),(0,l.createElement)(p.tU.Content,{value:"settings"},(0,l.createElement)("div",{className:"mt-16 mb-10"},(0,l.createElement)("div",{className:"flex justify-between gap-2"},(0,l.createElement)("div",null,(0,l.createElement)("h2",{className:"text-base leading-6 font-semibold"},(0,n.__)("Settings","wpnakama")),(0,l.createElement)("div",{className:"text-sm leading-5 text-surface-500"},(0,n.__)("Update board settings","wpnakama"))),(0,l.createElement)("div",null,(0,l.createElement)(p.$n,{variant:"primary",disabled:G||Q,onClick:ie((async function({title:e,description:t}){if(await z("WPNakama","board",S,{title:e,description:t}),await W(...M))m.Ay.success((0,n.__)("Successfully saved the changes.","wpnakama"));else{if($(),!ne)return;m.Ay.error((0,n.__)("Something went wrong while saving the board, please refresh the page and try again.","wpnakama"))}})),before:G||Q?(0,l.createElement)(p.Rh,{type:"line",size:"xs",className:"text-primary-800"}):(0,l.createElement)(l.Fragment,null)},G?(0,n.__)("Saving changes","wpnakama"):(0,n.__)("Save changes","wpnakama")))),Y&&(0,l.createElement)("div",{className:"m-auto mt-6 w-full text-left"},(0,l.createElement)(p.Fc,{before:(0,l.createElement)(g.STI,null),color:"error",title:(0,n.__)("There was a problem with your submission","wpnakama"),closable:!0,onClose:()=>me(),variant:"expanded"},(0,l.createElement)("div",{className:"text-xs leading-5"},Y))),(0,l.createElement)("div",{className:"mt-5"},(0,l.createElement)("div",{className:"py-5 border-b-[1px] border-b-surface-200 flex gap-10 justify-between items-start"},(0,l.createElement)("div",{className:"w-2/5 flex-shrink-0"},(0,l.createElement)(p.JU,{className:"text-sm leading-5 font-medium",htmlFor:"title",required:!0},(0,n.__)("Board Title","wpnakama")),(0,l.createElement)("div",{className:"text-sm leading-4 text-surface-500 max-w-[290px]"},(0,n.__)("A self explanatory title is more searchable.","wpnakama"))),(0,l.createElement)("div",{className:"flex-grow flex flex-col gap-1 bg-surface-200/50 text-surface-500 rounded-lg"},(0,l.createElement)(p.pd,{required:!0,...re("title",{required:!0,minLength:3,maxLength:50}),id:"title",destructive:!!ce.title,defaultValue:q?.title,placeholder:(0,n.__)("Board title","wpnakama"),disabled:!O}),(0,l.createElement)("div",{className:"flex gap-3 px-1 pb-1 text-xs leading-tight"},(0,l.createElement)("div",{className:"flex-grow text-wg-red"},"required"===ce.title?.type?(0,n.__)("Field is required.","wpnakama"):"minLength"===ce.title?.type?(0,n.__)("At least 3 characters required.","wpnakama"):"maxLength"===ce.title?.type?(0,n.__)("At most 50 characters allowed.","wpnakama"):""),(0,l.createElement)("div",{className:"flex-shrink "+("maxLength"===ce.title?.type||"minLength"===ce.title?.type||oe?.title?.length<3||oe?.title?.length>50?"text-wg-red":"text-surface-500")},(0,o.count)(null!==(x=oe?.title)&&void 0!==x?x:q?.title,"characters_including_spaces")+" / 50")))),(0,l.createElement)("div",{className:"py-5 border-b-[1px] border-b-surface-200 flex gap-10 justify-between items-start"},(0,l.createElement)("div",{className:"w-2/5 flex-shrink-0"},(0,l.createElement)(p.JU,{className:"text-sm leading-5 font-medium",htmlFor:"description"},(0,n.__)("Board Description","wpnakama")),(0,l.createElement)("div",{className:"text-sm leading-4 text-surface-500 max-w-[290px]"},(0,n.__)("A short description will help others to understand the purpose of the board.","wpnakama"))),(0,l.createElement)("div",{className:"flex-grow"},(0,l.createElement)("div",{className:"flex-grow flex flex-col gap-1 bg-surface-200/50 text-surface-500 rounded-lg"},(0,l.createElement)(p.TM,{...re("description",{maxLength:250}),id:"description",className:"max-h-64 focus:shadow-primary focus:outline-2 focus:outline-primary",defaultValue:q?.description,placeholder:(0,n.__)("Board Description","wpnakama"),disabled:!O}),(0,l.createElement)("div",{className:"text-xs leading-tight px-1 pb-1 flex gap-3"},(0,l.createElement)("div",{className:"flex-grow text-wg-red"},"maxLength"===ce.description?.type?(0,n.__)("At most 250 characters allowed.","wpnakama"):""),(0,l.createElement)("div",{className:"flex-shrink "+("maxLength"===ce.description?.type||oe?.description?.length>250?"text-wg-red":"text-surface-500")},`${(0,o.count)(null!==(h=oe?.description)&&void 0!==h?h:q?.description,"characters_including_spaces")} / 250`))))),(0,l.createElement)("div",{ref:v,className:"py-5 border-b-[1px] border-b-surface-200 flex gap-10 justify-between items-start"},(0,l.createElement)("div",{className:"w-2/5 flex-shrink-0"},(0,l.createElement)(p.JU,{className:"text-sm leading-5 font-medium"},(0,n.__)("Deadline","wpnakama")),(0,l.createElement)("div",{className:"text-sm leading-4 text-surface-500 max-w-[290px]"},(0,n.__)("Set the deadline from when you are start working and finishing this board.","wpnakama"))),(0,l.createElement)("div",{className:"flex flex-grow flex-col gap-4"},(0,l.createElement)(p.AM,null,(0,l.createElement)(p.AM.Trigger,{asChild:!0,className:"group/start"},(0,l.createElement)("div",{className:"flex flex-col gap-1.5"},(0,l.createElement)(p.JU,{className:"text-sm leading-5 font-medium text-surface-500",description:(0,l.createElement)("div",{className:"text-sm leading-4 text-surface-500 max-w-[290px]"},(0,n.__)("From when to start working","wpnakama"))},(0,n.__)("Start Date","wpnakama")),(0,l.createElement)(p.$n,{id:"deadline-start",variant:"tertiary",className:"w-full justify-start rounded-lg text-sm font-normal px-4 py-2 shadow-wg-xs border-[1px] border-surface-200 bg-white group-data-[state=open]/start:outline group-data-[state=open]/start:outline-2 group-data-[state=open]/start:outline-primary-500",before:(0,l.createElement)(g.CTc,{className:"flex-shrink"}),after:(0,l.createElement)(g.ZLN,{className:"flex-shrink ml-auto"})},(0,l.createElement)("span",{className:"text-surface-500 text-left flex-grow"},ge||(0,n.__)("Select date","wpnakama"))))),(0,l.createElement)(p.AM.Content,{className:"w-96 z-10",align:"start",avoidCollisions:!0,collisionBoundary:"viewport",side:"top"},(0,l.createElement)(V.A,{selectedDate:ue.start,setSelectedDate:async function(e){await z("WPNakama","board",S,{start_date:R(new Date(e)),end_date:(0,d.f)(new Date(le.end_date))?le.end_date:R(new Date(e))})}}))),(0,l.createElement)(p.AM,null,(0,l.createElement)(p.AM.Trigger,{asChild:!0,className:"group/end"},(0,l.createElement)("div",{className:"flex flex-col gap-1.5"},(0,l.createElement)(p.JU,{htmlFor:"deadline-end",className:"text-sm leading-5 font-medium text-surface-500",description:(0,l.createElement)("div",{className:"text-sm leading-4 text-surface-500 max-w-[290px]"},(0,n.__)("Work must end before or on","wpnakama"))},(0,n.__)("End Date","wpnakama")),(0,l.createElement)(p.$n,{id:"deadline-end",variant:"tertiary",className:"w-full justify-start rounded-lg text-sm font-normal px-4 py-2 shadow-wg-xs border-[1px] border-surface-200 bg-white group-data-[state=open]/end:outline group-data-[state=open]/end:outline-2 "+(xe?"border-wg-yellow-500 group-data-[state=open]/end:outline-wg-yellow-500 text-wg-yellow-800 bg-wg-white hover:bg-wg-yellow-50":"group-data-[state=open]/end:outline-primary-500"),before:(0,l.createElement)(g.CTc,{className:"flex-shrink"}),after:(0,l.createElement)(g.ZLN,{className:"flex-shrink ml-auto"})},(0,l.createElement)("span",{className:"text-surface-500 text-left flex-grow"},Ee||(0,n.__)("Select date","wpnakama"))))),(0,l.createElement)(p.AM.Content,{className:"w-96 z-10",align:"start",avoidCollisions:!0,collisionBoundary:"viewport",side:"top"},(0,l.createElement)(V.A,{selectedDate:ue.end,setSelectedDate:async function(e){await z("WPNakama","board",S,{start_date:(0,d.f)(new Date(le.start_date))?le.start_date:R(e),end_date:R(e)})}}))),xe&&(0,l.createElement)(p.Fc,{before:(0,l.createElement)(g.STI,null),color:"warning"},(0,n.__)("Ending date have to be greater than starting date.","wpnakama"))))))))))):(0,l.createElement)(u.A,null))}}}]);
     1"use strict";(globalThis.webpackChunkwpnakama=globalThis.webpackChunkwpnakama||[]).push([[618],{911:(e,t,a)=>{a.d(t,{A:()=>E});var l=a(1609),n=a(6087),r=a(9739),s=a(5727),i=a(4051),c=a(5216),d=a(6062),m=a(8926),o=a(8723),u=a(2498),p=a(3845),g=a(6622);function E({selectedDate:e,setSelectedDate:t}){const[a]=(0,n.useState)(new Date((0,r.R)())),[E,f]=(0,n.useState)(e||a),{areDatesEqual:x}=(0,u.A)();let h=Number((0,s.GP)(a,"MM")),w=Number((0,s.GP)(a,"dd")),v=Number((0,s.GP)(E,"MM")),_=(0,s.GP)(E,"MMMM"),b=Number((0,s.GP)(E,"yyyy")),N=(0,i.P)(new Date(E));const k=[];for(let t=1;t<=N;t++){let a={};a.id=t,a.num=t,a.value=new Date(b,Number((0,s.GP)(E,"MM"))-1,t,(0,c.q)(new Date),(0,d.O)(new Date),(0,m.S)(new Date)),a.isToday=a.id==w,a.realMonth=v==h,a.isSelected=x(e,a.value),k.push(a)}let y;switch((0,o.P)(new Date(b,--v,1))){case 0:y="col-start-1";break;case 1:y="col-start-2";break;case 2:y="col-start-3";break;case 3:y="col-start-4";break;case 4:y="col-start-5";break;case 5:y="col-start-6";break;case 6:y="col-start-7";break;default:y="col-start-0"}function S(e){t(e.target.getAttribute("data-value"))}return(0,l.createElement)("div",{className:"flex flex-col gap-3 w-full"},(0,l.createElement)("div",{className:"p-3 font-medium text-base leading-6 flex gap-4 justify-between"},(0,l.createElement)("div",null,`${_} ${b}`),(0,l.createElement)("div",null,(0,l.createElement)(p.e2,{size:"sm"},(0,l.createElement)(p.e2.Item,{onClick:function(){f(new Date(0<=v<=11?b:b-1,v-1,w))},after:(0,l.createElement)(g.YJP,null)}),(0,l.createElement)(p.e2.Item,{onClick:function(){f(new Date(0<=v<=11?b:b+1,v+1,w))},after:(0,l.createElement)(g.vKP,null)})))),(0,l.createElement)("div",{className:"flex flex-col gap-4"},(0,l.createElement)("div",{className:"grid grid-cols-7 justify-center text-center"},(0,l.createElement)("div",{className:"text-sm leading-5 text-surface-300 font-medium"},"S"),(0,l.createElement)("div",{className:"text-sm leading-5 text-surface-300 font-medium"},"M"),(0,l.createElement)("div",{className:"text-sm leading-5 text-surface-300 font-medium"},"T"),(0,l.createElement)("div",{className:"text-sm leading-5 text-surface-300 font-medium"},"W"),(0,l.createElement)("div",{className:"text-sm leading-5 text-surface-300 font-medium"},"T"),(0,l.createElement)("div",{className:"text-sm leading-5 text-surface-300 font-medium"},"F"),(0,l.createElement)("div",{className:"text-sm leading-5 text-surface-300 font-medium"},"S")),(0,l.createElement)("div",{className:"grid grid-cols-7 grid-rows-6"},k.map((e=>(0,l.createElement)(n.Fragment,{key:e.id},(0,l.createElement)("div",{className:`text-center relative ${1==e.id&&y}`},e.isToday&&e.realMonth&&(0,l.createElement)("div",{className:"absolute top-1.5 left-[18px] w-1 h-1 bg-secondary rounded-full transition-all"}),(0,l.createElement)("div",{title:e.value,"data-value":e.value,className:"p-2 w-10 h-10 cursor-pointer text-slate-700 transition hover:bg-primary-50 hover:text-primary rounded-full text-sm leading-6 "+(e.isSelected?"bg-primary text-white":""),onClick:S},e.num))))))))}},9351:(e,t,a)=>{a.d(t,{A:()=>i});var l=a(1609),n=a(7723),r=a(3845),s=a(6622);function i({license:e,devPosition:t=(0,n.__)("soon","wpnakama")}){return(0,l.createElement)(l.Fragment,null,"not found"===e?.status&&(0,l.createElement)(s.XAi,{className:"!text-secondary !opacity-100 size-5"}),"inactive"===e?.status&&(0,l.createElement)(s.wUM,{className:"!text-secondary !opacity-100 size-5"}),"active"===e?.status&&(0,l.createElement)(r.Ex,{className:"py-0.25 px-1",size:"sm",shape:"pill",color:"yellow",stroke:!0},t))}},7813:(e,t,a)=>{a.d(t,{A:()=>c});var l=a(1609),n=a(6087),r=a(3845),s=a(9523),i=a(7143);function c({capabilities:e="edit_posts",userNums:t=2,size:a="xs"}){const c=(0,n.useContext)(s.t),{users:m}=(0,i.useSelect)((t=>({users:t(c).getEntityRecords("WPNakama","user",{capabilities:e})})));return(0,l.createElement)(r.Z7.Root,null,m?(0,l.createElement)(l.Fragment,null,m?.slice(0,t).map((e=>(0,l.createElement)(d,{name:e.name,avatarUrl:e.avatar_urls[48],size:a}))),t<m?.length&&(0,l.createElement)(r.Z7.Label,{size:a,className:"bg-surface text-surface-400"},"+"+(m?.length-t))):(0,l.createElement)(l.Fragment,null,(0,l.createElement)(r.Z7.Item,{alt:"",initials:"",size:a}),(0,l.createElement)(r.Z7.Item,{alt:"",initials:"",size:a}),(0,l.createElement)(r.Z7.Label,{size:a,className:"bg-surface text-surface-400"})))}const d=({name:e,avatarUrl:t,size:a})=>{const n=function(e){let t="",a=e.split(" ");for(;a.length;)t+=a.shift()[0].toUpperCase();return t}(e);return(0,l.createElement)(r.Z7.Item,{alt:e,initials:n,size:a,src:t})}},7266:(e,t,a)=>{a.d(t,{A:()=>n});var l=a(6087);function n(){const[e,t]=(0,l.useState)({});return{action:e,handleAction:(e=-1,a="")=>{t(0>e?{}:{id:e,type:a})}}}},6397:(e,t,a)=>{function l(){return{truncate:(e,t)=>e.length>t?e.substr(0,t-1)+"..":e}}a.d(t,{A:()=>l})},725:(e,t,a)=>{a.d(t,{A:()=>n});var l=a(1609);const n=(0,a(6087).forwardRef)(((e,t)=>(0,l.createElement)("svg",{...e,fill:"none",height:"24",ref:t,viewBox:"0 0 24 24",width:"24"},(0,l.createElement)("circle",{cx:"12",cy:"12",r:"4",fill:"currentColor"}))))},3913:(e,t,a)=>{a.r(t),a.d(t,{default:()=>Y});var l=a(1609),n=a(7723),r=a(6087),s=a(9785),i=a(7266),c=a(2498),d=a(6074),m=a(5038),o=a(9446),u=a(9e3),p=a(3845),g=a(6622),E=a(7813),f=a(725),x=a(9739),h=a(7494),w=a(2599),v=a(6397),_=a(6427),b=a(9523),N=a(7143),k=a(9730);const y=(0,r.createContext)();function S({children:e,action:t,handleAction:a}){return(0,l.createElement)(y.Provider,{as:"View",value:{action:t,handleAction:a}},e)}const C=({children:e,id:t,title:a,isFinishResolving:s=!0})=>{var i;const[c,d]=(0,r.useState)(!1),[m,o]=(0,r.useState)(!1),{truncate:u}=(0,v.A)(),E=(0,r.useContext)(b.t),{edited:f}=(0,N.useSelect)((e=>({edited:e(E).getEditedEntityRecord("WPNakama","phase",t)})),[t]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"p-4 w-72 h-full flex flex-col gap-8"},s?(0,l.createElement)("div",{className:"bg-white px-3 py-2 shadow-sm rounded-xl"},c?(0,l.createElement)(A,{id:t,handleOpen:d}):(0,l.createElement)("div",{className:"flex justify-between items-center"},(0,l.createElement)("div",{className:"text-base leading-5 text-primary font-medium",onClick:()=>d(!0)},u(null!==(i=f?.title)&&void 0!==i?i:a,25)),(0,l.createElement)(p.rI,null,(0,l.createElement)(p.rI.Trigger,{asChild:!0},(0,l.createElement)(p.$n,{before:(0,l.createElement)(g.Mgv,null),variant:"transparent",size:"md"})),(0,l.createElement)(p.rI.Content,{className:"min-w-[140px] bg-white z-10"},(0,l.createElement)(p.rI.Group,null,(0,l.createElement)(p.rI.Item,{onClick:()=>d(!0)},(0,l.createElement)(g.qUP,null),(0,l.createElement)("span",{className:"text-sm leading-6"},(0,n.__)("Rename","wpnakama")))),(0,l.createElement)(p.rI.Separator,null),(0,l.createElement)(p.rI.Group,null,(0,l.createElement)(p.rI.Item,{className:"!text-red",onClick:()=>o(!0)},(0,l.createElement)(g.ucK,{className:"!text-red-500 !opacity-100"}),(0,l.createElement)("span",{className:"text-sm leading-6"},"Delete"))))))):(0,l.createElement)(D,null),(0,l.createElement)("div",{className:"h-full w-full"},e)),(0,l.createElement)(R,{id:t,boardId:f?.board_id,open:m,handleOpen:o}))},A=({id:e,handleOpen:t})=>{var a;const{handleAction:i}=(0,r.useContext)(y),{register:c,handleSubmit:d,formState:{errors:o}}=(0,s.mN)(),u=(0,r.useContext)(b.t),{editEntityRecord:E,saveEditedEntityRecord:f,undo:x}=(0,N.useDispatch)(u),{edited:h,isSaving:w,saveError:v}=(0,N.useSelect)((t=>({edited:t(u).getEditedEntityRecord("WPNakama","phase",e),isSaving:t(u).isSavingEntityRecord("WPNakama","phase",e),saveError:t(u).getLastEntitySaveError("WPNakama","phase",e)})),[e]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"flex justify-between items-center gap-1"},(0,l.createElement)("div",{className:"grow text-sm leading-5 px-1 py-1 rounded-sm"},(0,l.createElement)(p.pd,{className:`p-1 bg-surface-100 shadow-none border-0 w-[140px] ${null!==(a=h?.title)&&void 0!==a?a:" cursor-wait animate-pulse"}`,...c("editedTitle",{required:!0,minLength:3,maxLength:15}),destructive:!!o.editedTitle,disabled:w,defaultValue:h.title,autoFocus:!!h?.title})),(0,l.createElement)("div",{className:"flex gap-1 items-center"},(0,l.createElement)(p.$n,{variant:"outline",onClick:d((async function({editedTitle:a}){await async function(t){await E("WPNakama","phase",e,{board_id:h.board_id,title:t})}(a),await f("WPNakama","phase",e,{board_id:h.board_id})?(i(e,"edit"),m.Ay.success((0,n.__)("Successfuly renamed the kanban list","wpnakama")),t(!1),i()):(x(),m.Ay.error((0,n.__)("Something went wrong!","wpnakama")))})),disabled:w,size:"xs-icon",className:"px-[6px] py-2 !leading-[0]",title:(0,n.__)("Save the edited board title","wpnakama")},w?(0,l.createElement)(p.Rh,{type:"line",size:"xxs",className:"text-surface-100"}):(0,l.createElement)(g.Srz,{className:"w-4 h-4"})),(0,l.createElement)(p.$n,{variant:"outline",onClick:()=>t(!1),size:"xs-icon",className:"px-[6px] py-2 !leading-[0]",disabled:w,title:(0,n.__)("Disable rename mode","wpnakama")},(0,l.createElement)(g.USm,{className:"w-4 h-4"})))),(v||o.editedTitle)&&(0,l.createElement)("div",{className:"m-auto mt-1 w-full text-left"},(0,l.createElement)(p.Fc,{before:(0,l.createElement)(g.STI,null),color:"error",title:(0,n.__)("There was a problem with your submission","wpnakama"),variant:"expanded",className:"p-2"},(0,l.createElement)("div",null,"required"===o.editedTitle?.type?(0,n.__)("Title is required.","wpnakama"):"minLength"===o.editedTitle?.type?(0,n.__)("At least have 3 characters.","wpnakama"):"maxLength"===o.editedTitle?.type?(0,n.__)("Not more than 15 charaters.","wpnakama"):v))))},D=()=>(0,l.createElement)("div",{className:"transition-all bg-white px-3 py-2 shadow-sm rounded-xl flex items-center justify-between"},(0,l.createElement)("div",{className:"animate-pulse w-3/4 h-4 rounded-sm bg-surface-100"}),(0,l.createElement)("div",{className:"animate-pulse"},(0,l.createElement)(p.$n,{before:(0,l.createElement)(g.Mgv,null),variant:"transparent",size:"md",disabled:!0}))),T=({handleOpen:e,boardId:t,position:a,open:i=!1})=>{var c;const{handleAction:d,action:u}=(0,r.useContext)(y),{register:E,handleSubmit:f,watch:x,formState:{errors:h},reset:w}=(0,s.mN)(),v=x(),k=(0,r.useContext)(b.t),{saveEntityRecord:S,undo:C}=(0,N.useDispatch)(k),A=["WPNakama","phase",{board_id:t}],{isSaving:D,saveError:T}=(0,N.useSelect)((e=>({isSaving:e(k).isSavingEntityRecord(...A),saveError:e(k).getLastEntitySaveError(...A)})),[]);function R(){e(!1),w()}return(0,l.createElement)(l.Fragment,null,i&&(0,l.createElement)(_.Modal,{title:(0,n.__)("Add list"),size:"small",shouldCloseOnEsc:!0,shouldCloseOnClickOutside:!0,isDismissible:!0,onRequestClose:R,__experimentalHideHeader:!0,className:"rounded-lg border border-surface p-4 !min-w-[300px]"},(0,l.createElement)("div",{className:"flex flex-col gap-5 text-center text-sm text-surface-500"},(0,l.createElement)("div",{className:"text-sm leading-6 font-medium flex gap-4 items-end justify-between"},(0,l.createElement)(p.JU,{required:!0,htmlFor:"title"},(0,n.__)("Title","wpnakama")),(0,l.createElement)("div",{className:"text-xs font-normal leading-tight "+("maxLength"===h.title?.type||v?.title?.length<3||v?.title?.length>25?"text-wg-red":"text-surface-500")},(0,o.count)(null!==(c=v?.title)&&void 0!==c?c:"","characters_including_spaces")," ","/ 25")),(0,l.createElement)(p.pd,{required:!0,id:"title",...E("title",{required:!0,minLength:3,maxLength:25}),destructive:!!h.title,helperText:"required"===h.title?.type?(0,n.__)("List title is required.","wpnakama"):"minLength"===h.title?.type?(0,n.__)("At least have 3 characters.","wpnakama"):"maxLength"===h.title?.type?(0,n.__)("At most have 25 characters.","wpnakama"):(0,n.__)("A self explanatory title is good to have for a list.","wpnakama"),placeholder:(0,n.__)("List title","wpnkama"),autoFocus:!0}),T&&(0,l.createElement)("div",{className:"m-auto mt-6 max-w-sm text-left"},(0,l.createElement)(p.Fc,{before:(0,l.createElement)(g.STI,null),color:"error",title:(0,n.__)("Something went wrong while saving list.","wpnakama"),variant:"expanded",className:"p-2"},(0,l.createElement)("div",null,T))),(0,l.createElement)("div",{className:"flex gap-2 justify-end"},(0,l.createElement)(p.$n,{variant:"tertiary",onClick:R,disabled:D,className:"flex-shrink"},(0,n.__)("Cancel","wpnakama")),(0,l.createElement)(p.$n,{before:D?(0,l.createElement)(p.Rh,{type:"line",className:"text-primary-800",size:"xs"}):(0,l.createElement)(g.c11,null),variant:"primary",disabled:D,onClick:f((async function({title:e}){d(0,"add");const l=await S("WPNakama","phase",{board_id:t,title:e,position:a});R(),l?(d(l.data.phase_id,"add"),m.Ay.success((0,n.__)("List added","wpnakama")),d()):(C(),m.Ay.error((0,n.__)("Something went wrong while saving the kanban list","wpnakama")))})),className:"flex-grow"},D?(0,n.__)("Adding","wpnakama"):(0,n.__)("Add","wpnakama"))))))},R=({id:e,boardId:t,handleOpen:a,open:s=!1})=>{const{handleAction:i}=(0,r.useContext)(y),[c,d]=(0,r.useState)(!1),o=(0,r.useContext)(b.t),{deleteEntityRecord:u,undo:E}=(0,N.useDispatch)(o),f=["WPNakama","phase",e,{board_id:t}],{isDeleting:x,deleteError:h}=(0,N.useSelect)((e=>({isDeleting:e(o).isDeletingEntityRecord(...f),deleteError:e(o).getLastEntityDeleteError(...f)})),[e]);function w(){a(!1)}return(0,l.createElement)(l.Fragment,null,s&&(0,l.createElement)(_.Modal,{title:(0,n.__)("Delete List"),size:"small",shouldCloseOnEsc:!0,shouldCloseOnClickOutside:!0,isDismissible:!0,onRequestClose:w,__experimentalHideHeader:!0,className:"rounded-lg border border-surface p-4 !min-w-72 !max-w-72"},(0,l.createElement)("div",{className:"flex flex-col gap-5 text-center text-sm text-surface-500"},(0,l.createElement)("div",null,(0,l.createElement)("h2",{className:"text-base text-black font-medium"},(0,n.__)("Are you sure?","wpnakama")),(0,l.createElement)("p",null,(0,n.__)("Deleting a list will delete all its data from server.","wpnakama"))),h&&(0,l.createElement)("div",{className:"m-auto mt-6 max-w-sm text-left"},(0,l.createElement)(p.Fc,{before:(0,l.createElement)(g.STI,null),color:"error",title:(0,n.__)("Something went wrong while deleting list.","wpnakama"),variant:"expanded",className:"p-2"},(0,l.createElement)("div",null,h))),(0,l.createElement)("div",{className:"flex gap-2 justify-end"},(0,l.createElement)(p.$n,{variant:"tertiary",onClick:w,disabled:x,className:"flex-shrink"},(0,n.__)("Cancel","wpnakama")),(0,l.createElement)(p.$n,{before:c?(0,l.createElement)(p.Rh,{type:"line",className:"text-wg-red-300",size:"xs"}):(0,l.createElement)(g.ucK,null),variant:"primary",disabled:x,onClick:async function(){d(!0);const l=await u(...f);a(!1),d(!1),l?(i(e,"delete"),m.Ay.success((0,n.__)("List deleted","wpnakama")),await(0,k.wM)("/WPNakama/v1/cards",{board_id:t,phase_id:e}),i()):(E(),m.Ay.error((0,n.__)("Something went wrong while deleting the list","wpnakama")))},destructive:!0,className:"flex-grow"},(0,n.__)("Delete","wpnakama"))))))};var I;S.List=({children:e})=>(0,l.createElement)(_.__experimentalScrollable,{scrollDirection:"x",className:"w-full relative -left-4"},(0,l.createElement)("div",{className:"flex gap-12 mb-4"},e)),S.ListItem=C,S.ListItemWithLoader=(I=C,e=>{const t=(0,r.useContext)(b.t),{isSaving:a,isDeleting:n}=(0,N.useSelect)((a=>({isSaving:a(t).isSavingEntityRecord("WPNakama","phase",e.id),isDeleting:a(t).isDeletingEntityRecord("WPNakama","phase",e.id)})),[]);return e.isFinishResolving=!(a||n),(0,l.createElement)("div",{className:"relative"},(0,l.createElement)(w.P.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.35,delay:0},exit:{opacity:0},className:"h-full"},(0,l.createElement)(I,{...e})))}),S.ListItemLoading=D,S.Add=({boardId:e,position:t})=>{const[a,s]=(0,r.useState)(!1);function i(e){s((t=>null!=e?e:!t))}return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"p-4"},(0,l.createElement)(p.$n,{before:(0,l.createElement)(g.c11,{className:"text-surface-500 opacity-100 hover:text-surface-700 text-sm"}),variant:"link",onClick:i,className:"bg-white px-6 w-64 justify-start py-4 text-nowrap text-left shadow-nakama rounded-xl text-surface-500 hover:text-surface-700 text-sm"},(0,n.__)("Create list","wpnakama"))),(0,l.createElement)(T,{open:a,handleOpen:i,boardId:e,position:t}))},S.AddV2=({boardId:e,position:t})=>{const[a,s]=(0,r.useState)(!1);function i(e){s((t=>null!=e?e:!t))}return(0,l.createElement)(l.Fragment,null,(0,l.createElement)(p.$n,{before:(0,l.createElement)(g.c11,null),variant:"outline",onClick:i,className:"bg-white flex gap-1"},(0,n.__)("Create list","wpnakama")),(0,l.createElement)(T,{open:a,handleOpen:i,boardId:e,position:t}))},S.ListAddTask=({boardId:e,listId:t,position:a})=>{const{action:i,handleAction:c}=(0,r.useContext)(y),[d,o]=(0,r.useState)(!1),{register:u,handleSubmit:E,formState:{errors:f},reset:x,clearErrors:h}=(0,s.mN)(),w=(0,r.useContext)(b.t),{saveEntityRecord:v,undo:_}=(0,N.useDispatch)(w),{isSaving:k,saveError:S}=(0,N.useSelect)((a=>({isSaving:a(w).isSavingEntityRecord("WPNakama","card",{board_id:e,phase_id:t}),saveError:a(w).getLastEntitySaveError("WPNakama","card",{board_id:e,phase_id:t})})),[]);function C(){o(!1),x(),h()}return(0,l.createElement)(l.Fragment,null,d?(0,l.createElement)("div",{className:"flex flex-col gap-2 p-4"},(0,l.createElement)(p.TM,{required:!0,...u("title",{required:!0,minLength:3}),className:"rounded-xl transition "+(f.title?"focus:shadow-wg-red-500 focus:outline-2 focus:outline-wg-red-500":"focus:shadow-primary focus:outline-2 focus:outline-primary"),destructive:!!f.title,disabled:k,helperText:"required"===f.title?.type?(0,n.__)("No empty task please.","wpnakama"):"minLength"===f.title?.type?(0,n.__)("At least have 3 characters.","wpnakama"):"",autoFocus:!0}),S&&(0,l.createElement)("div",{className:"m-auto mt-6 max-w-sm text-left"},(0,l.createElement)(p.Fc,{before:(0,l.createElement)(g.STI,null),color:"error",title:(0,n.__)("There was a problem with your submission","wpnakama"),variant:"expanded"},(0,l.createElement)("div",null,S))),(0,l.createElement)("div",{className:"flex gap-1"},(0,l.createElement)(p.$n,{variant:"primary",onClick:E((async function({title:l}){const r=await v("WPNakama","card",{board_id:e,phase_id:t,title:l,position:a});r?(c(r.data.id,"add"),m.Ay.success((0,n.__)("Task added","wpnakama")),C(),c()):(_(),m.Ay.error((0,n.__)("Something went wrong while saving the task","wpnakama")))})),className:"flex-grow px-[6px] py-2 text-sm leading-5",title:(0,n.__)("Save the task","wpnakama")},k?(0,l.createElement)(l.Fragment,null,(0,l.createElement)(p.Rh,{type:"line",size:"xxs",className:"text-surface-100"}),(0,n.__)("Adding","wpnakama")):(0,l.createElement)(l.Fragment,null,(0,n.__)("Add task","wpnakama"))),(0,l.createElement)(p.$n,{variant:"outline",onClick:C,className:"flex-shrink px-[6px] py-2 text-sm leading-5 bg-white",title:(0,n.__)("Back","wpnakama")},(0,n.__)("Cancel","wpnakama")))):(0,l.createElement)("div",{className:"flex justify-center"},(0,l.createElement)(p.$n,{before:(0,l.createElement)(g.GYj,null),variant:"link",onClick:()=>o(!0),size:"xs-icon"})))},S.NoData=({children:e})=>(0,l.createElement)("div",{className:"flex flex-col gap-6"},(0,l.createElement)("div",{className:"text-[72px] leading-[80px] tracking-tighter"},(0,l.createElement)("div",{className:"text-center text-surface-300 font-medium"},(0,n.__)("Select Board Style","wpnakama"))),(0,l.createElement)("div",{className:"mt-10"},e));var L=a(9765),P=a(7767);const F=(0,r.createContext)();function z({children:e,action:t,handleAction:a}){return(0,l.createElement)(F.Provider,{value:{action:t,handleAction:a,location:(0,P.zy)(),navigate:(0,P.Zp)()}},e)}const W=({id:e,boardId:t,title:a,deadline:s,isDragging:i=!1,isResolving:m=!1})=>{var o,u;const{location:E,navigate:f}=(0,r.useContext)(F),[h,w]=(0,r.useState)(!1),[_,k]=(0,r.useState)(!1),{isDeadLinePassed:y,displayDateFormat:S}=(0,c.A)(),C=(0,r.useRef)(!1),{truncate:A}=(0,v.A)(),D=(0,r.useContext)(b.t),T=["WPNakama","card",e,{board_id:t}],R=["WPNakama","task",{order_by:"position",board_id:t,card_id:e,per_page:51}],{editedTask:I,todos:P,completedTodo:z,isTodosResolved:W}=(0,N.useSelect)((e=>{const t=e(D).getEntityRecords(...R);return{editedTask:e(D).getEditedEntityRecord(...T),todos:t,completedTodo:t?.filter((e=>(0,L.A)(e.is_completed))),isTodosResolved:e(D).hasFinishedResolution("getEntityRecords",R)}}),[e]),U=(0,d.f)(new Date(s))?s:S(new Date((0,x.R)()));W&&!C.current&&(C.current=!0);const j=null!==(o=P?.length)&&void 0!==o?o:0;return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"transition px-5 py-3 shadow-nakama rounded-2xl w-64 h-full flex flex-col gap-4 cursor-pointer "+(i?"bg-primary-100/70":"bg-white"),onClick:function(){const t=new URLSearchParams(E.search);t.set("taskId",e),f(`${E.pathname}?${t}`)}},(0,l.createElement)("div",{className:"flex flex-col gap-0 h-full"},(0,l.createElement)("div",{className:"cursor-auto",onClick:e=>e.stopPropagation()},_?(0,l.createElement)($,{id:e,boardId:t,handleOpen:k}):(0,l.createElement)("div",{className:"flex justify-between items-center"},(0,l.createElement)("div",{className:"text-sm leading-5 text-primary font-medium flex flex-col items-start gap-1",onClick:()=>k(!0)},A(null!==(u=I?.title)&&void 0!==u?u:a,40)),(0,l.createElement)(p.rI,null,(0,l.createElement)(p.rI.Trigger,{asChild:!0},(0,l.createElement)(p.$n,{before:(0,l.createElement)(g.Mgv,null),variant:"transparent",size:"md"})),(0,l.createElement)(p.rI.Content,{className:"min-w-[140px] bg-white z-10"},(0,l.createElement)(p.rI.Group,null,(0,l.createElement)(p.rI.Item,{onClick:()=>k(!0)},(0,l.createElement)(g.qUP,null),(0,l.createElement)("span",{className:"text-sm leading-6"},(0,n.__)("Rename","wpnakama")))),(0,l.createElement)(p.rI.Separator,null),(0,l.createElement)(p.rI.Group,null,(0,l.createElement)(p.rI.Item,{className:"!text-red",onClick:()=>w(!0)},(0,l.createElement)(g.ucK,{className:"!text-red-500 !opacity-100"}),(0,l.createElement)("span",{className:"text-sm leading-6"},"Delete"))))))),(0,l.createElement)("div",null,m?(0,l.createElement)(p.Ex,{before:(0,l.createElement)(g.Nl1,{className:"animate-spin"}),stroke:!0,size:"sm",shape:"pill",className:"p-1"}):(0,l.createElement)(l.Fragment,null,Number(I?.is_completed)?(0,l.createElement)(p.Ex,{before:(0,l.createElement)(g.Srz,null),shape:"pill",size:"sm",color:"green",stroke:!0},(0,n.__)("Completed","wpnakama")):(0,l.createElement)("div",{className:"text-xs font-normal flex items-center justify-start gap-1 "+(y(U)?"text-wg-red-500":"text-gray-400")},(0,l.createElement)(g.CTc,{className:"w-4 h-auto text-inherit"}),"Deadline - "+S(U),!(0,d.f)(new Date(s))&&(0,l.createElement)(p.m_,{animation:!0,content:(0,n.__)("Deadline is not set, showing current date by default.","wpnakama"),delayDuration:0}))))),(0,l.createElement)("div",{className:"flex flex-col gap-0.5"},(0,l.createElement)("div",null,W||C.current?(0,l.createElement)(l.Fragment,null,0<j?(0,l.createElement)(p.Ex,{before:(0,l.createElement)(g.Srz,null),shape:"pill",size:"sm",color:z?.length===j?"green":"gray",stroke:!0},z?.length+"/"+j):(0,l.createElement)(l.Fragment,null)):(0,l.createElement)(p.Ex,{before:(0,l.createElement)(g.Nl1,{className:"animate-spin"}),stroke:!0,size:"sm",shape:"pill",className:"p-1"})),(0,l.createElement)("div",{className:"flex justify-between"},(0,l.createElement)("div",{className:"flex-shrink"}),(0,l.createElement)("div",{className:"flex-shrink"},(0,l.createElement)("div",{className:"flex gap-2"},I?.notes&&(0,l.createElement)(p.m_,{animation:!0,content:"Notes",delayDuration:0},(0,l.createElement)("div",null,(0,l.createElement)(g.dsF,{className:"text-surface-300 size-5"})))))))),(0,l.createElement)(M,{id:e,boardId:t,title:a,open:h,handleOpen:w}))},$=({id:e,boardId:t,handleOpen:a})=>{var i;const{handleAction:d}=(0,r.useContext)(F),{datetime:o}=(0,c.A)(),{register:u,handleSubmit:E,formState:{errors:f}}=(0,s.mN)(),x=(0,r.useContext)(b.t),{editEntityRecord:h,saveEditedEntityRecord:w,undo:v}=(0,N.useDispatch)(x),{edited:_,isSaving:k,saveError:y}=(0,N.useSelect)((a=>({edited:a(x).getEditedEntityRecord("WPNakama","card",e,{board_id:t}),isSaving:a(x).isSavingEntityRecord("WPNakama","card",e,{board_id:t}),saveError:a(x).getLastEntitySaveError("WPNakama","card",e,{board_id:t})})),[e]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"flex justify-between items-center gap-1 -mx-4"},(0,l.createElement)("div",{className:"grow text-sm leading-5 px-1 py-1 rounded-sm"},(0,l.createElement)(p.pd,{className:`p-1 bg-surface-100 shadow-none border-0 w-[114px] ${null!==(i=_.title)&&void 0!==i?i:" cursor-wait animate-pulse"}`,...u("editedTitle",{required:!0,minLength:3,maxLength:50}),destructive:!!f.editedTitle,disabled:k,defaultValue:_.title,placeholder:_.title?_.title:(0,n.__)("Task","wpnakama"),autoFocus:!0})),(0,l.createElement)("div",{className:"flex gap-1 items-center"},(0,l.createElement)(p.$n,{variant:"outline",onClick:E((async function({editedTitle:l}){await async function(a){await h("WPNakama","card",e,{title:a,card_modify_date:o,board_id:t})}(l),await w("WPNakama","card",e,{board_id:t})?(d(e,"edit"),m.Ay.success((0,n.__)("Successfuly renamed the task","wpnakama")),a(!1),d()):(v(),m.Ay.error((0,n.__)("Something went wrong!","wpnakama")))})),disabled:k,size:"xs-icon",className:"px-[6px] py-2 !leading-[0]",title:(0,n.__)("Save the edited board title","wpnakama")},k?(0,l.createElement)(p.Rh,{type:"line",size:"xxs",className:"text-surface-100"}):(0,l.createElement)(g.Srz,{className:"w-4 h-4"})),(0,l.createElement)(p.$n,{variant:"outline",onClick:()=>a(!1),size:"xs-icon",className:"px-[6px] py-2 !leading-[0]",disabled:k,title:(0,n.__)("Disable rename mode","wpnakama")},(0,l.createElement)(g.USm,{className:"w-4 h-4"})))),(y||f.editedTitle)&&(0,l.createElement)("div",{className:"m-auto mt-1 w-full text-left"},(0,l.createElement)(p.Fc,{before:(0,l.createElement)(g.STI,null),color:"error",title:(0,n.__)("There was a problem with your submission","wpnakama"),variant:"expanded",className:"p-2"},(0,l.createElement)("div",null,"required"===f.editedTitle?.type?(0,n.__)("Title is required.","wpnakama"):"minLength"===f.editedTitle?.type?(0,n.__)("At least have 3 characters.","wpnakama"):"maxLength"===f.editedTitle?.type?(0,n.__)("Not more than 50 charaters.","wpnakama"):y))))},M=({id:e,boardId:t,title:a,handleOpen:s,open:i=!0})=>{const{handleAction:c}=(0,r.useContext)(F),[d,o]=(0,r.useState)(!1),u=(0,r.useContext)(b.t),{deleteEntityRecord:E,undo:f}=(0,N.useDispatch)(u),x=["WPNakama","card",e,{board_id:t}],{isDeleting:h,deleteError:w}=(0,N.useSelect)((e=>({isDeleting:e(u).isDeletingEntityRecord(...x),deleteError:e(u).getLastEntityDeleteError(...x)})),[e]);function v(){s(!1)}return(0,l.createElement)(l.Fragment,null,i&&(0,l.createElement)(_.Modal,{title:(0,n.__)("Delete Board"),size:"small",shouldCloseOnEsc:!0,shouldCloseOnClickOutside:!0,isDismissible:!0,onRequestClose:v,__experimentalHideHeader:!0,className:"rounded-lg border border-surface p-4 !min-w-72 !max-w-72"},(0,l.createElement)("div",{className:"flex flex-col gap-5 text-center text-sm text-surface-500"},(0,l.createElement)("div",null,(0,l.createElement)("h2",{className:"text-base text-black font-medium"},(0,n.__)("Are you sure?","wpnakama")),(0,l.createElement)("p",null,(0,n.__)("Deleting a task will delete all its data from server.","wpnakama"))),w&&(0,l.createElement)("div",{className:"m-auto mt-6 max-w-sm text-left"},(0,l.createElement)(p.Fc,{before:(0,l.createElement)(g.STI,null),color:"error",title:(0,n.__)("Something went wrong while deleting board.","wpnakama"),variant:"expanded",className:"p-2"},(0,l.createElement)("div",null,w))),(0,l.createElement)("div",{className:"flex gap-2 justify-end"},(0,l.createElement)(p.$n,{variant:"tertiary",onClick:v,disabled:h,className:"flex-shrink"},(0,n.__)("Cancel","wpnakama")),(0,l.createElement)(p.$n,{before:d?(0,l.createElement)(p.Rh,{type:"line",className:"text-wg-red-300",size:"xs"}):(0,l.createElement)(g.ucK,null),variant:"primary",disabled:h,onClick:async function(){o(!0);const t=await E(...x);s(!1),o(!1),t?(c(e,"delete"),m.Ay.success((0,n.__)("Task deleted","wpnakama")),c()):(f(),m.Ay.error((0,n.__)("Something went wrong while deleting the task","wpnakama")))},destructive:!0,className:"flex-grow"},(0,n.__)("Delete","wpnakama"))))))};z.List=({children:e})=>(0,l.createElement)("div",{className:"flex gap-4 flex-wrap w-full h-full"},e),z.Card=W,z.CardWithLoader=(e=>t=>{const a=(0,r.useContext)(b.t),{isSaving:n,isDeleting:s}=(0,N.useSelect)((e=>({isSaving:e(a).isSavingEntityRecord("WPNakama","card",t.id,{board_id:t.boardId}),isDeleting:e(a).isDeletingEntityRecord("WPNakama","card",t.id,{board_id:t.boardId})})),[]),i=n||s;return t.isResolving=i,(0,l.createElement)("div",{className:"relative w-64"},(0,l.createElement)(w.P.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.35,delay:0},exit:{opacity:0},className:"h-full"},(0,l.createElement)(e,{...t})),i&&(0,l.createElement)("div",{className:"absolute top-0 bottom-0 left-0 right-0 z-10 w-full h-full animate-pulse shadow-nakama rounded-3xl bg-white"}))})(W),z.CardLoading=()=>(0,l.createElement)("div",{className:"bg-white h-full min-h-[139px] px-5 py-4 shadow-nakama rounded-3xl w-72 flex flex-col gap-4"},(0,l.createElement)("div",{className:"flex flex-col gap-2 h-full"},(0,l.createElement)("div",{className:"flex flex-col gap-5"},(0,l.createElement)("div",{className:"animate-pulse w-3/4 h-4 rounded-sm bg-surface-100"}),(0,l.createElement)("div",{className:"animate-pulse w-full h-3 rounded-sm bg-surface-100"})),(0,l.createElement)("div",{className:"animated-pulse flex justify-between mt-auto"},(0,l.createElement)("div",{className:"animate-pulse w-10 h-6 rounded-sm bg-surface-100"}),(0,l.createElement)("div",{className:"animate-pulse w-6 h-6 rounded-sm bg-surface-100"}))));const U=(0,r.createContext)();function j({children:e,boardId:t,action:a,handleAction:n}){return(0,l.createElement)(U.Provider,{as:"View",className:"wpnakama-boards",value:{boardId:t,action:a,handleAction:n}},e)}j.List=({children:e})=>(0,l.createElement)(_.__experimentalScrollable,{scrollDirection:"x",className:"w-full relative px-3 py-5"},(0,l.createElement)("div",{className:"flex gap-16 justify-center items-center"},e)),j.ListItem=({title:e,description:t,bgImage:a,lists:s=[],tasks:i=[],todos:c=[]})=>{const{boardId:d,action:o,handleAction:u}=(0,r.useContext)(U),E=(0,r.useRef)(null),f=(0,r.useContext)(b.t),{saveEntityRecord:x}=(0,N.useDispatch)(f),{isSaving:h,saveError:w}=(0,N.useSelect)((e=>({isSaving:e(f).isSavingEntityRecord("WPNakama","phase",d),saveError:e(f).getLastEntitySaveError("WPNakama","phase",d)})),[]);return(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",{className:"min-w-64 w-64 flex flex-col gap-10 bg-white rounded-xl py-3 px-4 shadow-nakama"},(0,l.createElement)("div",{className:"flex flex-col gap-3"},(0,l.createElement)("div",{className:"w-full rounded-xl shadow-nakama h-32 "+(a?"bg-cover bg-center":"bg-surface-100"),style:{backgroundImage:"url('"+a+"')"}}),(0,l.createElement)("div",{className:"flex flex-col gap-3"},(0,l.createElement)("h3",{className:"text-primary text-base leading-5 font-medium"},e),(0,l.createElement)("p",{className:"text-sm leading-5 text-gray-500"},t))),w&&(0,l.createElement)("div",{className:"m-auto mt-6 max-w-sm text-left"},(0,l.createElement)(p.Fc,{before:(0,l.createElement)(g.STI,null),color:"error",title:(0,n.__)("Something went wrong while impleting the board style.","wpnakama"),variant:"expanded"},(0,l.createElement)("div",null,w))),(0,l.createElement)("div",{className:"text-center"},(0,l.createElement)(p.$n,{before:(0,l.createElement)("div",{ref:E},(0,l.createElement)(g.c11,null)),variant:"primary",onClick:function(){let e=!1;s?.map((async({title:t},a)=>{e=await x("WPNakama","phase",{title:t,board_id:d,position:a}),u(e.data.phase_id,"add"),0===a&&0!==i.length&&i?.map((async({title:t,description:a},l)=>{const r=await x("WPNakama","card",{board_id:d,title:t,description:a,phase_id:e.data.phase_id,position:l});u(r.data.card_id,"add"),r?0!==c.length&&c?.map((async({title:e,is_completed:t},a)=>{await x("WPNakama","task",{card_id:r.data.card_id,board_id:d,content:e,is_completed:t,position:a})})):m.Ay.error((0,n.__)("Something went wrong while implementing the board style","wpnakamas"))})),a===s.length-1&&(e?(u(),(0,m.Ay)((0,n.__)("Implementing the board style","wpnakama"))):m.Ay.error((0,n.__)("Something went wrong while implementing the board style","wpnakamas")))})),(0,r.render)((0,l.createElement)(p.Rh,{type:"line",className:"text-primary-800",size:"xs"}),E.current)},disabled:h||!!o?.type},(0,n.__)("Use Style","wpnakama")))))},j.ListItemLoading=()=>(0,l.createElement)("div",{className:"wpnakama-kanbanListItem__loading p-4 w-72 h-full flex flex-col gap-8"},(0,l.createElement)("div",{className:"bg-white px-3 py-2 shadow-nakama rounded-xl"},(0,l.createElement)("div",{className:"animate-pulse w-3/4 h-4 rounded-sm bg-surface-100"}),(0,l.createElement)("div",{className:"animate-pulse w-10 h-10 rounded-sm bg-surface-100"})));var q=a(9896);const O=[{id:"to-do",title:"To Do",description:"Classic kanban view with todo, doing and done phases.",image:a.p+"images/to-do.a6018bbe.jpg",lists:[{id:"1",title:"Initial"},{id:"2",title:"Doing"},{id:"3",title:"Done"}],tasks:[{id:"1",title:"Task 1",description:"Description for task 1"}],todos:[{id:"1",title:"Todo 1",is_completed:!1},{id:"2",title:"Todo 2",is_completed:!0},{id:"3",title:"Todo 3",is_completed:!1}]},{id:"roadmap",title:"Roadmap",description:"Plan your project roadmap with this template.",image:a.p+"images/roadmap.897f4354.jpg",lists:[{id:"1",title:"Planning"},{id:"2",title:"In Progress"},{id:"3",title:"Beta Version"},{id:"4",title:"Released"}],tasks:[{id:"1",title:"Task 1",description:"Description for task 1"}],todos:[{id:"1",title:"Todo 1",is_completed:!1},{id:"2",title:"Todo 2",is_completed:!0},{id:"3",title:"Todo 3",is_completed:!1}]}];function B({boardId:e,tasks:t,isTasksResolved:a,lists:n,isListsResolved:s,action:i,handleAction:d}){var o,p;const[g,E]=(0,r.useState)([]),{sqlDateFormat:f}=(0,c.A)();async function w(e,t){await(0,k.Qt)("/WPNakama/v1/cards",e.card_id,{board_id:t,position:e.position,phase_id:e.phase_id,card_modify_date:f(new Date((0,x.R)()))}).catch((()=>{m.Ay.error(__("Something went wrong while doing auto updating.","wpnakama"))}))}(0,r.useEffect)((()=>{let e=!1;return e||E(t),()=>{e=!0}}),[t]);const v=null!==(o=n?.length)&&void 0!==o?o:0,_=null!==(p=t?.length)&&void 0!==p?p:0;return(0,l.createElement)(S,{action:i,handleAction:d},0===v?(0,l.createElement)(l.Fragment,null,s?(0,l.createElement)(S.NoData,null,(0,l.createElement)(j,{boardId:e,action:i,handleAction:d},(0,l.createElement)(j.List,null,O?(0,l.createElement)(l.Fragment,null,O?.map((e=>(0,l.createElement)(j.ListItem,{title:e.title,description:e.description,bgImage:e.image,lists:e.lists,tasks:e.tasks,todos:e.todos})))):(0,l.createElement)(j.ListItemLoading,null)))):(0,l.createElement)(u.A,null)):(0,l.createElement)(q.JY,{onDragEnd:function(t){const a=(0,h.createQueue)();let l=t.destination.index,n=t.destination.droppableId,r=t.source.index,s=t.source.droppableId,i=g?.filter((e=>e.phase_id==n)),c=i.length;if(n!=s){let t=i.slice(0,l),d=i.slice(l,c);d=d.map((t=>(t.position=Number(t.position)+1,a.add({...t},(()=>w(t,e))),t)));let m=g?.filter((e=>e.phase_id==s)),o=m[r];m.splice(r,1),o.position=l,o.phase_id=n;let u=[o];a.add({...o},(()=>w(o,e)));let p=t.concat(u,d),f=g?.filter((e=>e.phase_id!=s&&e.phase_id!=n));E([...p,...m,...f])}else if(n==s&&r<l){let t=g?.filter((e=>e.phase_id!=n)),d=g?.filter((e=>e.phase_id==s)),m=d[r];d.splice(r,1),m.position=l,m.phase_id=n,a.add({...m},(()=>w(m,e)));let o=[m],u=i.slice(0,r),p=i.slice(r+1,l+1);p=p.map((t=>(t.position=Number(t.position)-1,a.add({...t},(()=>w(t,e))),t)));let f=i.slice(l+1,c),x=u.concat(p,o,f);E([...x,...t])}else if(n==s&&r>l){let t=g?.filter((e=>e.phase_id!=n)),d=g?.filter((e=>e.phase_id==s)),m=d[r];d.splice(r,1),m.position=l,m.phase_id=n,a.add({...m},(()=>w(m,e)));let o=[m],u=i.slice(0,l),p=i.slice(l,r);p=p.map((t=>(t.position=Number(t.position)+1,a.add({...t},(()=>w(t,e))),t)));let f=i.slice(r+1,c),x=u.concat(o,p,f);E([...x,...t])}return g.map((async e=>{})),!0}},(0,l.createElement)(S.List,null,n?.map((t=>{const n=(r=t?.phase_id,r&&g?g?.filter((e=>e.phase_id==r)):[]);var r;return(0,l.createElement)("div",{className:"flex flex-col gap-3"},(0,l.createElement)(S.ListItemWithLoader,{key:t.phase_id,id:t.phase_id,title:t.title,position:t.position},(0,l.createElement)(z,{action:i,handleAction:d},0===_?(0,l.createElement)(l.Fragment,null,null!=a?a:(0,l.createElement)(z.CardLoading,null)):(0,l.createElement)(l.Fragment,null,(0,l.createElement)(q.gL,{key:t.phase_id,droppableId:t.phase_id},(({droppableProps:a,innerRef:r,placeholder:s},{isDraggingOver:i})=>(0,l.createElement)("div",{ref:r,...a,className:`w-full h-full transition ${i?"bg-secondary-100/50":"bg-secondary-100/0"} ${n.length?"":"min-h-28"}`},(0,l.createElement)(z.List,null,n?.map(((a,n)=>(0,l.createElement)(q.sx,{key:a.card_id,draggableId:a.card_id,index:n},(({draggableProps:n,dragHandleProps:r,innerRef:s},{isDragging:i})=>(0,l.createElement)("div",{...n,...r,ref:s,className:"relative"},(0,l.createElement)(G,{taskId:a.card_id,listId:t.phase_id}),(0,l.createElement)(z.CardWithLoader,{id:a.card_id,boardId:e,listId:a.phase_id,title:a.title,deadline:a.card_deadline_date,isDragging:i})))))),s))))))),(0,l.createElement)(S.ListAddTask,{boardId:e,listId:t.phase_id,position:n.length}))})),"add"===i.type&&!s&&(0,l.createElement)(S.ListItemLoading,null),(0,l.createElement)(S.Add,{boardId:e,position:v}))))}const G=({taskId:e,listId:t})=>(0,l.createElement)("div",{"data-before-task":e||"-1","data-list":t,className:"absolute -top-[0.65rem] my-0.5 w-full h-0.5 bg-primary-500/60 opacity-0"});var V=a(911),H=a(9351),Z=a(2506),J=a(6703),K=a(6744);function Y(){var e,t,a,x,h;const w=(0,r.useRef)(!1),v=(0,r.useRef)(null),{goToPage:_,goToBoardsPage:y}=(0,J.A)(),{boardId:S}=(0,Z.S)(),{action:C,handleAction:A}=(0,i.A)(),{license:D}=(0,K.A)(),{isDeadLinePassed:T,sqlDateFormat:R,displayDateFormat:I,isSecondBigThanFirst:L}=(0,c.A)(),{copyTextToClipboard:P}=function(){if(!navigator.clipboard){const e=document.createElement("textarea");return e.style.position="fixed",e.style.left="-9999px",e.style.top="-9999px",e.style.width=0,e.style.height=0,e.style.opacity=0,document.body.appendChild(e),{copyTextToClipboard:t=>(e.value=t,e.focus(),e.select(),document.execCommand("copy"),document.body.removeChild(e),Promise.resolve()),copyReadTextToClipboard:()=>(e.focus(),e.select(),document.execCommand("paste"),document.body.removeChild(e),Promise.resolve(e.value))}}return{copyTextToClipboard:e=>navigator.clipboard.writeText(e),copyReadTextToClipboard:()=>navigator.clipboard.readText()}}(),F=(0,r.useContext)(b.t),{editEntityRecord:z,saveEditedEntityRecord:W,undo:$}=(0,N.useDispatch)(F),M=["WPNakama","board",S],U=["WPNakama","phase",{_fields:"phase_id,title,board_id",board_id:S,order_by:"position",order:"asc"}],j=["WPNakama","card",{order_by:"position",board_id:S,per_page:51}],{board:q,isResolved:O,isBoardSaving:G,boardHasSaveErrors:Y,isBoardDeleting:Q,lists:X,isListsResolved:ee,tasks:te,isTasksResolved:ae}=(0,N.useSelect)((e=>({board:e(F).getEntityRecord(...M),isResolved:e(F).hasFinishedResolution("getEntityRecord",M),isBoardSaving:e(F).isSavingEntityRecord(...M),isBoardDeleting:e(F).isDeletingEntityRecord(...M),boardHasSaveErrors:e(F).getLastEntitySaveError(...M),lists:e(F).getEntityRecords(...U),isListsResolved:e(F).hasFinishedResolution("getEntityRecords",U),tasks:e(F).getEntityRecords(...j),isTasksResolved:e(F).hasFinishedResolution("getEntityRecords",j)})),[S]),{boardEdited:le,boardHasEdited:ne}=(0,N.useSelect)((e=>({boardEdited:e(F).getEditedEntityRecord(...M),boardHasEdited:e(F).hasEditsForEntityRecord(...M)})),[S]),{register:re,watch:se,handleSubmit:ie,formState:{errors:ce},reset:de,clearErrors:me}=(0,s.mN)(),oe=se(),ue={start:!(!le.start_date||!(0,d.f)(new Date(le.start_date)))&&new Date(le.start_date),end:!(!le.end_date||!(0,d.f)(new Date(le.end_date)))&&new Date(le.end_date)},pe=ne?le?.is_global:q?.is_global,ge=!!ue.start&&I(ue.start),Ee=!!ue.end&&I(ue.end),fe=!!ue.end&&T(ue.end),xe=(0,d.f)(new Date(le.start_date))&&(0,d.f)(new Date(le.end_date))&&!L(new Date(le.start_date),new Date(le.end_date));O&&ee&&!w.current&&(w.current=!0);const he=null!==(e=X?.length)&&void 0!==e?e:0,we=null!==(t=te?.length)&&void 0!==t?t:0;return(0,l.createElement)(l.Fragment,null,O||w.current?(0,l.createElement)("div",{className:"relative -top-2"},(0,l.createElement)("div",{className:"flex justify-between items-center"},(0,l.createElement)("div",{className:"text-xs leading-5 text-surface-300 flex gap-1 items-center"},(0,l.createElement)("div",{className:"cursor-pointer hover:text-surface-500 focus:text-surface-400",onClick:()=>y()},(0,n.__)("Boards","wpnakama")),(0,l.createElement)(g.vKP,{className:"w-5 h-5 text-surface-400"}),(0,l.createElement)("div",{className:"text-surface-500 font-medium"},q?.title))),(0,l.createElement)("div",{className:"mt-6"},(0,l.createElement)(p.tU,{variant:"contained-bottom",defaultValue:"tasks"},(0,l.createElement)("div",{className:"header-subpage flex gap-3 items-end justify-between"},(0,l.createElement)("div",{className:"w-full max-w-56 flex flex-col gap-3"},(0,l.createElement)("h2",{className:"font-semibold text-lg leading-6"},ne?le.title:(0,l.createElement)(l.Fragment,null,null!==(a=q?.title)&&void 0!==a?a:(0,l.createElement)("div",{className:"animate-pulse w-full h-4 rounded-sm"}))),(0,l.createElement)(p.tU.List,{className:"border-none font-medium dark:border-none bg-transparent dark:bg-transparent !shadow-none dark:shadow-none"},(0,l.createElement)(p.tU.Trigger,{before:(0,l.createElement)(g.CTc,{className:"w-5 h-5 "+(fe?"text-wg-red-500":"text-gray-600")}),value:"settings",className:"bg-surface-200/25 hover:bg-surface-200/50 border-1 border-surface-600 text-surface-500 hover:text-surface-500 data-[state=active]:text-surface-500 text-sm px-2 pt-1 pb-2",onClick:()=>v.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},(0,d.f)(new Date(le.start_date))?(0,l.createElement)("div",{className:"text-sm leading-6 flex items-center "+(fe?"text-wg-red-500":"text-gray-500")},ge," - ",(0,l.createElement)("span",{className:xe?"inline-flex gap-1 items-center underline decoration-wavy decoration-secondary-500":""},Ee,xe&&(0,l.createElement)(p.m_,{animation:!0,content:(0,n.__)("Ending date have to greater than starting date.","wpnakama"),size:"sm",align:"end"}))):(0,n.__)("Select deadline","wpnakama")))),(0,l.createElement)("div",{className:"w-fit"},(0,l.createElement)(p.tU.List,{className:"bg-white"},(0,l.createElement)(p.m_,{content:(0,l.createElement)(p.$n,{variant:"link",className:"text-sm leading-5 text-white",onClick:()=>_("wpnakama_license")},(0,n.__)("Upcoming Pro Feature","wpnakama")),color:"primary"},(0,l.createElement)(p.tU.Trigger,{before:(0,l.createElement)(g.b1v,null),after:(0,l.createElement)(H.A,{license:D}),value:"message",disabled:!0},(0,n.__)("Message Board","wpnakama"))),(0,l.createElement)(p.tU.Trigger,{before:(0,l.createElement)(g.GYj,null),after:ae?(0,l.createElement)(p.Ex,{stroke:!0,size:"sm",shape:"pill"},we):(0,l.createElement)(p.Ex,{before:(0,l.createElement)(g.Nl1,{className:"animate-spin"}),stroke:!0,size:"sm",shape:"pill",className:"p-1"}),value:"tasks"},(0,n.__)("Tasks","wpnakama")),(0,l.createElement)(p.tU.Trigger,{before:(0,l.createElement)(g.Zes,null),value:"settings"},(0,n.__)("Settings","wpnakama")),(0,l.createElement)(p.m_,{content:(0,l.createElement)(p.$n,{variant:"link",className:"text-sm leading-5 text-white",onClick:()=>_("wpnakama_license")},(0,n.__)("Upcoming Pro Feature","wpnakama")),color:"primary"},(0,l.createElement)(p.tU.Trigger,{before:(0,l.createElement)(g.oSV,null),after:(0,l.createElement)(H.A,{license:D}),value:"attachments",disabled:!0},(0,n.__)("Files Attached","wpnakama")))))),(0,l.createElement)("div",null,(0,l.createElement)(p.tU.Content,{value:"tasks"},(0,l.createElement)("div",{className:"flex flex-col gap-4 mt-4"},(0,l.createElement)("div",{className:"flex gap-4 justify-between items-center"},(0,l.createElement)("div",{className:"flex gap-4"},(0,l.createElement)(E.A,{size:"xs"}),(0,l.createElement)("div",{className:"flex items-center gap-0.5"},(0,l.createElement)(p.Ex,{before:(0,l.createElement)(f.A,{className:pe?"text-wg-green-500":"text-primary-500"}),shape:"pill",color:pe?"green":"primary",stroke:!0,className:"text-sm leading-5 text-surface-600 bg-surface-100"},pe?(0,n.__)("Public","wpnakama"):(0,n.__)("Private","wpnakama")),(0,l.createElement)(p.m_,{animation:!0,content:(0,l.createElement)(l.Fragment,null,(0,l.createElement)("div",null,le?.is_global?(0,n.__)("The board is visible to team members and clients."):(0,n.__)("The board is only visible to team members."))),delayDuration:0}))),(0,l.createElement)("div",{className:"flex gap-4"},(0,l.createElement)(p.AM,null,(0,l.createElement)(p.AM.Trigger,{asChild:!0},(0,l.createElement)(p.$n,{variant:"outline",before:(0,l.createElement)(g.liv,{className:"w-4 h-4 text-black"}),className:"bg-white text-black rounded-full px-4"},(0,n.__)("Share","wpnakama"))),(0,l.createElement)(p.AM.Content,{className:"min-w-[250px] p-4 z-10",align:"end"},(0,l.createElement)("div",{className:"flex flex-col gap-4"},(0,l.createElement)("div",{className:"flex-grow"},(0,l.createElement)(p.dO,{alignLabel:"start",label:(0,l.createElement)("div",{className:"flex-grow flex gap-1 text-sm font-medium items-center"},G?(0,l.createElement)(p.Rh,{className:"w-5 h-5 p-0.2 opacity-50"}):(0,l.createElement)(g.fCU,{className:"w-5 h-5"}),(0,n.__)("Share Public Link","wpnakama")),checked:le.is_global,onCheckedChange:async function(e){!async function(e){q?.global_id&&await z("WPNakama","board",S,{title:ne?le?.title:le?.title+" ",is_global:e})}(e),await(0,k.Qt)("/WPNakama/v1/boards",S,{is_global:e})?m.Ay.success((0,n.__)("Successfully saved the changes.","wpnakama")):($(),m.Ay.error((0,n.__)("Something went wrong while saving the board, please refresh the page and try again.","wpnakama")))},className:"flex justify-between items-center",disabled:G||0===he})),(0,l.createElement)("div",{className:"flex-grow relative"},(0,l.createElement)(p.pd,{id:"public-url",name:"public-url",defaultValue:q?.public_url,className:"w-full pr-10 disabled:text-surface-400 disabled:cursor-text "+(le?.is_global?"blur-0":" blur-[2px] select-none"),disabled:!0}),(0,l.createElement)(p.$n,{variant:"outline",className:"absolute right-0 top-0 mt-1 mr-1",disabled:!le?.is_global,before:(0,l.createElement)(g.TdU,null),size:"sm",onClick:()=>P(q?.public_url).then((()=>m.Ay.success((0,n.__)("Board public URL copied to clipboard.","wpnakama")))).catch((()=>m.Ay.error((0,n.__)("Failed to copy the board public URL to clipboard.","wpnakama"))))})),0===he?(0,l.createElement)(p.Fc,{before:(0,l.createElement)(g.STI,null),color:"warning",title:(0,n.__)("No board style found","wpnakama"),variant:"expanded",className:"w-72"},(0,n.__)("Please select a style to the board before sharing it with clients.","wpnakama")):(0,l.createElement)(l.Fragment,null,"inactive"===D?.status||"not found"===D?.status?(0,l.createElement)(p.Fc,{before:(0,l.createElement)(g.XAi,{className:"text-secondary-500"}),after:(0,l.createElement)(p.$n,{variant:"link",className:"text-secondary-800",onClick:()=>_("wpnakama_license")},(0,n.__)("Pro","wpnakama")),color:"warning",title:(0,n.__)(" Restrict Access with Password","wpnakama"),className:"w-72"}):(0,l.createElement)(p.Fc,{after:(0,l.createElement)(p.$n,{variant:"link",className:"text-secondary-800",onClick:()=>_("wpnakama_license")},(0,n.__)("soon","wpnakama")),color:"warning",title:(0,n.__)(" Restrict Access with Password","wpnakama"),className:"w-72"}))))))),(0,l.createElement)(B,{boardId:S,tasks:te,isTasksResolved:ae,lists:X,isListsResolved:ee,action:C,handleAction:A}))),(0,l.createElement)(p.tU.Content,{value:"settings"},(0,l.createElement)("div",{className:"mt-16 mb-10"},(0,l.createElement)("div",{className:"flex justify-between gap-2"},(0,l.createElement)("div",null,(0,l.createElement)("h2",{className:"text-base leading-6 font-semibold"},(0,n.__)("Settings","wpnakama")),(0,l.createElement)("div",{className:"text-sm leading-5 text-surface-500"},(0,n.__)("Update board settings","wpnakama"))),(0,l.createElement)("div",null,(0,l.createElement)(p.$n,{variant:"primary",disabled:G||Q,onClick:ie((async function({title:e,description:t}){if(await z("WPNakama","board",S,{title:e,description:t}),await W(...M))m.Ay.success((0,n.__)("Successfully saved the changes.","wpnakama"));else{if($(),!ne)return;m.Ay.error((0,n.__)("Something went wrong while saving the board, please refresh the page and try again.","wpnakama"))}})),before:G||Q?(0,l.createElement)(p.Rh,{type:"line",size:"xs",className:"text-primary-800"}):(0,l.createElement)(l.Fragment,null)},G?(0,n.__)("Saving changes","wpnakama"):(0,n.__)("Save changes","wpnakama")))),Y&&(0,l.createElement)("div",{className:"m-auto mt-6 w-full text-left"},(0,l.createElement)(p.Fc,{before:(0,l.createElement)(g.STI,null),color:"error",title:(0,n.__)("There was a problem with your submission","wpnakama"),closable:!0,onClose:()=>me(),variant:"expanded"},(0,l.createElement)("div",{className:"text-xs leading-5"},Y))),(0,l.createElement)("div",{className:"mt-5"},(0,l.createElement)("div",{className:"py-5 border-b-[1px] border-b-surface-200 flex gap-10 justify-between items-start"},(0,l.createElement)("div",{className:"w-2/5 flex-shrink-0"},(0,l.createElement)(p.JU,{className:"text-sm leading-5 font-medium",htmlFor:"title",required:!0},(0,n.__)("Board Title","wpnakama")),(0,l.createElement)("div",{className:"text-sm leading-4 text-surface-500 max-w-[290px]"},(0,n.__)("A self explanatory title is more searchable.","wpnakama"))),(0,l.createElement)("div",{className:"flex-grow flex flex-col gap-1 bg-surface-200/50 text-surface-500 rounded-lg"},(0,l.createElement)(p.pd,{required:!0,...re("title",{required:!0,minLength:3,maxLength:50}),id:"title",destructive:!!ce.title,defaultValue:q?.title,placeholder:(0,n.__)("Board title","wpnakama"),disabled:!O}),(0,l.createElement)("div",{className:"flex gap-3 px-1 pb-1 text-xs leading-tight"},(0,l.createElement)("div",{className:"flex-grow text-wg-red"},"required"===ce.title?.type?(0,n.__)("Field is required.","wpnakama"):"minLength"===ce.title?.type?(0,n.__)("At least 3 characters required.","wpnakama"):"maxLength"===ce.title?.type?(0,n.__)("At most 50 characters allowed.","wpnakama"):""),(0,l.createElement)("div",{className:"flex-shrink "+("maxLength"===ce.title?.type||"minLength"===ce.title?.type||oe?.title?.length<3||oe?.title?.length>50?"text-wg-red":"text-surface-500")},(0,o.count)(null!==(x=oe?.title)&&void 0!==x?x:q?.title,"characters_including_spaces")+" / 50")))),(0,l.createElement)("div",{className:"py-5 border-b-[1px] border-b-surface-200 flex gap-10 justify-between items-start"},(0,l.createElement)("div",{className:"w-2/5 flex-shrink-0"},(0,l.createElement)(p.JU,{className:"text-sm leading-5 font-medium",htmlFor:"description"},(0,n.__)("Board Description","wpnakama")),(0,l.createElement)("div",{className:"text-sm leading-4 text-surface-500 max-w-[290px]"},(0,n.__)("A short description will help others to understand the purpose of the board.","wpnakama"))),(0,l.createElement)("div",{className:"flex-grow"},(0,l.createElement)("div",{className:"flex-grow flex flex-col gap-1 bg-surface-200/50 text-surface-500 rounded-lg"},(0,l.createElement)(p.TM,{...re("description",{maxLength:250}),id:"description",className:"max-h-64 focus:shadow-primary focus:outline-2 focus:outline-primary",defaultValue:q?.description,placeholder:(0,n.__)("Board Description","wpnakama"),disabled:!O}),(0,l.createElement)("div",{className:"text-xs leading-tight px-1 pb-1 flex gap-3"},(0,l.createElement)("div",{className:"flex-grow text-wg-red"},"maxLength"===ce.description?.type?(0,n.__)("At most 250 characters allowed.","wpnakama"):""),(0,l.createElement)("div",{className:"flex-shrink "+("maxLength"===ce.description?.type||oe?.description?.length>250?"text-wg-red":"text-surface-500")},`${(0,o.count)(null!==(h=oe?.description)&&void 0!==h?h:q?.description,"characters_including_spaces")} / 250`))))),(0,l.createElement)("div",{ref:v,className:"py-5 border-b-[1px] border-b-surface-200 flex gap-10 justify-between items-start"},(0,l.createElement)("div",{className:"w-2/5 flex-shrink-0"},(0,l.createElement)(p.JU,{className:"text-sm leading-5 font-medium"},(0,n.__)("Deadline","wpnakama")),(0,l.createElement)("div",{className:"text-sm leading-4 text-surface-500 max-w-[290px]"},(0,n.__)("Set the deadline from when you are start working and finishing this board.","wpnakama"))),(0,l.createElement)("div",{className:"flex flex-grow flex-col gap-4"},(0,l.createElement)(p.AM,null,(0,l.createElement)(p.AM.Trigger,{asChild:!0,className:"group/start"},(0,l.createElement)("div",{className:"flex flex-col gap-1.5"},(0,l.createElement)(p.JU,{className:"text-sm leading-5 font-medium text-surface-500",description:(0,l.createElement)("div",{className:"text-sm leading-4 text-surface-500 max-w-[290px]"},(0,n.__)("From when to start working","wpnakama"))},(0,n.__)("Start Date","wpnakama")),(0,l.createElement)(p.$n,{id:"deadline-start",variant:"tertiary",className:"w-full justify-start rounded-lg text-sm font-normal px-4 py-2 shadow-wg-xs border-[1px] border-surface-200 bg-white group-data-[state=open]/start:outline group-data-[state=open]/start:outline-2 group-data-[state=open]/start:outline-primary-500",before:(0,l.createElement)(g.CTc,{className:"flex-shrink"}),after:(0,l.createElement)(g.ZLN,{className:"flex-shrink ml-auto"})},(0,l.createElement)("span",{className:"text-surface-500 text-left flex-grow"},ge||(0,n.__)("Select date","wpnakama"))))),(0,l.createElement)(p.AM.Content,{className:"w-96 z-10",align:"start",avoidCollisions:!0,collisionBoundary:"viewport",side:"top"},(0,l.createElement)(V.A,{selectedDate:ue.start,setSelectedDate:async function(e){await z("WPNakama","board",S,{start_date:R(new Date(e)),end_date:(0,d.f)(new Date(le.end_date))?le.end_date:R(new Date(e))})}}))),(0,l.createElement)(p.AM,null,(0,l.createElement)(p.AM.Trigger,{asChild:!0,className:"group/end"},(0,l.createElement)("div",{className:"flex flex-col gap-1.5"},(0,l.createElement)(p.JU,{htmlFor:"deadline-end",className:"text-sm leading-5 font-medium text-surface-500",description:(0,l.createElement)("div",{className:"text-sm leading-4 text-surface-500 max-w-[290px]"},(0,n.__)("Work must end before or on","wpnakama"))},(0,n.__)("End Date","wpnakama")),(0,l.createElement)(p.$n,{id:"deadline-end",variant:"tertiary",className:"w-full justify-start rounded-lg text-sm font-normal px-4 py-2 shadow-wg-xs border-[1px] border-surface-200 bg-white group-data-[state=open]/end:outline group-data-[state=open]/end:outline-2 "+(xe?"border-wg-yellow-500 group-data-[state=open]/end:outline-wg-yellow-500 text-wg-yellow-800 bg-wg-white hover:bg-wg-yellow-50":"group-data-[state=open]/end:outline-primary-500"),before:(0,l.createElement)(g.CTc,{className:"flex-shrink"}),after:(0,l.createElement)(g.ZLN,{className:"flex-shrink ml-auto"})},(0,l.createElement)("span",{className:"text-surface-500 text-left flex-grow"},Ee||(0,n.__)("Select date","wpnakama"))))),(0,l.createElement)(p.AM.Content,{className:"w-96 z-10",align:"start",avoidCollisions:!0,collisionBoundary:"viewport",side:"top"},(0,l.createElement)(V.A,{selectedDate:ue.end,setSelectedDate:async function(e){await z("WPNakama","board",S,{start_date:(0,d.f)(new Date(le.start_date))?le.start_date:R(e),end_date:R(e)})}}))),xe&&(0,l.createElement)(p.Fc,{before:(0,l.createElement)(g.STI,null),color:"warning"},(0,n.__)("Ending date have to be greater than starting date.","wpnakama"))))))))))):(0,l.createElement)(u.A,null))}}}]);
  • wpnakama/trunk/changelog.txt

    r3180973 r3182560  
     1November 2024 - Version 0.3.6
     2    * Fix: Tasks on kanban board not showing
    13November 2024 - Version 0.3.5
    24    * Update: Support latest WordPress version 6.7
  • wpnakama/trunk/inc/class-wpnakama.php

    r3180973 r3182560  
    66 * @subpackage  Core
    77 * @since       0.1.0
    8  * @version     0.3.5
     8 * @version     0.3.6
    99 * @author      kantbtrue, qdonow, designthingy, savydv
    1010 * @license     GPL-2.0-or-later
  • wpnakama/trunk/readme.txt

    r3180973 r3182560  
    55Requires PHP: 7.4
    66Requires at least: 6.2.0
    7 Stable Tag: 0.3.5
     7Stable Tag: 0.3.6
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    108108== Changelog ==
    109109
     110= 0.3.6 =
     111    * Fix: Tasks on kanban board not showing
     112
    110113= 0.3.5 =
    111114    * Update: Support latest WordPress version 6.7
     
    163166== Upgrade Notice ==
    164167
     168= 0.3.6 =
     169Fixed the issue where tasks were not displaying on the kanban board.
     170
    165171= 0.3.5 =
    166172Update now! WPNakama supports the latest WordPress version 6.7.
  • wpnakama/trunk/wpnakama.php

    r3180973 r3182560  
    1111 * Plugin Name:       WPNakama - Team and client collaboration Starts Here
    1212 * Description:       Do you have Clients, a Team, & deadlines? OR Struggling with Productivity and Transparency? Then WPNakama is just meant for you.
    13  * Version:           0.3.5
     13 * Version:           0.3.6
    1414 * Requires at least: 6.2.0
    1515 * Requires PHP:      7.4
     
    4848define( 'WPNAKAMA_PLUGIN_URL', plugin_dir_url( WPNAKAMA_PLUGIN_FILE ) );
    4949define( 'WPNAKAMA_PLUGIN_PATH', plugin_dir_path( WPNAKAMA_PLUGIN_FILE ) );
    50 define( 'WPNAKAMA_VERSION', '0.3.5' );
     50define( 'WPNAKAMA_VERSION', '0.3.6' );
    5151
    5252/**
Note: See TracChangeset for help on using the changeset viewer.