import React from 'react';

import HandlerMap from './HandlerMap';

const MaintenanceHost = window.location.origin;
const MaintenancePath = 'CivManage';
export default class Container extends React.Component {
  constructor(props) {
    super(props);
    this.oms = this.oms.bind(this);
    this.keyHandlerMap = new Map([[['alt+c', 'option+c'], this.oms]]);
  }

  oms(event) {
    const omsUrl = [
      `${window.location.protocol}/`,
      MaintenanceHost,
      MaintenancePath,
    ].join('/');
    window.open(omsUrl, '_blank');
  }

  render() {
    return (
      <HandlerMap keyHandlerMap={this.keyHandlerMap}>
        {this.props.children}
      </HandlerMap>
    );
  }
}
