Skip to content

Commit 366ba79

Browse files
authored
feat: add organism selector to ga2 landing page (#863)
## Description This will add the organism selector to the landing page of GA2, making this pull-request dependent on #854 . ## Related Issue #840
2 parents d3b861b + 9abd4e0 commit 366ba79

File tree

9 files changed

+130
-6
lines changed

9 files changed

+130
-6
lines changed

app/components/Home/components/Section/components/SectionViz/data.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import data from "catalog/output/ncbi-taxa-tree.json";
1+
import { config } from "../../../../../../../app/config/config";
22

33
/**
44
* Interface representing a node in the NCBI taxonomy tree
@@ -32,6 +32,15 @@ export interface TaxonomyNode {
3232
}
3333

3434
export function getData(): TaxonomyNode {
35-
// Any data massaging can be done at this extension point.
36-
return data;
35+
const { taxTree } = config();
36+
if (!taxTree) {
37+
return {
38+
assembly_count: 0,
39+
children: [],
40+
name: "root",
41+
ncbi_tax_id: "",
42+
};
43+
}
44+
45+
return taxTree;
3746
}

app/components/Home/components/Section/components/SectionViz/sunburst.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ export const SectionViz = ({
472472
tooltip.remove();
473473
d3.select(svgNode).selectAll("*").remove();
474474
};
475-
}, []);
475+
}, [DEPTH, LOGO_PATH, startingNode]);
476476

477477
// Handler for when a node is clicked in the NodeDetails component
478478
const handleNodeClick = (node: TreeNode): void => {
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import styled from "@emotion/styled";
2+
import { sectionLayout } from "../../../../../../Layout/components/AppLayout/components/Section/section.styles";
3+
import { SectionHeadline } from "../../../section.styles";
4+
import { PALETTE } from "@databiosphere/findable-ui/lib/styles/common/constants/palette";
5+
6+
export const Section = styled.section`
7+
background-color: ${PALETTE.SMOKE_LIGHTEST};
8+
border-top: 1px solid ${PALETTE.SMOKE_MAIN};
9+
overflow: hidden;
10+
width: 100%;
11+
`;
12+
13+
export const SectionLayout = styled.div`
14+
${sectionLayout};
15+
display: flex;
16+
flex-direction: column;
17+
gap: 48px 16px;
18+
padding: 64px 16px;
19+
`;
20+
21+
export const Headline = styled(SectionHeadline)`
22+
align-self: center;
23+
grid-column: 1 / -1;
24+
max-width: 560px;
25+
text-align: center;
26+
`;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { SectionSubtitle, SectionTitle } from "../../../section.styles";
2+
import { SectionViz as Sunburst } from "../../SectionViz/sunburst";
3+
import { Headline, Section, SectionLayout } from "./sectionAssemblies.styles";
4+
5+
export const SectionAssemblies = (): JSX.Element => {
6+
return (
7+
<Section>
8+
<SectionLayout>
9+
<Headline>
10+
<SectionTitle>Browse Assemblies</SectionTitle>
11+
<SectionSubtitle>
12+
Browse assemblies by taxonomic lineage.
13+
</SectionSubtitle>
14+
</Headline>
15+
<Sunburst logoPath="/logo/genomeark2.svg" startingNode="Metazoa" />
16+
</SectionLayout>
17+
</Section>
18+
);
19+
};

app/views/HomeView/ga2/homeView.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Fragment } from "react";
22
import { SectionHero } from "../../../components/Home/components/Section/components/ga2/SectionHero/sectionHero";
3+
import { SectionAssemblies } from "../../../components/Home/components/Section/components/ga2/SectionAssemblies/sectionAssemblies";
34
import { SectionSubHero } from "../../../components/Home/components/Section/components/ga2/SectionSubHero/sectionSubHero";
45
import { SectionAnalyticsAndData } from "../../../components/Home/components/Section/components/ga2/SectionAnalyticsAndData/sectionAnalyticsAndData";
56

@@ -8,6 +9,7 @@ export const HomeView = (): JSX.Element => {
89
<Fragment>
910
<SectionHero />
1011
<SectionSubHero />
12+
<SectionAssemblies />
1113
<SectionAnalyticsAndData />
1214
</Fragment>
1315
);

public/logo/genomeark2.svg

Lines changed: 56 additions & 0 deletions
Loading

site-config/brc-analytics/local/config.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import { socialMenuItems, socialMedia } from "./socialMedia";
1515
import { FILTER_SORT } from "@databiosphere/findable-ui/lib/common/filters/sort/config/types";
1616
import { AppSiteConfig } from "../../common/entities";
1717
import { APP_KEYS } from "../../common/constants";
18+
import data from "catalog/output/ncbi-taxa-tree.json";
19+
import { TaxonomyNode } from "../../../app/components/Home/components/Section/components/SectionViz/data";
1820

1921
const LOCALHOST = "http://localhost:3000";
2022
const APP_TITLE = "BRC Analytics";
@@ -25,6 +27,7 @@ const GIT_HUB_REPO_URL = "https://github.com/galaxyproject/brc-analytics";
2527
* Make site config object.
2628
* @param browserUrl - Browser URL.
2729
* @param gitHubUrl - GitHub URL.
30+
* @param taxTreeData - Taxonomy tree data.
2831
* @remarks
2932
* The `genomeEntityConfig` is typecast to `EntityConfig<BRCDataCatalogGenome>`
3033
* because the `SiteConfig` interface from the `@databiosphere/findable-ui` package expects
@@ -38,7 +41,8 @@ const GIT_HUB_REPO_URL = "https://github.com/galaxyproject/brc-analytics";
3841
*/
3942
export function makeConfig(
4043
browserUrl: string,
41-
gitHubUrl = GIT_HUB_REPO_URL
44+
gitHubUrl = GIT_HUB_REPO_URL,
45+
taxTreeData = data as TaxonomyNode
4246
): AppSiteConfig {
4347
return {
4448
appKey: APP_KEYS.BRC_ANALYTICS,
@@ -108,6 +112,7 @@ export function makeConfig(
108112
},
109113
},
110114
redirectRootToPath: "/",
115+
taxTree: taxTreeData,
111116
themeOptions: {},
112117
};
113118
}

site-config/common/entities.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
} from "@databiosphere/findable-ui/lib/config/entities";
77
import { SiteConfig as BaseSiteConfig } from "@databiosphere/findable-ui/lib/config/entities";
88
import { APP_KEYS } from "./constants";
9+
import { TaxonomyNode } from "../../app/components/Home/components/Section/components/SectionViz/data";
910

1011
export interface AppBackPageConfig
1112
extends Omit<BaseBackPageConfig, "tabs" | "top"> {
@@ -25,4 +26,5 @@ export interface AppEntityConfig<R>
2526
export interface AppSiteConfig extends BaseSiteConfig {
2627
allowedPaths?: string[];
2728
appKey?: (typeof APP_KEYS)[keyof typeof APP_KEYS];
29+
taxTree?: TaxonomyNode;
2830
}

site-config/ga2/local/config.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import {
1010
} from "../../../app/apis/catalog/ga2/entities";
1111
import { AppSiteConfig } from "../../common/entities";
1212
import { APP_KEYS } from "../../common/constants";
13+
import data from "catalog/ga2/output/ncbi-taxa-tree.json";
14+
import { TaxonomyNode } from "../../../app/components/Home/components/Section/components/SectionViz/data";
1315

1416
const ALLOWED_PATHS = [
1517
ROUTES.ABOUT,
@@ -26,6 +28,7 @@ const GIT_HUB_REPO_URL = "https://github.com/galaxyproject/ga2";
2628
* Make site config object.
2729
* @param browserUrl - Browser URL.
2830
* @param gitHubUrl - GitHub URL.
31+
* @param taxTreeData - Taxonomy tree data.
2932
* @remarks
3033
* The `genomeEntityConfig` is typecast to `EntityConfig<GA2AssemblyEntity>`
3134
* because the `SiteConfig` interface from the `@databiosphere/findable-ui` package expects
@@ -39,7 +42,8 @@ const GIT_HUB_REPO_URL = "https://github.com/galaxyproject/ga2";
3942
*/
4043
export function makeConfig(
4144
browserUrl: string,
42-
gitHubUrl = GIT_HUB_REPO_URL
45+
gitHubUrl = GIT_HUB_REPO_URL,
46+
taxTreeData = data as TaxonomyNode
4347
): AppSiteConfig {
4448
return {
4549
allowedPaths: ALLOWED_PATHS,
@@ -78,6 +82,7 @@ export function makeConfig(
7882
},
7983
},
8084
redirectRootToPath: "/",
85+
taxTree: taxTreeData,
8186
themeOptions: {},
8287
};
8388
}

0 commit comments

Comments
 (0)