diff --git a/frontend/src/views/WheresMyGeneV2/common/constants.ts b/frontend/src/views/WheresMyGeneV2/common/constants.ts index 7a7d6246da084..32cc7709081d0 100644 --- a/frontend/src/views/WheresMyGeneV2/common/constants.ts +++ b/frontend/src/views/WheresMyGeneV2/common/constants.ts @@ -2,6 +2,12 @@ export const GENE_SEARCH_BAR_HEIGHT_PX = 32; export const HEATMAP_CONTAINER_ID = "heatmap-container-id"; export const FMG_GENE_STRENGTH_THRESHOLD = 0.5; export const FMG_SPECIFICITY_THRESHOLD = 0.0; +export const GENE_LABEL_WIDTH_PX = 20; +export const GENE_SEARCH_LEFT_OFFSET_PX = 24; +export const LOADER_WITH_LABEL_THRESHOLD = 13; +export const LOADER_WITH_LABEL_OFFSET_PX = 80; +export const LOADER_NO_LABEL_OFFSET_PX = 85; +export const LOADER_LABEL_TEXT = "Loading Data..."; /** * (thuang): The `id` options here must match what the BE expects diff --git a/frontend/src/views/WheresMyGeneV2/components/GeneSearchBar/style.ts b/frontend/src/views/WheresMyGeneV2/components/GeneSearchBar/style.ts index 8f9104b17ee13..f52bdc9f3b87c 100644 --- a/frontend/src/views/WheresMyGeneV2/components/GeneSearchBar/style.ts +++ b/frontend/src/views/WheresMyGeneV2/components/GeneSearchBar/style.ts @@ -8,15 +8,16 @@ import { } from "src/components/Layout/style"; import { LEGEND_HEIGHT_PX } from "src/views/WheresMyGeneV2/components/InfoPanel/components/Legend/style"; import { Y_AXIS_CHART_WIDTH_PX } from "src/views/WheresMyGeneV2/components/HeatMap/utils"; -import { GENE_SEARCH_BAR_HEIGHT_PX } from "src/views/WheresMyGeneV2/common/constants"; +import { + GENE_SEARCH_BAR_HEIGHT_PX, + GENE_SEARCH_LEFT_OFFSET_PX, +} from "src/views/WheresMyGeneV2/common/constants"; import { HEADER_HEIGHT_PX } from "src/components/Header/style"; interface ContainerProps { sidebarWidth: number; } -const GENE_SEARCH_LEFT_OFFSET_PX = 24; - export const Container = styled.div` height: ${GENE_SEARCH_BAR_HEIGHT_PX}px; width: fit-content; diff --git a/frontend/src/views/WheresMyGeneV2/components/HeatMap/connect.ts b/frontend/src/views/WheresMyGeneV2/components/HeatMap/connect.ts index 4d931c584829f..5fe1cb6143666 100644 --- a/frontend/src/views/WheresMyGeneV2/components/HeatMap/connect.ts +++ b/frontend/src/views/WheresMyGeneV2/components/HeatMap/connect.ts @@ -332,11 +332,14 @@ export function useConnect({ dispatch, }); + const geneCount = sortedGeneNames.length; + return { allTissueCellTypes, chartWrapperRef, expandedTissueIds, filteredCellTypes, + geneCount, generateMarkerGenes, handleCellTypeDelete, handleExpandCollapse, diff --git a/frontend/src/views/WheresMyGeneV2/components/HeatMap/index.tsx b/frontend/src/views/WheresMyGeneV2/components/HeatMap/index.tsx index 70a0bf48fea6a..8e2cc16c2f303 100644 --- a/frontend/src/views/WheresMyGeneV2/components/HeatMap/index.tsx +++ b/frontend/src/views/WheresMyGeneV2/components/HeatMap/index.tsx @@ -2,24 +2,13 @@ import { memo } from "react"; import { Tissue } from "src/views/WheresMyGeneV2/common/types"; import YAxisChart from "./components/YAxisChart"; - -import { - CellTypeTagContainer, - ChartWrapper, - Container, - ContainerWrapper, - SkeletonContainer, - SkeletonWrapper, - StyledTag, - XAxisMask, - YAxisWrapper, -} from "src/views/WheresMyGeneV2/components/HeatMap/style"; import { CellCountLabel } from "src/views/WheresMyGeneV2/components/HeatMap/components/XAxisChart/style"; import { HEATMAP_CONTAINER_ID, + LOADER_WITH_LABEL_THRESHOLD, + LOADER_LABEL_TEXT, MARGIN_BETWEEN_HEATMAPS, } from "src/views/WheresMyGeneV2/common/constants"; -import Loader from "src/views/WheresMyGeneV2/components/Loader"; import XAxisChart from "src/views/WheresMyGeneV2/components/HeatMap/components/XAxisChart"; import Chart from "src/views/WheresMyGeneV2/components/HeatMap/components/Chart"; import { hyphenize } from "src/views/WheresMyGeneV2/components/HeatMap/utils"; @@ -27,10 +16,20 @@ import { EXCLUDE_IN_SCREENSHOT_CLASS_NAME } from "../GeneSearchBar/components/Sa import { Autocomplete } from "@czi-sds/components"; import { CellTypeFilterContainer, + CellTypeTagContainer, + ChartWrapper, + Container, + ContainerWrapper, Divider, + LoadingContainer, + LoadingLabel, + LoadingSpinner, + LoadingWrapper, + StyledTag, TopLeftCornerMask, + XAxisMask, XAxisWrapper, - StyledSkeleton, + YAxisWrapper, } from "./style"; import { useConnect } from "src/views/WheresMyGeneV2/components/HeatMap/connect"; @@ -55,6 +54,7 @@ export default memo(function HeatMap(props: Props): JSX.Element { chartWrapperRef, expandedTissueIds, filteredCellTypes, + geneCount, generateMarkerGenes, handleCellTypeDelete, handleExpandCollapse, @@ -101,7 +101,6 @@ export default memo(function HeatMap(props: Props): JSX.Element { Cell Count - {isLoadingAPI || (isAnyTissueLoading(isLoading) && )} - {isLoadingAPI || - (isAnyTissueLoading(isLoading) && ( - - ))} + {(isLoadingAPI || isAnyTissueLoading(isLoading)) && ( + 0 + } + > + + + + LOADER_WITH_LABEL_THRESHOLD} + > + {LOADER_LABEL_TEXT} + + + + + )}