Skip to content

Commit e37d939

Browse files
Compound dep tile style (#373)
1 parent dea3e32 commit e37d939

File tree

3 files changed

+56
-34
lines changed

3 files changed

+56
-34
lines changed

frontend/packages/portal-frontend/src/compound/components/tiles/TopDatasetDependencies.tsx

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { DependencyMeter } from "./DependencyMeter";
44
import { toStaticUrl } from "@depmap/globals";
55
import styles from "../../styles/CorrelationTile.scss";
66
import { AssociatedFeatures } from "@depmap/types/src/Dataset";
7+
import { Tooltip } from "@depmap/common-components";
78

89
interface TopDatasetDependencyProps {
910
featureId: string;
@@ -25,13 +26,15 @@ export const TopDatasetDependencies: React.FC<TopDatasetDependencyProps> = ({
2526
const urlPrefix = window.location.origin;
2627
return (
2728
<div>
28-
<h3 style={{ fontSize: "16px" }}>{dataType}</h3>
29-
<table style={{ width: "100%" }}>
29+
<h3 className={styles.tileDatasetTitle}>{dataType}</h3>
30+
<table style={{ width: "100%", tableLayout: "fixed" }}>
3031
<thead>
3132
<tr>
32-
<th />
33-
<th>{featureType === "gene" ? "Gene" : "Compound"}</th>
34-
<th>Correlation</th>
33+
<th style={{ width: "15%" }} />
34+
<th style={{ width: "45%" }}>
35+
{featureType === "gene" ? "Gene" : "Compound"}
36+
</th>
37+
<th style={{ width: "40%" }}>Correlation</th>
3538
</tr>
3639
</thead>
3740
<tbody>
@@ -47,6 +50,7 @@ export const TopDatasetDependencies: React.FC<TopDatasetDependencyProps> = ({
4750
Plot
4851
</a>
4952
</td>
53+
5054
<td className={styles.targetIconContainer}>
5155
{geneTargets.includes(datasetCor.other_dimension_label) ? (
5256
<img
@@ -57,14 +61,22 @@ export const TopDatasetDependencies: React.FC<TopDatasetDependencyProps> = ({
5761
) : (
5862
<p style={{ paddingLeft: "12px" }} />
5963
)}
60-
<a
61-
href={`${urlPrefix}/${featureType}/${datasetCor.other_dimension_label}`}
62-
target="_blank"
63-
rel="noopener noreferrer"
64+
<Tooltip
65+
id="correlated-gene-tooltip"
66+
content={datasetCor.other_dimension_label}
67+
placement="top"
6468
>
65-
{datasetCor.other_dimension_label}
66-
</a>
69+
<a
70+
className={styles.ellipsisStyle}
71+
href={`${urlPrefix}/${featureType}/${datasetCor.other_dimension_label}`}
72+
target="_blank"
73+
rel="noopener noreferrer"
74+
>
75+
{datasetCor.other_dimension_label}
76+
</a>
77+
</Tooltip>
6778
</td>
79+
6880
<td>
6981
<td style={{ paddingRight: "3rem" }}>
7082
{datasetCor.correlation.toFixed(2)}

frontend/packages/portal-frontend/src/compound/components/tiles/TopRelatedCompounds.tsx

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from "react";
22
import styles from "../../styles/CorrelationTile.scss";
33
import { CorrelationBar } from "./CorrelationBar";
4+
import { Tooltip } from "@depmap/common-components";
45

56
interface TopRelatedCompoundsProps {
67
entityLabel: string;
@@ -45,36 +46,45 @@ export const TopRelatedCompounds = ({
4546
<tr>
4647
{dataTypes.flatMap((dataType) =>
4748
topGeneTargets.map((target) => (
48-
<th
49+
<Tooltip
4950
key={`${dataType}-${target}`}
50-
className={`${styles.ellipsisStyle} ${styles.columnStyle}`}
51-
title={target} // Tooltip for full name
51+
id="top-gene-targets-tooltip"
52+
content={target}
53+
placement="top"
5254
>
53-
{target}
54-
</th>
55+
<th
56+
className={`${styles.ellipsisStyle} ${styles.columnStyle}`}
57+
>
58+
{target}
59+
</th>
60+
</Tooltip>
5561
))
5662
)}
5763
</tr>
5864
</thead>
5965
<tbody>
6066
{topCompoundCorrelates.map((compound) => (
6167
<tr key={compound}>
62-
<td
63-
className={`${styles.ellipsisStyle} ${styles.cellStyle}`}
64-
title={compound} // hover for full name
68+
<Tooltip
69+
id="compound-name-tooltip"
70+
content={compound}
71+
placement="top"
6572
>
66-
{compound === entityLabel ? (
67-
<b>{compound}</b>
68-
) : (
69-
<a
70-
href={`${urlPrefix}/compound/${compound}`}
71-
target="_blank"
72-
rel="noopener noreferrer"
73-
>
74-
{compound}
75-
</a>
76-
)}
77-
</td>
73+
<td className={`${styles.ellipsisStyle} ${styles.cellStyle}`}>
74+
{compound === entityLabel ? (
75+
<b>{compound}</b>
76+
) : (
77+
<a
78+
href={`${urlPrefix}/compound/${compound}`}
79+
target="_blank"
80+
rel="noopener noreferrer"
81+
>
82+
{compound}
83+
</a>
84+
)}
85+
</td>
86+
</Tooltip>
87+
7888
{dataTypes.flatMap((dataType) =>
7989
topGeneTargets.map((target) => (
8090
<td

frontend/packages/portal-frontend/src/compound/hooks/useCorrelatedDependenciesData.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { breadboxAPI } from "@depmap/api";
1+
import { breadboxAPI, cached } from "@depmap/api";
22
import { DatasetAssociations } from "@depmap/types/src/Dataset";
33
import { useEffect, useState } from "react";
44

55
function useCorrelatedDependenciesData(
66
datasetId: string,
77
compoundLabel: string
88
) {
9-
const bapi = breadboxAPI;
9+
const bapi = cached(breadboxAPI);
1010

1111
const [error, setError] = useState(false);
1212
const [isLoading, setIsLoading] = useState(true);
@@ -15,7 +15,7 @@ function useCorrelatedDependenciesData(
1515
setCorrelationData,
1616
] = useState<DatasetAssociations | null>(null);
1717
const [geneTargets, setGeneTargets] = useState<string[]>([]);
18-
// TBD: I think we actually want to use "CRISPRGeneDependency" instead of Chronos_Combined
18+
1919
const dataTypeToDatasetMap: Record<string, string> = {
2020
CRISPR: "Chronos_Combined",
2121
RNAi: "RNAi_merged",

0 commit comments

Comments
 (0)