/** @jsx jsx */ import { jsx, css } from '@emotion/react' import React, { useState, useContext } from "react"; import { ButtonsSettingContext } from "./../contexts/buttons_setting"; import { LayerKey } from "../types/layer_key"; import { Button } from "../types/button"; import { Macro, StructMacro } from "../types/buttons_setting_type"; import { Plugin, PluginBody, AvailablePlugins, MacroNameMap } from "../types/plugin"; import { ButtonsModal } from "./buttons_modal"; import { applyMacroType } from "../reducers/layer_reducer"; type MacroSettingProps = { layerKey: LayerKey; macro: StructMacro; }; const MacroSetting = ({ macro, layerKey }: MacroSettingProps) => { const { layersDispatch } = useContext(ButtonsSettingContext); // for modal const [openModal, setOpenModal] = useState(false) const [modalCallbackOnSubmit, setModalCallbackOnSubmit] = useState(undefined as any) const [modalCloseCallback, setModalCloseCallback] = useState(undefined as any) const [modalTitle, setModalTitle] = useState("") const [modalPrefillButtons, setModalPrefillButtons] = useState>([]) const setButtonsForModal = (bs: Array