"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),h=a(67173),E=(a(17046),a(14696)),g=a(57898),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)(h._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)({[g.pm.DRAFTS_TOUR_TIP_SHOWED]:!0})),d(!1)}),[]),m=(0,r.useCallback)((()=>{e((0,p.tv)({[g.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)({[g.pm.DRAFTS_TOUR_TIP_SHOWED]:!0})),d(!1)):d(!0)}),[]),b=(0,E.LX)(["sidebar-drafts-button"],[]);return l().createElement(l().Fragment,null,a&&l().createElement(E.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 w=a(45697),k=a(65420),T=a(78451);const C=(0,h.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)(C),h=(0,i.useSelector)(f.Sy),E=(0,i.useSelector)((e=>(0,m.cn)(e,h,!0))),g=(0,i.useSelector)(m.Ck),b=s>0||g&&E>0,v=(0,i.useSelector)((e=>(0,m.U)(e,h))),{url:M}=(0,o.useRouteMatch)(),S=(0,o.useRouteMatch)("/:team/drafts"),_=(0,o.useRouteMatch)("/:team/"+T.pj),N=S||_;(0,r.useEffect)((()=>{a&&e((0,p.Vp)(h))}),[h,a,e]),(0,r.useEffect)((()=>{const a=!t.current;g&&e((0,d.cT)(h,a)),t.current=!0}),[e,g,h]);const R=g&&E>0,O=(0,r.useMemo)((()=>l().createElement(c.FormattedMessage,{id:"drafts.tooltipText",defaultMessage:"",values:{draftCount:s,scheduledPostCount:E,br:e=>s>0&&E>0?l().createElement(l().Fragment,null,l().createElement("br",null),e):null}})),[s,E]);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},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(k.A,{placement:"right",id:"draft-scheduled-post-tooltip",title:O},l().createElement("div",null,s>0&&l().createElement(w.A,{unreadMentions:s,icon:P}),R&&l().createElement(w.A,{unreadMentions:E,icon:F,className:n()("scheduledPostBadge",{persistent:v}),hasUrgent:v})))),l().createElement(D,null))):null}const O=(0,r.memo)(R)}}]);
//# sourceMappingURL=3635.bc979275c5479b093e95.js.map