import React, { Dispatch, SetStateAction } from "react" import { Items, Target } from "../interfaces/frontend" import Item from "./Item" function EventBar({ props: { setMode, setTarget }, }: { props: { setMode: Dispatch> setTarget: Dispatch> } }) { const items: Items[] = [ { icon: "burger-menu", text: "Menu" }, { icon: "radar", text: "Radar scan", mode: 0, amount: 1 }, { icon: "torpedo", text: "Fire torpedo", mode: 1, amount: 1 }, { icon: "scope", text: "Fire missile", mode: 2 }, { icon: "gear", text: "Settings" }, ] return (
{items.map((e, i) => ( { if (e.mode !== undefined) setMode(e.mode) setTarget((e) => ({ ...e, show: false })) }, }} /> ))}
) } export default EventBar