"use strict";(self.webpackChunkmattermost_webapp=self.webpackChunkmattermost_webapp||[]).push([[9838],{9838:(e,t,i)=>{i.r(t),i.d(t,{default:()=>y});var n,s=i(62688),a=i.n(s),o=(i(43813),i(4290),i(42689)),r=i.n(o),d=i(36418),l=i.n(d),m=i(14778),u=i(14696),c=i(22583),h=i(78451),p=i(36397),f=i(19513),D=i(85873);function g(e,t,i){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}const y=(0,m.injectIntl)((n=class extends l().PureComponent{constructor(e){super(e),g(this,"handleKeyDown",(e=>{(0,f.e)(e,h.Ay.KeyCodes.ESCAPE)&&this.props.onExited()})),g(this,"formatDate",(e=>(0,p.KH)(e,this.props.intl.formatMessage))),g(this,"getText",(()=>({modalHeaderText:l().createElement(m.FormattedMessage,{id:"dnd_custom_time_picker_modal.defaultMsg",defaultMessage:"Disable notifications until"}),confirmButtonText:l().createElement(m.FormattedMessage,{id:"dnd_custom_time_picker_modal.submitButton",defaultMessage:"Disable Notifications"})}))),g(this,"handleConfirm",(async()=>{const e=this.state.selectedDateTime.toDate();e<new Date||(await this.props.actions.setStatus({user_id:this.props.userId,status:h._w.DND,dnd_end_time:(0,p.Id)(e),manual:!0,last_activity_at:(0,p.Id)(this.props.currentDate)}),this.props.onExited())})),g(this,"handleDateTimeChange",(e=>{this.setState({selectedDateTime:e})}));const{currentDate:t}=this.props;let i=r()(t);23===t.getHours()&&t.getMinutes()>20&&(i=i.add(1,"day").startOf("day").add(9,"hours")),this.state={selectedDateTime:i}}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}render(){const{modalHeaderText:e,confirmButtonText:t}=this.getText(),{selectedDateTime:i}=this.state;return l().createElement(u.zW,{compassDesign:!0,ariaLabel:(0,D.Vw)({id:"dnd_custom_time_picker_modal.defaultMsg",defaultMessage:"Disable notifications until"}),onExited:this.props.onExited,modalHeaderText:e,confirmButtonText:t,handleConfirm:this.handleConfirm,handleEnterKeyPress:this.handleConfirm,id:"dndCustomTimePickerModal",className:"DndModal modal-overflow",tabIndex:-1,keyboardEscape:!0,enforceFocus:!1},l().createElement("div",{className:"DndModal__content"},l().createElement(c.Ay,{time:i,handleChange:this.handleDateTimeChange,timezone:this.props.timezone,relativeDate:!0})))}},g(n,"propTypes",{onExited:a().func.isRequired,userId:a().string.isRequired,currentDate:a().instanceOf(Date).isRequired,locale:a().string.isRequired,timezone:a().string,actions:a().shape({setStatus:a().func.isRequired}).isRequired}),n))}}]);
//# sourceMappingURL=9838.fbfcc2b840d963bbc734.js.map