Skip to content

Commit

Permalink
-fix: prevent breaking from type number label
Browse files Browse the repository at this point in the history
-style: move clinical panel to new css file
-chore: specify better types
-fix: recalculate visPanelWidth on demo change
-feat: always load clinical info if available
-style: update padding to account for 3px padding on visualization
-chore: typecast clinicalInfo into boolean for consistency
  • Loading branch information
crfmc committed Jan 16, 2025
1 parent 9008e5e commit 45946ee
Show file tree
Hide file tree
Showing 5 changed files with 544 additions and 505 deletions.
26 changes: 19 additions & 7 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ function App(props: RouteComponentProps) {

const currentSpec = useRef<string>();

const [isClinicalPanelOpen, setIsClinicalPanelOpen] = useState(false);
// Clinical Panel will only render in non-minimal mode and if the demo has clinical info
const [isClinicalPanelOpen, setIsClinicalPanelOpen] = useState(true);
const CLINICAL_PANEL_WIDTH = isMinimalMode || !demo?.clinicalInfo ? 0 : isClinicalPanelOpen ? 250 : 45;

// interactions
Expand Down Expand Up @@ -145,8 +146,8 @@ function App(props: RouteComponentProps) {
}

useEffect(() => {
setVisPanelWidth(INIT_VIS_PANEL_WIDTH - (VIS_PADDING.left + VIS_PADDING.right + CLINICAL_PANEL_WIDTH));
}, [isClinicalPanelOpen]);
setVisPanelWidth(INIT_VIS_PANEL_WIDTH - (VIS_PADDING.left + VIS_PADDING.right + CLINICAL_PANEL_WIDTH + 6));
}, [demo, isClinicalPanelOpen]);

// update demo
useEffect(() => {
Expand Down Expand Up @@ -196,7 +197,7 @@ function App(props: RouteComponentProps) {
rightReads.current = [];

// Update the appearance of the clinical panel
setIsClinicalPanelOpen(!!demo?.clinicalInfo);
setIsClinicalPanelOpen(!!demo?.clinicalInfo && isClinicalPanelOpen);
}, [demo]);

useEffect(() => {
Expand Down Expand Up @@ -564,7 +565,18 @@ function App(props: RouteComponentProps) {
/>
);
// !! Removed `demo` not to update twice since `drivers` are updated right after a demo update.
}, [ready, xDomain, visPanelWidth, drivers, showOverview, showPutativeDriver, selectedSvId, breakpoints, svReads]);
}, [
ready,
xDomain,
visPanelWidth,
drivers,
showOverview,
showPutativeDriver,
selectedSvId,
breakpoints,
svReads,
isClinicalPanelOpen
]);

const trackTooltips = useMemo(() => {
// calculate the offset by the Genome View
Expand Down Expand Up @@ -981,7 +993,7 @@ function App(props: RouteComponentProps) {
{!isMinimalMode && (
<div
style={{
width: `calc(100% - ${0}px)`,
width: '100%',
height: '100%',
boxShadow: `inset 0 0 0 3px ${
interactiveMode && mouseOnVis
Expand Down Expand Up @@ -1481,7 +1493,7 @@ function App(props: RouteComponentProps) {
<GenomeViewModal />
<VariantViewModal />
</div>
{!isMinimalMode && demo?.clinicalInfo && (
{!isMinimalMode && !!demo?.clinicalInfo && (
<ClinicalPanel
demo={demo}
gosRef={gosRef}
Expand Down
Loading

0 comments on commit 45946ee

Please sign in to comment.