Commit 4d0db9e8 authored by Andrey Azov's avatar Andrey Azov
Browse files

Address comments to the PR

parent f0de0212
Pipeline #295107 passed with stages
in 5 minutes and 28 seconds
......@@ -23,7 +23,6 @@ import { useAppSelector, useAppDispatch } from 'src/store';
import useEntityViewerIds from 'src/content/app/entity-viewer/hooks/useEntityViewerIds';
import { getBreakpointWidth } from 'src/global/globalSelectors';
import { getEntityViewerActiveGenomeId } from 'src/content/app/entity-viewer/state/general/entityViewerGeneralSelectors';
import {
isEntityViewerSidebarOpen,
getEntityViewerSidebarModalView
......@@ -48,7 +47,7 @@ import GeneViewSidebarTabs from './gene-view/components/gene-view-sidebar-tabs/G
import styles from './EntityViewer.scss';
const EntityViewer = () => {
const activeGenomeId = useAppSelector(getEntityViewerActiveGenomeId);
const { activeGenomeId } = useEntityViewerIds();
const dispatch = useAppDispatch();
useEntityViewerRouting();
......@@ -93,12 +92,7 @@ const EntityViewerForGene = () => {
return (
<StandardAppLayout
mainContent={<GeneView />}
topbarContent={
<EntityViewerTopbar
genomeId={activeGenomeId}
entityId={activeEntityId}
/>
}
topbarContent={<EntityViewerTopbar />}
sidebarContent={SideBarContent}
sidebarNavigation={<GeneViewSidebarTabs />}
sidebarToolstripContent={<EntityViewerSidebarToolstrip />}
......
......@@ -15,17 +15,13 @@
*/
import React from 'react';
import { useSelector } from 'react-redux';
import useEntityViewerIds from 'src/content/app/entity-viewer/hooks/useEntityViewerIds';
import { getEntityViewerActiveGenomeId } from 'src/content/app/entity-viewer/state/general/entityViewerGeneralSelectors';
import InAppSearch from 'src/shared/components/in-app-search/InAppSearch';
const EntityViewerSidebarSearch = () => {
const activeGenomeId = useSelector(getEntityViewerActiveGenomeId);
const { genomeIdForUrl } = useEntityViewerIds();
const { activeGenomeId, genomeIdForUrl } = useEntityViewerIds();
return (
<section>
......
......@@ -16,6 +16,7 @@
import React from 'react';
import useGeneViewIds from 'src/content/app/entity-viewer/gene-view/hooks/useGeneViewIds';
import { useGeneSummaryQuery } from 'src/content/app/entity-viewer/state/api/entityViewerThoasSlice';
import { GeneSummaryStrip } from 'src/shared/components/feature-summary-strip';
......@@ -24,15 +25,20 @@ import type { GeneSummary } from 'src/content/app/entity-viewer/state/api/querie
import styles from './EntityViewerTopbar.scss';
export type EntityViewerTopbarProps = {
genomeId: string;
entityId: string;
};
export const EntityViewerTopbar = () => {
const { genomeId, geneId = '' } = useGeneViewIds();
export const EntityViewerTopbar = (props: EntityViewerTopbarProps) => {
const { genomeId } = props;
const entityId = props.entityId.split(':').pop() as string;
const { currentData } = useGeneSummaryQuery({ geneId: entityId, genomeId });
// NOTE: when we introduce entities other than gene,
// either the component's name will have to change, or the data fetcher below
const { currentData } = useGeneSummaryQuery(
{
genomeId: genomeId as string,
geneId
},
{
skip: !geneId
}
);
return (
<div className={styles.container}>
......
......@@ -15,7 +15,6 @@
*/
import React, { useState } from 'react';
import { useSelector } from 'react-redux';
import classNames from 'classnames';
import { getFormattedLocation } from 'src/shared/helpers/formatters/regionFormatter';
......@@ -37,8 +36,6 @@ import {
import { useGbTranscriptSummaryQuery } from 'src/content/app/genome-browser/state/api/genomeBrowserApiSlice';
import useGenomeBrowserIds from 'src/content/app/genome-browser/hooks/useGenomeBrowserIds';
import { getBrowserActiveGenomeId } from 'src/content/app/genome-browser/state/browser-general/browserGeneralSelectors';
import TranscriptSequenceView from 'src/content/app/genome-browser/components/drawer/components/sequence-view/TranscriptSequenceView';
import { InstantDownloadTranscript } from 'src/shared/components/instant-download';
import ViewInApp from 'src/shared/components/view-in-app/ViewInApp';
......@@ -57,9 +54,8 @@ type Props = {
const TranscriptSummary = (props: Props) => {
const { transcriptId } = props.drawerView;
const activeGenomeId = useSelector(getBrowserActiveGenomeId);
const { activeGenomeId, genomeIdForUrl } = useGenomeBrowserIds();
const [shouldShowDownload, showDownload] = useState(false);
const { genomeIdForUrl } = useGenomeBrowserIds();
const { currentData, isFetching } = useGbTranscriptSummaryQuery(
{
......
......@@ -22,7 +22,6 @@ import useGenomeBrowserIds from 'src/content/app/genome-browser/hooks/useGenomeB
import { fetchExampleFocusObjects } from 'src/content/app/genome-browser/state/focus-object/focusObjectSlice';
import { getBrowserActiveGenomeId } from 'src/content/app/genome-browser/state/browser-general/browserGeneralSelectors';
import { getExampleGenes } from 'src/content/app/genome-browser/state/focus-object/focusObjectSelectors';
import {
......@@ -37,8 +36,7 @@ import InAppSearch from 'src/shared/components/in-app-search/InAppSearch';
import styles from './BrowserInterstitial.scss';
const BrowserInterstitial = () => {
const activeGenomeId = useAppSelector(getBrowserActiveGenomeId);
const { genomeIdForUrl } = useGenomeBrowserIds();
const { activeGenomeId, genomeIdForUrl } = useGenomeBrowserIds();
const dispatch = useAppDispatch();
......
......@@ -15,16 +15,12 @@
*/
import React from 'react';
import { useSelector } from 'react-redux';
import * as urlFor from 'src/shared/helpers/urlHelper';
import { parseFeatureId } from 'src/content/app/genome-browser/helpers/browserHelper';
import { buildFocusIdForUrl } from 'src/shared/helpers/focusObjectHelpers';
import { parseFocusIdFromUrl } from 'src/shared/helpers/focusObjectHelpers';
import useGenomeBrowserIds from 'src/content/app/genome-browser/hooks/useGenomeBrowserIds';
import { getBrowserActiveGenomeId } from 'src/content/app/genome-browser/state/browser-general/browserGeneralSelectors';
import { ToggleButton as ToolboxToggleButton } from 'src/shared/components/toolbox';
import ViewInApp, { UrlObj } from 'src/shared/components/view-in-app/ViewInApp';
......@@ -36,29 +32,27 @@ type Props = {
};
const ZmenuAppLinks = (props: Props) => {
const genomeId = useSelector(getBrowserActiveGenomeId);
const { featureId } = props; // feature id here is passed in the format suitable for urls
const { genomeIdForUrl } = useGenomeBrowserIds();
const parsedFeatureId = parseFeatureId(`${genomeId}:${props.featureId}`);
const { type: featureType } = parseFocusIdFromUrl(featureId);
if (parsedFeatureId.type !== 'gene') {
if (featureType !== 'gene') {
return null;
}
const featureIdForUrl = buildFocusIdForUrl(parsedFeatureId);
const links: UrlObj = {
genomeBrowser: {
url: urlFor.browser({
genomeId: genomeIdForUrl,
focus: featureIdForUrl
focus: featureId
}),
replaceState: true
},
entityViewer: {
url: urlFor.entityViewer({
genomeId: genomeIdForUrl,
entityId: featureIdForUrl
entityId: featureId
})
}
};
......
......@@ -115,7 +115,6 @@ export const setDataFromUrlAndSave: ActionCreator<
dispatch(browserGeneralSlice.actions.setDataFromUrl(payload));
dispatch(setInitialTrackPanelDataForGenome(payload));
// dispatch(ensureSpeciesIsEnabled(activeGenomeId));
});
browserStorageService.saveActiveGenomeId(activeGenomeId);
......
......@@ -131,19 +131,6 @@ export const fetchPopularSpecies = createAsyncThunk(
// speciesSelectorStorageService.saveSelectedSpecies(newCommittedSpecies);
// };
export const ensureSpeciesIsEnabled =
(genomeId: string): ThunkAction<void, any, void, Action<string>> =>
(dispatch, getState: () => RootState) => {
const state = getState();
const currentSpecies = getCommittedSpeciesById(state, genomeId);
if (!currentSpecies || currentSpecies.isEnabled) {
return;
}
dispatch(toggleSpeciesUseAndSave(genomeId));
};
export const loadStoredSpecies =
(): ThunkAction<void, any, void, Action<string>> => (dispatch) => {
const storedSpecies = speciesSelectorStorageService.getSelectedSpecies();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment