Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 3 additions & 64 deletions site-config/hprc-data-explorer/local/config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { FILTER_SORT } from "@databiosphere/findable-ui/lib/common/filters/sort/config/types";
import { ANCHOR_TARGET } from "@databiosphere/findable-ui/lib/components/Links/common/entities";
import { SiteConfig } from "@databiosphere/findable-ui/lib/config/entities";
import type { SiteConfig } from "@databiosphere/findable-ui/lib/config/entities";
import * as C from "../../../app/components/index";
import { ROUTE } from "../../../app/routes/constants";
import { DOCUMENTATION_URL } from "../docs";
import { alignmentEntityConfig } from "./index/alignmentEntityConfig";
import { annotationEntityConfig } from "./index/annotationEntityConfig";
import { assemblyEntityConfig } from "./index/assemblyEntityConfig";
import { rawSequencingDataEntityConfig } from "./index/rawSequencingDataEntityConfig";
import { sampleEntityConfig } from "./index/sampleEntityConfig";
import { HEADER_NAVIGATION } from "./navigation";

// Template constants
const LOCALHOST = "http://localhost:3000";
Expand All @@ -17,7 +16,6 @@ const BROWSER_URL = LOCALHOST;
const GIT_HUB_REPO_URL =
"https://github.com/human-pangenomics/hprc-data-explorer";
const HOME_PAGE_PATH = ROUTE.RAW_SEQUENCING_DATA;
const PORTAL_URL = "https://humanpangenome.org";

export function makeConfig(browserUrl: string, gitHubUrl: string): SiteConfig {
return {
Expand Down Expand Up @@ -58,66 +56,7 @@ export function makeConfig(browserUrl: string, gitHubUrl: string): SiteConfig {
link: HOME_PAGE_PATH,
src: "/images/hprcDataExplorer.png",
}),
navigation: [
undefined,
[
{
label: "Samples",
url: ROUTE.SAMPLES,
},
{
label: "Sequencing Data",
url: ROUTE.RAW_SEQUENCING_DATA,
},
{ label: "Assemblies", url: ROUTE.ASSEMBLIES },
{ label: "Annotations", url: ROUTE.ANNOTATIONS },
{ label: "Alignments", url: ROUTE.ALIGNMENTS },
],
[
{
label: C.LabelIconMenuItem({ label: "HPRC Website" }),
target: ANCHOR_TARGET.BLANK,
url: PORTAL_URL,
},
{
label: "Help & Documentation",
menuItems: [
{
label: "Data Use Agreement",
target: ANCHOR_TARGET.BLANK,
url: "https://humanpangenome.org/data-use/",
},
{
label: "Samples",
target: ANCHOR_TARGET.BLANK,
url: DOCUMENTATION_URL.SAMPLES,
},
{
label: "Assemblies",
target: ANCHOR_TARGET.BLANK,
url: DOCUMENTATION_URL.ASSEMBLIES,
},
{
label: "Sequencing Data",
target: ANCHOR_TARGET.BLANK,
url: DOCUMENTATION_URL.SEQUENCING_DATA,
},
{
label: "Annotations",
target: ANCHOR_TARGET.BLANK,
url: DOCUMENTATION_URL.ANNOTATIONS,
},
{
icon: C.GitHubIcon({ fontSize: "small" }),
label: "GitHub",
target: ANCHOR_TARGET.BLANK,
url: "https://github.com/human-pangenomics/hprc-data-explorer",
},
],
url: "",
},
],
],
navigation: HEADER_NAVIGATION,
},
},
redirectRootToPath: HOME_PAGE_PATH,
Expand Down
98 changes: 98 additions & 0 deletions site-config/hprc-data-explorer/local/navigation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import type { Navigation } from "@databiosphere/findable-ui/lib/components/Layout/components/Header/common/entities";
import type { NavLinkItem } from "@databiosphere/findable-ui/lib/components/Layout/components/Header/components/Content/components/Navigation/navigation";
import { ANCHOR_TARGET } from "@databiosphere/findable-ui/lib/components/Links/common/entities";
import * as C from "../../../app/components/index";
import { ROUTE } from "../../../app/routes/constants";
import { DOCUMENTATION_URL } from "../docs";

const PORTAL_URL = "https://humanpangenome.org";

/**
* Breakpoints at which a header menu is replaced by its own items.
* The full navigation does not fit in the bar at `sm`, so some links are kept
* in menus there and shown as separate links at every other breakpoint.
*/
const FLATTEN = {
EXCEPT_SM: { lg: true, md: true, xs: true },
} as const satisfies Record<string, NavLinkItem["flatten"]>;

/**
* Breakpoints at which a header navigation link is visible.
* Used for a link that moves into a different menu at `sm`, where the full
* navigation does not fit in the bar.
*/
const VISIBLE = {
HIDDEN_AT_SM: { sm: false },
SM_ONLY: { lg: false, md: false, sm: true, xs: false },
} as const satisfies Record<string, NavLinkItem["visible"]>;

const HPRC_WEBSITE: NavLinkItem = {
label: C.LabelIconMenuItem({ label: "HPRC Website" }),
target: ANCHOR_TARGET.BLANK,
url: PORTAL_URL,
};

/**
* Header navigation: left (none), center (data pages) and right (HPRC website
* and help) links.
* At `sm`, Assemblies, Annotations and Alignments are in the "More" menu and
* the HPRC website link is in the "Help & Documentation" menu.
*/
export const HEADER_NAVIGATION: Navigation = [
undefined,
[
{ label: "Samples", url: ROUTE.SAMPLES },
{ label: "Sequencing Data", url: ROUTE.RAW_SEQUENCING_DATA },
{
flatten: FLATTEN.EXCEPT_SM,
label: "More",
menuItems: [
{ label: "Assemblies", url: ROUTE.ASSEMBLIES },
{ label: "Annotations", url: ROUTE.ANNOTATIONS },
{ label: "Alignments", url: ROUTE.ALIGNMENTS },
],
url: "",
},
],
[
{ ...HPRC_WEBSITE, visible: VISIBLE.HIDDEN_AT_SM },
{
label: "Help & Documentation",
menuItems: [
{ ...HPRC_WEBSITE, label: "HPRC Website", visible: VISIBLE.SM_ONLY },
{
label: "Data Use Agreement",
target: ANCHOR_TARGET.BLANK,
url: "https://humanpangenome.org/data-use/",
},
{
label: "Samples",
target: ANCHOR_TARGET.BLANK,
url: DOCUMENTATION_URL.SAMPLES,
},
{
label: "Assemblies",
target: ANCHOR_TARGET.BLANK,
url: DOCUMENTATION_URL.ASSEMBLIES,
},
{
label: "Sequencing Data",
target: ANCHOR_TARGET.BLANK,
url: DOCUMENTATION_URL.SEQUENCING_DATA,
},
{
label: "Annotations",
target: ANCHOR_TARGET.BLANK,
url: DOCUMENTATION_URL.ANNOTATIONS,
},
{
icon: C.GitHubIcon({ fontSize: "small" }),
label: "GitHub",
target: ANCHOR_TARGET.BLANK,
url: "https://github.com/human-pangenomics/hprc-data-explorer",
},
],
url: "",
},
],
];
Loading