Fix: API modal not opening with shortcut

This commit is contained in:
igorrCarvalho 2024-06-09 15:36:57 -03:00
commit 81a29da787
2 changed files with 10 additions and 1 deletions

View file

@ -15,6 +15,8 @@ import { Separator } from "../ui/separator";
export default function FlowToolbar(): JSX.Element {
function handleAPIWShortcut(e: KeyboardEvent) {
e.preventDefault();
console.log("oi");
console.log(openCodeModal);
setOpenCodeModal((oldOpen) => !oldOpen);
}

View file

@ -31,9 +31,13 @@ const ApiModal = forwardRef(
{
flow,
children,
open: myOpen,
setOpen: mySetOpen,
}: {
flow: FlowType;
children: ReactNode;
open: boolean;
setOpen: (a: boolean | ((o?: boolean) => boolean)) => void;
},
ref,
) => {
@ -44,7 +48,10 @@ const ApiModal = forwardRef(
const [activeTweaks, setActiveTweaks] = useState(false);
const { autoLogin } = useContext(AuthContext);
const [open, setOpen] = useState(false);
const [open, setOpen] =
mySetOpen !== undefined && myOpen !== undefined
? [myOpen, mySetOpen]
: useState(false);
const [activeTab, setActiveTab] = useState("0");
const pythonApiCode = getPythonApiCode(
flow?.id,