import React from "react" import { Block } from "baseui/block" import Common from "./Common" import Flip from "./Shared/Flip" import useAppContext from "~/hooks/useAppContext" import { useActiveObject, useEditor } from "@layerhub-io/react" export default function () { const [state, setState] = React.useState({ fill: "#000000" }) const { setActiveSubMenu } = useAppContext() const editor = useEditor() const activeObject = useActiveObject() as any React.useEffect(() => { if (activeObject && activeObject.type === "StaticPath") { setState({ fill: activeObject.fill }) } }, [activeObject]) React.useEffect(() => { let watcher = async () => { if (activeObject && activeObject.type === "StaticPath") { setState({ fill: activeObject.fill }) } } if (editor) { editor.on("history:changed", watcher) } return () => { if (editor) { editor.off("history:changed", watcher) } } }, [editor, activeObject]) return ( setActiveSubMenu("PathFill")}> ) }