import { Fragment, useCallback, useRef } from "react"; import { MdOutlineContentPasteGo } from "react-icons/md"; import { LuCable, LuHardDrive, LuMaximize, LuSettings, LuSignal } from "react-icons/lu"; import { FaKeyboard } from "react-icons/fa6"; import { Popover, PopoverButton, PopoverPanel } from "@headlessui/react"; import { CommandLineIcon } from "@heroicons/react/20/solid"; import { cx } from "@/cva.config"; import { useHidStore, useMountMediaStore, useSettingsStore, useUiStore, } from "@hooks/stores"; import { useDeviceUiNavigation } from "@hooks/useAppNavigation"; import { Button } from "@components/Button"; import Container from "@components/Container"; import PasteModal from "@components/popovers/PasteModal"; import WakeOnLanModal from "@components/popovers/WakeOnLan/Index"; import MountPopopover from "@components/popovers/MountPopover"; import ExtensionPopover from "@components/popovers/ExtensionPopover"; import { m } from "@localizations/messages.js"; export default function Actionbar({ requestFullscreen, }: { requestFullscreen: () => Promise; }) { const { navigateTo } = useDeviceUiNavigation(); const { isVirtualKeyboardEnabled, setVirtualKeyboardEnabled } = useHidStore(); const { setDisableVideoFocusTrap, terminalType, setTerminalType, toggleSidebarView } = useUiStore(); const { remoteVirtualMediaState } = useMountMediaStore(); const { developerMode } = useSettingsStore(); // This is the only way to get a reliable state change for the popover // at time of writing this there is no mount, or unmount event for the popover const isOpen = useRef(false); const checkIfStateChanged = useCallback( (open: boolean) => { if (open !== isOpen.current) { isOpen.current = open; if (!open) { setTimeout(() => { setDisableVideoFocusTrap(false); console.debug("Popover is closing. Returning focus trap to video"); }, 0); } } }, [setDisableVideoFocusTrap], ); return (
e.stopPropagation()} onKeyDown={e => e.stopPropagation()} className="flex flex-wrap items-center justify-between gap-x-4 gap-y-2 py-1.5" >
{developerMode && (
); }