import { Menu, Select } from "antd"; import { ClickParam } from "antd/lib/menu"; import { observer } from "mobx-react"; import React, { ReactNode, Component } from "react"; import { Server } from "../../core/domain"; import styles from "./ApplicationComponent.css"; import { DpsCalcComponent } from "../../dps_calc/ui/DpsCalcComponent"; import { with_error_boundary } from "../../core/ui/ErrorBoundary"; import { HuntOptimizerComponent } from "../../hunt_optimizer/ui/HuntOptimizerComponent"; import { QuestEditorComponent } from "../../quest_editor/ui/QuestEditorComponent"; import { ViewerComponent } from "../../viewer/ui/ViewerComponent"; import { application_store } from "../stores/ApplicationStore"; const Viewer = with_error_boundary(ViewerComponent); const QuestEditor = with_error_boundary(QuestEditorComponent); const HuntOptimizer = with_error_boundary(HuntOptimizerComponent); const DpsCalc = with_error_boundary(DpsCalcComponent); @observer export class ApplicationComponent extends Component { componentDidMount(): void { window.addEventListener("keyup", this.keyup); } componentWillUnmount(): void { window.removeEventListener("keyup", this.keyup); } render(): ReactNode { let tool_component; switch (application_store.current_tool) { case "viewer": tool_component = ; break; case "quest_editor": tool_component = ; break; case "hunt_optimizer": tool_component = ; break; case "dps_calc": tool_component = ; break; } return (
Viewer(Beta) Quest Editor(Beta) Hunt Optimizer {/* DPS Calculator */}
Server:
{tool_component}
); } private menu_clicked = (e: ClickParam) => { application_store.current_tool = e.key; }; private keyup = (e: KeyboardEvent) => { application_store.dispatch_global_keyup(e); }; }