Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: info panel tabs #1030

Merged
merged 6 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .infra/rdev/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ stack:
services:
explorer:
image:
tag: sha-69b280f3
tag: sha-30de7b0e
replicaCount: 1
env:
# env vars common to all deployment stages
Expand Down
3 changes: 2 additions & 1 deletion client/src/components/diffexNotice/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import React, { useState, useEffect } from "react";
import Snackbar from "@mui/material/Snackbar";
import MuiAlert from "@mui/material/Alert";
import { noop } from "lodash";
import { Link } from "../geneExpression/infoPanel/geneInfo/style";

interface Props {
Expand Down Expand Up @@ -40,7 +41,7 @@ function DiffexNotice(props: Props): JSX.Element {
onClose={handleClose}
anchorOrigin={{ vertical: "bottom", horizontal: "right" }}
sx={{ width: "423px" }}
ClickAwayListenerProps={{ onClickAway: undefined }}
ClickAwayListenerProps={{ onClickAway: noop }}
>
<MuiAlert
onClose={handleClose}
Expand Down
55 changes: 27 additions & 28 deletions client/src/components/geneExpression/infoPanel/index.tsx
Original file line number Diff line number Diff line change
@@ -1,51 +1,50 @@
import React from "react";
import React, { useState, ChangeEvent, useEffect } from "react";
import { connect } from "react-redux";
import { AnchorButton, ButtonGroup } from "@blueprintjs/core";
import { Tabs, Tab } from "czifui";

import {
CollapseToggle,
InfoPanelContent,
InfoPanelHeader,
InfoPanelTabs,
InfoPanelWrapper,
StyledAnchorButton,
} from "./style";
import GeneInfo from "./geneInfo";
import DatasetInfo from "./datasetInfo";
import { Props, mapStateToProps } from "./types";

function InfoPanel(props: Props) {
const { activeTab, dispatch, infoPanelMinimized, infoPanelHidden } = props;
const [value, setValue] = useState(1);

const handleTabsChange = (
_: ChangeEvent<Record<string, unknown>>,
tabsValue: unknown
) => {
setValue(tabsValue as number);
dispatch({
type: "toggle active info panel",
activeTab: tabsValue === 0 ? "Gene" : "Dataset",
});
};

useEffect(() => {
setValue(activeTab === "Gene" ? 0 : 1);
}, [activeTab]);

return (
<InfoPanelWrapper
isHidden={infoPanelHidden}
isMinimized={infoPanelMinimized}
>
<InfoPanelHeader data-testid="info-panel-header">
<InfoPanelTabs>
<StyledAnchorButton
className={activeTab === "Gene" ? "active" : ""}
minimal
text="Gene"
onClick={() =>
dispatch({
type: "toggle active info panel",
activeTab: "Gene",
})
}
/>
<StyledAnchorButton
className={activeTab === "Dataset" ? "active" : ""}
minimal
text="Dataset"
onClick={() =>
dispatch({
type: "toggle active info panel",
activeTab: "Dataset",
})
}
/>
</InfoPanelTabs>
<InfoPanelHeader
data-testid="info-panel-header"
style={{ paddingBottom: "5px" }}
>
<Tabs value={value} sdsSize="small" onChange={handleTabsChange}>
<Tab label="Gene" />
<Tab label="Dataset" />
</Tabs>
<CollapseToggle>
<ButtonGroup
style={{
Expand Down
27 changes: 3 additions & 24 deletions client/src/components/geneExpression/infoPanel/style.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import styled from "@emotion/styled";
import { fontBodyXs } from "czifui";
import { AnchorButton } from "@blueprintjs/core";
import { gray300 } from "../../theme";

interface InfoPanelWrapperProps {
Expand Down Expand Up @@ -35,37 +33,18 @@ export const InfoPanelHeader = styled.div`
width: 100%;
border-top: 1px solid ${gray300};
border-bottom: 1px solid ${gray300};
padding: 10px 0px 5px 10px;
height: 38px;
padding: 16px 0px 8px 10px;
height: 35px;
position: absolute;
background: white;
z-index: 1;
`;

export const StyledAnchorButton = styled(AnchorButton)`
${fontBodyXs}
color: #ccc;

&.active {
font-weight: 600;
color: black;
border-bottom: 3px solid #0073ff;
border-radius: 0px;
}
`;

export const InfoPanelTabs = styled.div`
display: flex;
flex-direction: row;
width: 200px;
justify-content: space-between;
`;

export const CollapseToggle = styled.div`
display: flex;
flex-direction: row;
justify-content: flex-end;
width: 50px;
padding: 0px 0px 0px 20px;
padding: 0px 0px 7px 20px;
cursor: pointer;
`;
Loading