Skip to content

Commit

Permalink
feat: remove "Preview" chip from analysis methods (#245) (#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
hunterckx authored Jan 31, 2025
1 parent cf9d95d commit d79390a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import { css } from "@emotion/react";
import styled from "@emotion/styled";

interface Props {
isPreview: boolean;
isAvailable: boolean;
}

export const StyledSection = styled(GridPaperSection, {
shouldForwardProp: (props) => props !== "isPreview",
shouldForwardProp: (props) => props !== "isAvailable",
})<Props>`
flex-direction: row;
gap: 16px;
Expand All @@ -38,13 +38,13 @@ export const StyledSection = styled(GridPaperSection, {
}
${(props) =>
props.isPreview &&
props.isAvailable &&
css`
cursor: pointer;
`}
${(props) =>
!props.isPreview &&
!props.isAvailable &&
css`
background-color: ${smokeLightest(props)};
pointer-events: none;
Expand Down
20 changes: 11 additions & 9 deletions app/components/Entity/components/AnalysisMethod/analysisMethod.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { SouthIcon } from "@databiosphere/findable-ui/lib/components/common/CustomIcon/components/SouthIcon/southIcon";
import { STATUS_BADGE_COLOR } from "@databiosphere/findable-ui/lib/components/common/StatusBadge/statusBadge";
import {
ANCHOR_TARGET,
REL_ATTRIBUTE,
Expand All @@ -7,14 +8,13 @@ import {
Loading,
LOADING_PANEL_STYLE,
} from "@databiosphere/findable-ui/lib/components/Loading/loading";
import { useAsync } from "@databiosphere/findable-ui/src/hooks/useAsync";
import { useAsync } from "@databiosphere/findable-ui/lib/hooks/useAsync";
import { Chip } from "@mui/material";
import { WORKFLOW_IDS_BY_ANALYSIS_METHOD } from "app/apis/catalog/brc-analytics-catalog/common/constants";
import { getWorkflowLandingUrl } from "app/utils/galaxy-api";
import { SectionContent, StyledSection } from "./analysisMethod.styles";
import { CHIP_PROPS, ICON_PROPS } from "./constants";
import { Props } from "./types";
import { getChipColor, getChipLabel } from "./utils";

export const AnalysisMethod = ({
analysisMethod,
Expand All @@ -23,11 +23,11 @@ export const AnalysisMethod = ({
genomeVersionAssemblyId,
}: Props): JSX.Element => {
const workflowId = WORKFLOW_IDS_BY_ANALYSIS_METHOD[analysisMethod];
const isPreview = Boolean(workflowId);
const isAvailable = Boolean(workflowId);
const { data: landingUrl, isLoading, run } = useAsync<string>();
return (
<StyledSection
isPreview={isPreview}
isAvailable={isAvailable}
onClick={async (): Promise<void> => {
if (!workflowId) return;
const url =
Expand All @@ -49,11 +49,13 @@ export const AnalysisMethod = ({
>
<Loading loading={isLoading} panelStyle={LOADING_PANEL_STYLE.INHERIT} />
<SectionContent>{content}</SectionContent>
<Chip
{...CHIP_PROPS}
color={getChipColor(isPreview)}
label={getChipLabel(isPreview)}
/>
{!isAvailable && (
<Chip
{...CHIP_PROPS}
color={STATUS_BADGE_COLOR.DEFAULT}
label="Coming Soon"
/>
)}
<SouthIcon {...ICON_PROPS} />
</StyledSection>
);
Expand Down
19 changes: 0 additions & 19 deletions app/components/Entity/components/AnalysisMethod/utils.ts

This file was deleted.

0 comments on commit d79390a

Please sign in to comment.