"use strict";(self.webpackChunkmattermost_webapp=self.webpackChunkmattermost_webapp||[]).push([[9838],{9838(e,t,a){a.r(t),a.d(t,{default:()=>h});var s=a(42689),n=a.n(s),o=a(36418),i=a(14778),d=a(14696),r=a(22583),m=a(81444),l=a(36397),c=a(19513),u=a(85873);const h=(0,i.injectIntl)(class extends o.PureComponent{constructor(e){super(e);const{currentDate:t}=this.props;let a=n()(t);23===t.getHours()&&t.getMinutes()>20&&(a=a.add(1,"day").startOf("day").add(9,"hours")),this.state={selectedDateTime:a}}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}handleKeyDown=e=>{(0,c.e)(e,m.Ay.KeyCodes.ESCAPE)&&this.props.onExited()};formatDate=e=>(0,l.KH)(e,this.props.intl.formatMessage);getText=()=>({modalHeaderText:o.createElement(i.FormattedMessage,{id:"dnd_custom_time_picker_modal.defaultMsg",defaultMessage:"Disable notifications until"}),confirmButtonText:o.createElement(i.FormattedMessage,{id:"dnd_custom_time_picker_modal.submitButton",defaultMessage:"Disable Notifications"})});handleConfirm=async()=>{const e=this.state.selectedDateTime.toDate();e<new Date||(await this.props.actions.setStatus({user_id:this.props.userId,status:m._w.DND,dnd_end_time:(0,l.Id)(e),manual:!0,last_activity_at:(0,l.Id)(this.props.currentDate)}),this.props.onExited())};handleDateTimeChange=e=>{e&&this.setState({selectedDateTime:e})};render(){const{modalHeaderText:e,confirmButtonText:t}=this.getText(),{selectedDateTime:a}=this.state;return o.createElement(d.zW,{compassDesign:!0,ariaLabel:(0,u.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},o.createElement("div",{className:"DndModal__content"},o.createElement(r.Ay,{time:a,handleChange:this.handleDateTimeChange,timezone:this.props.timezone,relativeDate:!0})))}})}}]);
//# sourceMappingURL=9838.5540b3494b34bf2092c3.js.map