"use strict";(self.webpackChunkmattermost_webapp=self.webpackChunkmattermost_webapp||[]).push([[2539],{22539:(e,t,a)=>{a.r(t),a.d(t,{default:()=>M});var n=a(71633),s=a.n(n),c=a(97023),l=a.n(c),r=a(14778),i=a(23453),o=a(81911),d=a(65642),u=a(77440),m=a(73969),f=a(14776),b=a(26241),p=a(67173),E=a(45697),h=a(87131),k=a(78451);const N=(0,p.wV)(),S=l().createElement("i",{"data-testid":"scheduledPostIcon",className:"icon icon-draft-indicator icon-clock-send-outline"}),v=l().createElement("i",{"data-testid":"draftIcon",className:"icon icon-draft-indicator icon-pencil-outline"});function C(){const e=(0,i.useDispatch)(),t=(0,c.useRef)(!1),a=(0,i.useSelector)(u.LW),n=(0,i.useSelector)(N),p=(0,i.useSelector)(f.Sy),C=(0,i.useSelector)((e=>(0,m.cn)(e,p,!0))),M=(0,i.useSelector)(m.Ck),g=n>0||M&&C>0,L=(0,i.useSelector)((e=>(0,m.U)(e,p))),{url:_}=(0,o.useRouteMatch)(),w=(0,o.useRouteMatch)("/:team/drafts"),I=(0,o.useRouteMatch)("/:team/"+k.pj),A=Boolean(w||I),P=(0,c.useCallback)((()=>A),[A]);(0,c.useEffect)((()=>{a&&e((0,b.Vp)(p))}),[p,a,e]),(0,c.useEffect)((()=>{const a=!t.current;M&&e((0,d.cT)(p,a)),t.current=!0}),[e,M,p]);const R=M&&C>0,x=(0,c.useMemo)((()=>l().createElement(r.FormattedMessage,{id:"drafts.tooltipText",defaultMessage:"",values:{draftCount:n,scheduledPostCount:C,br:e=>n>0&&C>0?l().createElement(l().Fragment,null,l().createElement("br",null),e):null}})),[n,C]);return g||A?l().createElement("ul",{className:"SidebarDrafts NavGroupContent nav nav-pills__container"},l().createElement("li",{className:"SidebarChannel",tabIndex:-1,id:"sidebar-drafts-button"},l().createElement(o.NavLink,{to:"".concat(_,"/drafts"),id:"sidebarItem_drafts",activeClassName:"active",draggable:"false",className:"SidebarLink sidebar-item",tabIndex:0,isActive:P},l().createElement("i",{"data-testid":"sendPostIcon",className:"icon icon-send-post icon-send"}),l().createElement("div",{className:"SidebarChannelLinkLabel_wrapper"},l().createElement("span",{className:"SidebarChannelLinkLabel sidebar-item__name"},l().createElement(r.FormattedMessage,{id:"drafts.sidebarLink",defaultMessage:"Drafts"}))),l().createElement(h.A,{title:x},l().createElement("div",null,n>0&&l().createElement(E.A,{unreadMentions:n,icon:v}),R&&l().createElement(E.A,{unreadMentions:C,icon:S,className:s()("scheduledPostBadge",{persistent:L}),hasUrgent:L})))))):null}const M=(0,c.memo)(C)}}]);
//# sourceMappingURL=2539.0c3a1fdd27feb72e7d04.js.map