import React, { useEffect, useState } from "react"; import { getApp } from "../../olympusapp"; import { IconDefinition } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; export function ControlsPanel(props: {}) { const [controls, setControls] = useState( [] as { actions: string[]; target: IconDefinition, text: string }[] ); useEffect(() => { if (getApp() && controls.length === 0) { setControls(getApp().getMap().getCurrentControls()); } }) document.addEventListener("mapStateChanged", (ev) => { setControls(getApp().getMap().getCurrentControls()); }); return (
{controls.map((control) => { return (
{control.text}
{control.actions.map((action, idx) => { return ( <> {
+
}
{action}
); })}
); })}
); }