"use strict";(self.webpackChunkmattermost_webapp=self.webpackChunkmattermost_webapp||[]).push([[9838],{9838:(e,t,a)=>{a.r(t),a.d(t,{default:()=>p});var s=a(42689),n=a.n(s),o=a(36418),i=a.n(o),d=a(14778),r=a(14696),m=a(22583),l=a(78451),c=a(36397),u=a(19513),h=a(85873);const p=(0,d.injectIntl)(class extends i().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,u.e)(e,l.Ay.KeyCodes.ESCAPE)&&this.props.onExited()};formatDate=e=>(0,c.KH)(e,this.props.intl.formatMessage);getText=()=>({modalHeaderText:i().createElement(d.FormattedMessage,{id:"dnd_custom_time_picker_modal.defaultMsg",defaultMessage:"Disable notifications until"}),confirmButtonText:i().createElement(d.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:l._w.DND,dnd_end_time:(0,c.Id)(e),manual:!0,last_activity_at:(0,c.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 i().createElement(r.zW,{compassDesign:!0,ariaLabel:(0,h.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},i().createElement("div",{className:"DndModal__content"},i().createElement(m.Ay,{time:a,handleChange:this.handleDateTimeChange,timezone:this.props.timezone,relativeDate:!0})))}})}}]);
//# sourceMappingURL=9838.50cf0bea744af0d3b966.js.map