"use strict";(self.webpackChunkmattermost_webapp=self.webpackChunkmattermost_webapp||[]).push([[3635],{83635:(e,t,a)=>{a.r(t),a.d(t,{default:()=>O});var s=a(71633),n=a.n(s),r=a(97023),l=a.n(r),c=a(14778),i=a(23453),o=a(81911),d=a(65642),u=a(77440),m=a(73969),f=a(14776),p=a(26241),E=a(67173),g=(a(17046),a(14696)),h=a(40057),b=a(67416);const v=l().createElement("span",{className:"d-flex align-items-center"},l().createElement(c.FormattedMessage,{id:"drafts.tutorialTip.title",defaultMessage:"Drafts"}),l().createElement(b.A,{variant:"success",text:l().createElement(c.FormattedMessage,{id:"tag.default.new",defaultMessage:"NEW"})})),M=l().createElement(l().Fragment,null,l().createElement(c.FormattedMessage,{id:"drafts.tutorialTip.description",defaultMessage:"With the new Drafts view, all of your unfinished messages are collected in one place. Return here to read, edit, or send draft messages."})),S=l().createElement(c.FormattedMessage,{id:"drafts.tutorial_tip.notNow",defaultMessage:"Not now"}),_=l().createElement(c.FormattedMessage,{id:"drafts.tutorial_tip.viewDrafts",defaultMessage:"View drafts"}),N=()=>{const e=(0,i.useDispatch)(),t=(0,o.useHistory)(),a=(0,i.useSelector)(E._e),{url:s}=(0,o.useRouteMatch)(),n="".concat(s,"/drafts"),[c,d]=(0,r.useState)(a),u=(0,r.useCallback)((t=>{t.stopPropagation(),e((0,p.tv)({[h.pm.DRAFTS_TOUR_TIP_SHOWED]:!0})),d(!1)}),[]),m=(0,r.useCallback)((()=>{e((0,p.tv)({[h.pm.DRAFTS_TOUR_TIP_SHOWED]:!0})),d(!1),t.push(n)}),[]),f=(0,r.useCallback)((t=>{t.stopPropagation(),t.preventDefault(),c?(e((0,p.tv)({[h.pm.DRAFTS_TOUR_TIP_SHOWED]:!0})),d(!1)):d(!0)}),[]),b=(0,g.LX)(["sidebar-drafts-button"],[]);return l().createElement(l().Fragment,null,a&&l().createElement(g.Yd,{show:c,screen:M,title:v,overlayPunchOut:b,placement:"right-start",pulsatingDotPlacement:"right",step:1,singleTip:!0,showOptOut:!1,interactivePunchOut:!1,handleDismiss:u,handleNext:m,handleOpen:f,handlePrevious:u,nextBtn:_,prevBtn:S}))},D=(0,r.memo)(N);var k=a(45697),w=a(87131),C=a(78451);const T=(0,E.wV)(),F=l().createElement("i",{"data-testid":"scheduledPostIcon",className:"icon icon-draft-indicator icon-clock-send-outline"}),P=l().createElement("i",{"data-testid":"draftIcon",className:"icon icon-draft-indicator icon-pencil-outline"});function R(){const e=(0,i.useDispatch)(),t=(0,r.useRef)(!1),a=(0,i.useSelector)(u.LW),s=(0,i.useSelector)(T),E=(0,i.useSelector)(f.Sy),g=(0,i.useSelector)((e=>(0,m.cn)(e,E,!0))),h=(0,i.useSelector)(m.Ck),b=s>0||h&&g>0,v=(0,i.useSelector)((e=>(0,m.U)(e,E))),{url:M}=(0,o.useRouteMatch)(),S=(0,o.useRouteMatch)("/:team/drafts"),_=(0,o.useRouteMatch)("/:team/"+C.pj),N=Boolean(S||_),R=(0,r.useCallback)((()=>N),[N]);(0,r.useEffect)((()=>{a&&e((0,p.Vp)(E))}),[E,a,e]),(0,r.useEffect)((()=>{const a=!t.current;h&&e((0,d.cT)(E,a)),t.current=!0}),[e,h,E]);const O=h&&g>0,I=(0,r.useMemo)((()=>l().createElement(c.FormattedMessage,{id:"drafts.tooltipText",defaultMessage:"",values:{draftCount:s,scheduledPostCount:g,br:e=>s>0&&g>0?l().createElement(l().Fragment,null,l().createElement("br",null),e):null}})),[s,g]);return b||N?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(M,"/drafts"),id:"sidebarItem_drafts",activeClassName:"active",draggable:"false",className:"SidebarLink sidebar-item",tabIndex:0,isActive:R},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(c.FormattedMessage,{id:"drafts.sidebarLink",defaultMessage:"Drafts"}))),l().createElement(w.A,{title:I},l().createElement("div",null,s>0&&l().createElement(k.A,{unreadMentions:s,icon:P}),O&&l().createElement(k.A,{unreadMentions:g,icon:F,className:n()("scheduledPostBadge",{persistent:v}),hasUrgent:v})))),l().createElement(D,null))):null}const O=(0,r.memo)(R)}}]);
//# sourceMappingURL=3635.44461199f5fb56316906.js.map