Unverified Commit 70b6a440 authored by Andrey Azov's avatar Andrey Azov Committed by GitHub
Browse files

Enable Entity Viewer in production (#449)

parent 20f5c8fa
......@@ -66,7 +66,7 @@ const BrowserAppBar = (props: BrowserAppBarProps) => {
<AppBar
appName={AppName.GENOME_BROWSER}
mainContent={wrappedSpecies}
aside={<HelpPopupButton slug="using-the-genome-browser" />}
aside={<HelpPopupButton slug="genome-browser" />}
/>
);
};
......
......@@ -18,7 +18,6 @@ import React from 'react';
import { connect } from 'react-redux';
import { push } from 'connected-react-router';
import { isEnvironment, Environment } from 'src/shared/helpers/environment';
import * as urlFor from 'src/shared/helpers/urlHelper';
import { parseFeatureId } from 'src/content/app/browser/browserHelper';
import { buildFocusIdForUrl } from 'src/shared/state/ens-object/ensObjectHelpers';
......@@ -45,9 +44,6 @@ type Props = {
};
const ZmenuAppLinks = (props: Props) => {
if (!isEnvironment([Environment.DEVELOPMENT, Environment.INTERNAL])) {
return null;
}
const parsedFeatureId = parseFeatureId(props.featureId);
if (parsedFeatureId.type !== 'gene') {
......
......@@ -17,12 +17,10 @@
import React, { useEffect, ReactNode } from 'react';
import { connect } from 'react-redux';
import classNames from 'classnames';
import { Link } from 'react-router-dom';
import ViewInAppPopup from 'src/shared/components/view-in-app-popup/ViewInAppPopup';
import SpeciesStats from 'src/content/app/species/components/species-stats/SpeciesStats';
import ExpandableSection from 'src/shared/components/expandable-section/ExpandableSection';
import { isEnvironment, Environment } from 'src/shared/helpers/environment';
import {
getActiveGenomeId,
......@@ -66,18 +64,6 @@ type ExampleLinkPopupProps = {
};
const ExampleLinkWithPopup = (props: ExampleLinkPopupProps) => {
const isProduction = isEnvironment([Environment.PRODUCTION]);
if (isProduction) {
const linkToGenomeBrowser = props.links?.genomeBrowser;
return linkToGenomeBrowser ? (
<div className={styles.exampleLink}>
<Link to={linkToGenomeBrowser}>{props.children}</Link>
</div>
) : null;
}
return (
<div className={styles.exampleLink}>
<ViewInAppPopup links={props.links}>
......
......@@ -14,13 +14,11 @@
* limitations under the License.
*/
import React, { useState, useEffect, useRef } from 'react';
import { Link } from 'react-router-dom';
import React, { useState, useRef } from 'react';
import { connect, useDispatch } from 'react-redux';
import { push } from 'connected-react-router';
import classNames from 'classnames';
import { isEnvironment, Environment } from 'src/shared/helpers/environment';
import * as urlFor from 'src/shared/helpers/urlHelper';
import useOutsideClick from 'src/shared/hooks/useOutsideClick';
......@@ -66,24 +64,20 @@ const HomepageAppLinks = (props: Props) => {
}
};
if (isEnvironment([Environment.DEVELOPMENT, Environment.INTERNAL])) {
const links = props.species.map((species, index) => (
<HomepageAppLinksRow
key={species.genome_id}
species={species}
isExpanded={expandedRowIndex === index}
toggleExpand={() => onToggleRow(index)}
/>
));
return (
<section className={styles.homepageAppLinks}>
<h2>Previously viewed</h2>
{links}
</section>
);
} else {
return <PreviouslyViewedLinks {...props} />;
}
const links = props.species.map((species, index) => (
<HomepageAppLinksRow
key={species.genome_id}
species={species}
isExpanded={expandedRowIndex === index}
toggleExpand={() => onToggleRow(index)}
/>
));
return (
<section className={styles.homepageAppLinks}>
<h2>Previously viewed</h2>
{links}
</section>
);
};
const HomepageAppLinksRow = (props: HomepageAppLinksRowProps) => {
......@@ -140,39 +134,6 @@ const HomepageAppLinksRow = (props: HomepageAppLinksRowProps) => {
);
};
// Legacy component that stays there until we have a presentable EntityViewer
const PreviouslyViewedLinks = (props: Props) => {
useEffect(() => {
props.fetchDataForLastVisitedObjects();
}, []);
if (
!props.species.length ||
props.previouslyViewedGenomeBrowserObjects.areLoading
) {
return null;
}
const previouslyViewedLinks = props.previouslyViewedGenomeBrowserObjects.objects.map(
(object, index) => (
<div key={index} className={styles.previouslyViewedItem}>
<Link to={object.link}>{object.speciesName}</Link>
<span className={styles.previouslyViewedItemAssemblyName}>
{' '}
{object.assemblyName}
</span>
</div>
)
);
return (
<section className={styles.previouslyViewed}>
<h2>Previously viewed</h2>
{previouslyViewedLinks}
</section>
);
};
const mapStateToProps = (state: RootState) => ({
species: getEnabledCommittedSpecies(state),
previouslyViewedGenomeBrowserObjects: getPreviouslyViewedGenomeBrowserObjects(
......
......@@ -71,12 +71,7 @@ const Launchbar = (props: LaunchbarProps) => {
app="entity-viewer"
description="Entity Viewer"
icon={EntityViewerIcon}
enabled={
isEnvironment([
Environment.DEVELOPMENT,
Environment.INTERNAL
]) && props.committedSpecies.length > 0
}
enabled={props.committedSpecies.length > 0}
/>
</div>
<div className={styles.category}>
......
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