Skip to content

Commit 78a6d4c

Browse files
feat!: updated allowed annotation values #489 (#498)
1 parent d6d85e4 commit 78a6d4c

5 files changed

Lines changed: 13 additions & 7 deletions

File tree

src/common/entities.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import { ColumnDef, RowData } from "@tanstack/react-table";
44
* Model of a value of a metadata class.
55
*/
66
export interface Attribute {
7-
annotations?: {
8-
[key in keyof DataDictionaryPrefix]: string; // Prefix to fragment mapping, e.g. cxg: "batch_condition".
9-
};
7+
// Prefix to fragment mapping, e.g. cxg: "batch_condition", or, general tags e.g. tier: "Tier 1" and bionetwork: ["gut"]
8+
annotations?: Record<string, string | string[] | undefined>; // 'undefined' allows for mix of keys across attributes e.g. tier, or tier and cxg, or cxg
109
description: string;
1110
example?: string; // Free text example of attribute
1211
multivalued: boolean; // True if attribute can have multiple values

src/components/DataDictionary/dataDictionary.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ export const DataDictionary = <T extends RowData = Attribute>({
2121
Title = DefaultTitle,
2222
TitleLayout = DefaultTitleLayout,
2323
}: DataDictionaryProps): JSX.Element => {
24-
const { classes, columnDefs } = useDataDictionary<T>();
24+
const { classes, columnDefs, title } = useDataDictionary<T>();
2525
const { spacing } = useLayoutSpacing();
2626
const outline = useMemo(() => buildClassesOutline(classes), [classes]);
2727
return (
2828
<View className={className}>
2929
<TitleLayout {...spacing}>
30-
<Title />
30+
<Title title={title} />
3131
</TitleLayout>
3232
<OutlineLayout {...spacing}>
3333
<Outline outline={outline} />

src/components/DataDictionary/hooks/UseDataDictionary/hook.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const useDataDictionary = <
1818
return useMemo(() => {
1919
const classes = dataDictionaryConfig?.dataDictionary?.classes || [];
2020
const columnDefs = dataDictionaryConfig?.columnDefs || [];
21-
return { classes, columnDefs };
21+
const title = dataDictionaryConfig?.dataDictionary?.title || "";
22+
return { classes, columnDefs, title };
2223
}, [dataDictionaryConfig]);
2324
};

src/components/DataDictionary/hooks/UseDataDictionary/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ import { Attribute, Class } from "../../../../common/entities";
44
export interface UseDataDictionary<T extends RowData = Attribute> {
55
classes: Class<T>[];
66
columnDefs: ColumnDef<T, T[keyof T]>[];
7+
title: string;
78
}

src/components/Layout/components/Header/header.styles.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ import { AppBar as MAppBar } from "@mui/material";
44
import { smokeMain } from "../../../../styles/common/mixins/colors";
55
import { HEADER_HEIGHT } from "./common/constants";
66

7+
// See https://github.com/emotion-js/emotion/issues/1105.
8+
// See https://github.com/emotion-js/emotion/releases/tag/%40emotion%2Fcache%4011.10.2.
9+
const ignoreSsrWarning =
10+
"/* emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason */";
11+
712
export const AppBar = styled(MAppBar)`
813
border-bottom: 1px solid ${smokeMain};
914
@@ -34,7 +39,7 @@ export const Left = styled.div`
3439
justify-content: flex-start;
3540
3641
.MuiButton-navPrimary {
37-
&:first-of-type {
42+
&:first-child:not(style)${ignoreSsrWarning} { {
3843
margin-left: 24px;
3944
}
4045
}

0 commit comments

Comments
 (0)