import React from "react"; import { AnchorButton, ButtonGroup, Popover, Button, Radio, RadioGroup, Tooltip, Position, } from "@blueprintjs/core"; import { connect } from "react-redux"; import * as globals from "../../globals"; import styles from "./menubar.css"; import { World } from "../../util/stateManager"; import actions from "../../actions"; @connect((state) => ({ universe: state.universe, world: state.world, layoutChoice: state.layoutChoice, reembedController: state.reembedController, enableReembedding: state.config?.parameters?.["enable-reembedding"] ?? false, })) class Embedding extends React.PureComponent { handleLayoutChoiceChange = (e) => { const { dispatch } = this.props; dispatch({ type: "set layout choice", layoutChoice: e.currentTarget.value, }); }; renderReembedding() { const { enableReembedding, world, universe, dispatch, reembedController, } = this.props; if (!enableReembedding) return null; const loading = !!reembedController?.pendingFetch; const disabled = World.worldEqUniverse(world, universe); const tipContent = disabled ? "Subset cells first, then click to recompute UMAP embedding." : "Click to recompute UMAP embedding on the current cell subset."; return ( dispatch(actions.requestReembed())} loading={loading} /> ); } render() { const { layoutChoice } = this.props; return (