import React from "react"; import { useSelector } from "react-redux"; import { FaInfoCircle } from "react-icons/fa"; import Toggle from "./toggle"; import { SidebarIconContainer, StyledTooltip } from "./styles"; import { SET_FOCUS } from "../../actions/types"; import { getFocusedNodes } from "../../actions/tree"; import { RootState } from "../../store"; import { useAppDispatch } from "../../hooks"; import { useTranslation } from "react-i18next"; import { ThunkFunction } from "../../store"; export function ToggleFocus(): JSX.Element { const focus = useSelector((state: RootState) => state.controls.focus); const layout = useSelector((state: RootState) => state.controls.layout); const streamTreesToggledOn = useSelector((state: RootState) => state.controls.showStreamTrees); const dispatch = useAppDispatch(); const mobileDisplay = useSelector((state: RootState) => state.general.mobileDisplay); const { t } = useTranslation(); // Focus functionality is only available to layouts that have the concept of a unitless y-axis const validLayouts = new Set(["rect", "radial"]); const disabled = !validLayouts.has(layout) || streamTreesToggledOn; const text = disabled ? t("sidebar:Focus on selected unavailable") : t("sidebar:Focus on selected"); const label = (