import React, {ReactElement} from "react"; import { FaSearchMinus } from "react-icons/fa"; import { Root, updateVisibleTipsAndBranchThicknesses } from "../../actions/tree"; import { getParentBeyondPolytomy, getParentStream } from "./phyloTree/helpers"; import { tabSingle, darkGrey, lightGrey } from "../../globalStyles"; import { TreeComponentProps } from "./types"; type Props = TreeComponentProps & { /* RHS offset in pixels */ offsetPx: number; /* Are the buttons for the main tree or the second (RHS) tree? */ mainTree: boolean; } export function TreeButtons(props: Props): ReactElement { if (props.narrativeMode) { return null; // hide the buttons when viewing a narrative to prevent tree manipulations } const focusMode = props.focus==='selected'; const tree = props.mainTree ? props.tree : props.treeToo; const filtered = !!tree.idxOfFilteredRoot && tree.idxOfInViewRootNode !== tree.idxOfFilteredRoot; const showZoomButton = !focusMode; const activeZoomButton = filtered; // only applicable if `showZoomButton` is true const treeZoomed = tree.idxOfInViewRootNode !== 0; const containerStyles: React.CSSProperties = {zIndex: 100, position: "absolute", right: props.offsetPx, top: 0}; const baseButtonStyles: React.CSSProperties = {...tabSingle, zIndex: 100, display: "inline-block", marginLeft: "4px"}; const selectedButtonStyles: React.CSSProperties = {...baseButtonStyles, cursor: "pointer", color: darkGrey, pointerEvents: "auto"}; const unselectedButtonStyles: React.CSSProperties = {...baseButtonStyles, cursor: "auto", color: lightGrey, pointerEvents: "none"}; return (