Skip to content

Commit

Permalink
feat: add version info to footer (#3362) (#3393)
Browse files Browse the repository at this point in the history
* feat: add version info to footer (#3362)

* chore: findable-ui as a dependency (#3362)

---------

Co-authored-by: Fran McDade <[email protected]>
  • Loading branch information
frano-m and Fran McDade authored Nov 20, 2024
1 parent 1efd825 commit dda0e3d
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 75 deletions.
8 changes: 4 additions & 4 deletions components/Search/hooks/useSearch.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { CardProps } from "@databiosphere/findable-ui/lib/components/common/Card/card";
import { useConfig } from "@databiosphere/findable-ui/lib/hooks/useConfig";
import { useSearchParams } from "next/navigation";
import { useRouter } from "next/router";
import { useCallback, useEffect, useState } from "react";
import { useConfig } from "../../../hooks/useConfig";
import { SiteConfig } from "../../../site-config/common/entities";
import {
OnSearchFn,
SearchPagination,
Expand Down Expand Up @@ -33,9 +34,8 @@ export interface UseSearch {
* @returns search results.
*/
export const useSearch = (): UseSearch => {
const {
config: { portalURL },
} = useConfig();
const { config } = useConfig();
const { portalURL } = config as SiteConfig;
const { asPath } = useRouter();
const [requestURL, setRequestURL] = useState<string>();
const { isIdle, isLoading, isSuccess, response } =
Expand Down
8 changes: 4 additions & 4 deletions components/common/Link/link.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { TypographyWordBreak } from "@databiosphere/findable-ui/lib/components/common/Typography/TypographyWordBreak/TypographyWordBreak";
import { Link as DXLink } from "@databiosphere/findable-ui/lib/components/Links/components/Link/link";
import { useConfig } from "@databiosphere/findable-ui/lib/hooks/useConfig";
import { replaceParameters } from "@databiosphere/findable-ui/lib/utils/replaceParameters";
import { EMAIL_ADDRESSES, PATH_PARAMETERS } from "../../../common/constants";
import { useConfig } from "../../../hooks/useConfig";
import { SiteConfig } from "../../../site-config/common/entities";

/**
* Basic anchor link component, used by MDX for all anchor links.
Expand All @@ -13,9 +14,8 @@ export const Link = ({
...props /* Spread props to allow for anchor link specific props e.g. "href". */
}): JSX.Element => {
const { children, href, ...linkProps } = props;
const {
config: { browserURL, portalURL },
} = useConfig();
const { config } = useConfig();
const { browserURL, portalURL } = config as SiteConfig;
return (
<DXLink
label={<TypographyWordBreak>{children}</TypographyWordBreak>}
Expand Down
10 changes: 0 additions & 10 deletions hooks/useConfig.tsx

This file was deleted.

55 changes: 34 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"add-cser-materials": "esrun scripts/add-cser-materials.ts"
},
"dependencies": {
"@databiosphere/findable-ui": "15.0.0",
"@databiosphere/findable-ui": "15.0.2",
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@mdx-js/loader": "^3.0.1",
Expand Down
2 changes: 1 addition & 1 deletion pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import "@databiosphere/findable-ui";
import { Header as DXHeader } from "@databiosphere/findable-ui/lib/components/Layout/components/Header/header";
import { ConfigProvider } from "@databiosphere/findable-ui/lib/providers/config";
import { LayoutStateProvider } from "@databiosphere/findable-ui/lib/providers/layoutState";
import { createAppTheme } from "@databiosphere/findable-ui/lib/theme/theme";
import { ThemeProvider as EmotionThemeProvider } from "@emotion/react";
Expand All @@ -13,7 +14,6 @@ import TagManager from "react-gtm-module";
import { AppLayout, Footer as DXFooter, Main as DXMain } from "../components";
import { Head } from "../components/common/Head/head";
import { config } from "../config/config";
import { ConfigProvider } from "../providers/config";
import { BREAKPOINTS } from "../site-config/common/constants";
import { mergeAppTheme } from "../theme/theme";

Expand Down
28 changes: 0 additions & 28 deletions providers/config.tsx

This file was deleted.

15 changes: 13 additions & 2 deletions site-config/anvil-portal/dev/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@ import { socialMedia, SOCIALS } from "./socialMedia";

const APP_TITLE = "AnVIL Portal";
const EXPLORER_URL = "https://explore.anvilproject.dev.clevercanary.com";
export const GIT_HUB_REPO_URL = "https://github.com/anvilproject/anvil-portal";
const PORTAL_URL = "https://anvilproject.dev.clevercanary.com";
const SLOGAN = "NHGRI Analysis Visualization and Informatics Lab-space";

export function makeConfig(browserUrl: string, portalUrl: string): SiteConfig {
export function makeConfig(
browserUrl: string,
portalUrl: string,
gitHubUrl: string
): SiteConfig {
return {
analytics: {
gtmAuth: "dn4W-jqWUyNBj6ON0Ic_wA", // GTM environment-specific
Expand All @@ -32,6 +37,7 @@ export function makeConfig(browserUrl: string, portalUrl: string): SiteConfig {
},
entities: [],
explorerTitle: null,
gitHubUrl,
layout: {
footer: {
Branding: C.ANVILBranding(),
Expand All @@ -46,6 +52,7 @@ export function makeConfig(browserUrl: string, portalUrl: string): SiteConfig {
},
],
socials: socialMedia.socials,
versionInfo: true,
},
header: {
announcements,
Expand Down Expand Up @@ -194,6 +201,10 @@ export function makeConfig(browserUrl: string, portalUrl: string): SiteConfig {
};
}

const config: SiteConfig = makeConfig(EXPLORER_URL, PORTAL_URL);
const config: SiteConfig = makeConfig(
EXPLORER_URL,
PORTAL_URL,
GIT_HUB_REPO_URL
);

export default config;
4 changes: 2 additions & 2 deletions site-config/anvil-portal/prod/config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { SiteConfig } from "../../common/entities";
import { makeConfig } from "../dev/config";
import { GIT_HUB_REPO_URL, makeConfig } from "../dev/config";

const EXPLORER_URL = "https://explore.anvilproject.org";
const PORTAL_URL = "https://anvilproject.org";

const config: SiteConfig = {
...makeConfig(EXPLORER_URL, PORTAL_URL),
...makeConfig(EXPLORER_URL, PORTAL_URL, GIT_HUB_REPO_URL),
analytics: {
gtmAuth: "IgbX8s-NCGg81Z0eWB6KAQ", // GTM environment-specific
gtmId: "GTM-KMGCR8F",
Expand Down
5 changes: 3 additions & 2 deletions views/HomeView/homeView.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useConfig } from "@databiosphere/findable-ui/lib/hooks/useConfig";
import { SectionAnalysisPortals } from "../../components/Home/components/Section/components/SectionAnalysisPortals/sectionAnalysisPortals";
import { SectionCloudEnvironment } from "../../components/Home/components/Section/components/SectionCloudEnvironment/sectionCloudEnvironment";
import { SectionDatasets } from "../../components/Home/components/Section/components/SectionDatasets/sectionDatasets";
Expand All @@ -6,11 +7,11 @@ import { SectionPublications } from "../../components/Home/components/Section/co
import { SectionUpdates } from "../../components/Home/components/Section/components/SectionUpdates/sectionUpdates";
import { SectionWorkspaces } from "../../components/Home/components/Section/components/SectionWorkspaces/sectionWorkspaces";
import { SectionDivider } from "../../components/Home/components/Section/section.styles";
import { useConfig } from "../../hooks/useConfig";
import { SiteConfig } from "../../site-config/common/entities";

export const HomeView = (): JSX.Element => {
const { config } = useConfig();
const portalURL = config.portalURL;
const portalURL = (config as SiteConfig).portalURL;
return (
<>
<SectionHero />
Expand Down

0 comments on commit dda0e3d

Please sign in to comment.