@databiosphere/findable-ui 15.0.0 → 15.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +14 -0
- package/lib/components/Layout/components/Footer/components/VersionInfo/constants.d.ts +2 -0
- package/lib/components/Layout/components/Footer/components/VersionInfo/constants.js +5 -0
- package/lib/components/Layout/components/Footer/components/VersionInfo/versionInfo.js +6 -4
- package/lib/components/Layout/components/Footer/components/VersionInfo/versionInfo.styles.js +1 -0
- package/lib/components/Layout/components/Footer/footer.js +3 -1
- package/lib/components/utils.d.ts +7 -0
- package/lib/components/utils.js +8 -0
- package/lib/config/utils.js +2 -0
- package/lib/providers/config.d.ts +1 -1
- package/lib/providers/config.js +1 -1
- package/package.json +1 -1
- package/src/components/Layout/components/Footer/components/VersionInfo/constants.ts +7 -0
- package/src/components/Layout/components/Footer/components/VersionInfo/versionInfo.styles.ts +1 -0
- package/src/components/Layout/components/Footer/components/VersionInfo/versionInfo.tsx +6 -5
- package/src/components/Layout/components/Footer/footer.tsx +3 -1
- package/src/components/utils.ts +10 -0
- package/src/config/utils.ts +1 -0
- package/src/providers/config.tsx +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [15.0.2](https://github.com/DataBiosphere/findable-ui/compare/v15.0.1...v15.0.2) (2024-11-20)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* centre alignment of version info and update Config Provider entity list as optional ([#275](https://github.com/DataBiosphere/findable-ui/issues/275)) ([#276](https://github.com/DataBiosphere/findable-ui/issues/276)) ([4234063](https://github.com/DataBiosphere/findable-ui/commit/4234063fe1180afde7e5195bb54faa453c190ae0))
|
|
9
|
+
|
|
10
|
+
## [15.0.1](https://github.com/DataBiosphere/findable-ui/compare/v15.0.0...v15.0.1) (2024-11-20)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* access NEXT_PUBLIC environment variables directly from the environment ([#272](https://github.com/DataBiosphere/findable-ui/issues/272)) ([#273](https://github.com/DataBiosphere/findable-ui/issues/273)) ([0926331](https://github.com/DataBiosphere/findable-ui/commit/0926331f4dbe4c069e03789b97fa8888ebfc898a))
|
|
16
|
+
|
|
3
17
|
## [15.0.0](https://github.com/DataBiosphere/findable-ui/compare/v14.0.0...v15.0.0) (2024-11-19)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Tooltip } from "@mui/material";
|
|
2
2
|
import React from "react";
|
|
3
|
+
import { useCatalog } from "../../../../../../hooks/useCatalog";
|
|
3
4
|
import { Title } from "./components/Tooltip/components/Title/title";
|
|
4
|
-
import { CHIP_PROPS, TOOLTIP_PROPS } from "./constants";
|
|
5
|
+
import { CHIP_PROPS, TOOLTIP_PROPS, VERSION_INFO } from "./constants";
|
|
5
6
|
import { getLabel } from "./utils";
|
|
6
7
|
import { StyledChip } from "./versionInfo.styles";
|
|
7
|
-
export const VersionInfo = ({ chipProps, className, tooltipProps, versionInfo, }) => {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
export const VersionInfo = ({ chipProps, className, tooltipProps, versionInfo = VERSION_INFO, }) => {
|
|
9
|
+
const catalog = useCatalog();
|
|
10
|
+
return (React.createElement(Tooltip, { ...TOOLTIP_PROPS, title: React.createElement(Title, { versionInfo: { catalog, ...versionInfo } }), ...tooltipProps },
|
|
11
|
+
React.createElement(StyledChip, { ...CHIP_PROPS, className: className, label: getLabel({ catalog, ...versionInfo }), ...chipProps })));
|
|
10
12
|
};
|
package/lib/components/Layout/components/Footer/components/VersionInfo/versionInfo.styles.js
CHANGED
|
@@ -2,6 +2,7 @@ import styled from "@emotion/styled";
|
|
|
2
2
|
import { Chip } from "@mui/material";
|
|
3
3
|
import { inkLight } from "../../../../../../styles/common/mixins/colors";
|
|
4
4
|
export const StyledChip = styled(Chip) `
|
|
5
|
+
align-self: center;
|
|
5
6
|
border-radius: 4px;
|
|
6
7
|
.MuiChip-label {
|
|
7
8
|
color: ${inkLight};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Toolbar } from "@mui/material";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { ANCHOR_TARGET } from "../../../Links/common/entities";
|
|
4
|
+
import { isNodeBoolean } from "../../../utils";
|
|
5
|
+
import { VersionInfo } from "./components/VersionInfo/versionInfo";
|
|
4
6
|
import { AppBar, Link, Links, Socials } from "./footer.styles";
|
|
5
7
|
export const Footer = ({ Branding, className, navLinks, socials, versionInfo, }) => {
|
|
6
8
|
return (React.createElement(AppBar, { className: className, color: "inherit", component: "footer", variant: "footer" },
|
|
@@ -10,5 +12,5 @@ export const Footer = ({ Branding, className, navLinks, socials, versionInfo, })
|
|
|
10
12
|
navLinks &&
|
|
11
13
|
navLinks.map(({ label, target = ANCHOR_TARGET.SELF, url }, i) => (React.createElement(Link, { key: `${url}${i}`, label: label, target: target, url: url }))),
|
|
12
14
|
socials && React.createElement(Socials, { buttonSize: "small", socials: socials }),
|
|
13
|
-
versionInfo)))));
|
|
15
|
+
isNodeBoolean(versionInfo) ? React.createElement(VersionInfo, null) : versionInfo)))));
|
|
14
16
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Type guard for ReactNode; returns true if the value is a boolean.
|
|
4
|
+
* @param value - Value to check.
|
|
5
|
+
* @returns true if the value is a boolean.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isNodeBoolean(value: ReactNode): value is boolean;
|
package/lib/config/utils.js
CHANGED
|
@@ -67,6 +67,8 @@ export function getDefaultSorting(entityConfig) {
|
|
|
67
67
|
export function getEntityConfig(entities, entityListType
|
|
68
68
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This config model is part of a generic array
|
|
69
69
|
) {
|
|
70
|
+
if (!entityListType)
|
|
71
|
+
return getDefaultEntityConfig();
|
|
70
72
|
const entityConfig = entities.find(({ route }) => route === entityListType);
|
|
71
73
|
if (!entityConfig) {
|
|
72
74
|
throw Error("No entity config found with name: " + entityListType);
|
|
@@ -9,7 +9,7 @@ export type ConfigContextProps = {
|
|
|
9
9
|
export interface ConfigProps {
|
|
10
10
|
children: ReactNode | ReactNode[];
|
|
11
11
|
config: SiteConfig;
|
|
12
|
-
entityListType
|
|
12
|
+
entityListType?: string;
|
|
13
13
|
}
|
|
14
14
|
export declare const ConfigContext: React.Context<ConfigContextProps>;
|
|
15
15
|
export declare function ConfigProvider({ children, config, entityListType, }: ConfigProps): JSX.Element;
|
package/lib/providers/config.js
CHANGED
|
@@ -6,7 +6,7 @@ export const ConfigContext = createContext({
|
|
|
6
6
|
entityConfig: getDefaultEntityConfig(),
|
|
7
7
|
entityListType: "",
|
|
8
8
|
});
|
|
9
|
-
export function ConfigProvider({ children, config, entityListType, }) {
|
|
9
|
+
export function ConfigProvider({ children, config, entityListType = "", }) {
|
|
10
10
|
const { entities } = config;
|
|
11
11
|
const defaultEntityListType = config.redirectRootToPath.slice(1);
|
|
12
12
|
const entityName = entityListType || defaultEntityListType;
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ChipProps, TooltipProps } from "@mui/material";
|
|
2
2
|
import { CHIP_PROPS as MUI_CHIP_PROPS } from "../../../../../../styles/common/mui/chip";
|
|
3
|
+
import { VersionInfo } from "./types";
|
|
3
4
|
|
|
4
5
|
export const CHIP_PROPS: Partial<ChipProps> = {
|
|
5
6
|
color: MUI_CHIP_PROPS.COLOR.DEFAULT,
|
|
@@ -28,3 +29,9 @@ export const TOOLTIP_PROPS: Partial<TooltipProps> = {
|
|
|
28
29
|
},
|
|
29
30
|
},
|
|
30
31
|
};
|
|
32
|
+
|
|
33
|
+
export const VERSION_INFO: VersionInfo = {
|
|
34
|
+
buildDate: process.env.NEXT_PUBLIC_BUILD_DATE,
|
|
35
|
+
gitHash: process.env.NEXT_PUBLIC_GIT_HASH,
|
|
36
|
+
version: process.env.NEXT_PUBLIC_VERSION,
|
|
37
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Tooltip } from "@mui/material";
|
|
2
2
|
import React from "react";
|
|
3
|
+
import { useCatalog } from "../../../../../../hooks/useCatalog";
|
|
3
4
|
import { BaseComponentProps } from "../../../../../types";
|
|
4
5
|
import { Title } from "./components/Tooltip/components/Title/title";
|
|
5
|
-
import { CHIP_PROPS, TOOLTIP_PROPS } from "./constants";
|
|
6
|
+
import { CHIP_PROPS, TOOLTIP_PROPS, VERSION_INFO } from "./constants";
|
|
6
7
|
import { VersionInfoProps } from "./types";
|
|
7
|
-
|
|
8
8
|
import { getLabel } from "./utils";
|
|
9
9
|
import { StyledChip } from "./versionInfo.styles";
|
|
10
10
|
|
|
@@ -12,18 +12,19 @@ export const VersionInfo = ({
|
|
|
12
12
|
chipProps,
|
|
13
13
|
className,
|
|
14
14
|
tooltipProps,
|
|
15
|
-
versionInfo,
|
|
15
|
+
versionInfo = VERSION_INFO,
|
|
16
16
|
}: BaseComponentProps & VersionInfoProps): JSX.Element | null => {
|
|
17
|
+
const catalog = useCatalog();
|
|
17
18
|
return (
|
|
18
19
|
<Tooltip
|
|
19
20
|
{...TOOLTIP_PROPS}
|
|
20
|
-
title={<Title versionInfo={versionInfo} />}
|
|
21
|
+
title={<Title versionInfo={{ catalog, ...versionInfo }} />}
|
|
21
22
|
{...tooltipProps}
|
|
22
23
|
>
|
|
23
24
|
<StyledChip
|
|
24
25
|
{...CHIP_PROPS}
|
|
25
26
|
className={className}
|
|
26
|
-
label={getLabel(versionInfo)}
|
|
27
|
+
label={getLabel({ catalog, ...versionInfo })}
|
|
27
28
|
{...chipProps}
|
|
28
29
|
/>
|
|
29
30
|
</Tooltip>
|
|
@@ -2,7 +2,9 @@ import { Toolbar } from "@mui/material";
|
|
|
2
2
|
import React, { ReactNode } from "react";
|
|
3
3
|
import { Social } from "../../../common/Socials/socials";
|
|
4
4
|
import { ANCHOR_TARGET } from "../../../Links/common/entities";
|
|
5
|
+
import { isNodeBoolean } from "../../../utils";
|
|
5
6
|
import { NavLinkItem } from "../Header/components/Content/components/Navigation/navigation";
|
|
7
|
+
import { VersionInfo } from "./components/VersionInfo/versionInfo";
|
|
6
8
|
import { AppBar, Link, Links, Socials } from "./footer.styles";
|
|
7
9
|
|
|
8
10
|
export interface FooterProps {
|
|
@@ -41,7 +43,7 @@ export const Footer = ({
|
|
|
41
43
|
/>
|
|
42
44
|
))}
|
|
43
45
|
{socials && <Socials buttonSize="small" socials={socials} />}
|
|
44
|
-
{versionInfo}
|
|
46
|
+
{isNodeBoolean(versionInfo) ? <VersionInfo /> : versionInfo}
|
|
45
47
|
</Links>
|
|
46
48
|
)}
|
|
47
49
|
</Toolbar>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Type guard for ReactNode; returns true if the value is a boolean.
|
|
5
|
+
* @param value - Value to check.
|
|
6
|
+
* @returns true if the value is a boolean.
|
|
7
|
+
*/
|
|
8
|
+
export function isNodeBoolean(value: ReactNode): value is boolean {
|
|
9
|
+
return typeof value === "boolean";
|
|
10
|
+
}
|
package/src/config/utils.ts
CHANGED
|
@@ -75,6 +75,7 @@ export function getEntityConfig(
|
|
|
75
75
|
entityListType: string
|
|
76
76
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This config model is part of a generic array
|
|
77
77
|
): EntityConfig {
|
|
78
|
+
if (!entityListType) return getDefaultEntityConfig();
|
|
78
79
|
const entityConfig = entities.find(({ route }) => route === entityListType);
|
|
79
80
|
if (!entityConfig) {
|
|
80
81
|
throw Error("No entity config found with name: " + entityListType);
|
package/src/providers/config.tsx
CHANGED
|
@@ -16,7 +16,7 @@ export type ConfigContextProps = {
|
|
|
16
16
|
export interface ConfigProps {
|
|
17
17
|
children: ReactNode | ReactNode[];
|
|
18
18
|
config: SiteConfig;
|
|
19
|
-
entityListType
|
|
19
|
+
entityListType?: string;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export const ConfigContext = createContext<ConfigContextProps>({
|
|
@@ -29,7 +29,7 @@ export const ConfigContext = createContext<ConfigContextProps>({
|
|
|
29
29
|
export function ConfigProvider({
|
|
30
30
|
children,
|
|
31
31
|
config,
|
|
32
|
-
entityListType,
|
|
32
|
+
entityListType = "",
|
|
33
33
|
}: ConfigProps): JSX.Element {
|
|
34
34
|
const { entities } = config;
|
|
35
35
|
const defaultEntityListType = config.redirectRootToPath.slice(1);
|