From 32ec8246fa89d2c603dae364b36dc8b4131080cb Mon Sep 17 00:00:00 2001 From: James McLaughlin Date: Fri, 14 Jun 2024 03:10:13 +0100 Subject: [PATCH] add missing PropLabel.tsx --- .../src/pages/node/prop_table/PropLabel.tsx | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 grebi_ui/src/pages/node/prop_table/PropLabel.tsx diff --git a/grebi_ui/src/pages/node/prop_table/PropLabel.tsx b/grebi_ui/src/pages/node/prop_table/PropLabel.tsx new file mode 100644 index 0000000..c47687e --- /dev/null +++ b/grebi_ui/src/pages/node/prop_table/PropLabel.tsx @@ -0,0 +1,42 @@ + +import React, { Fragment } from "react"; +import Refs from "../../../model/Refs"; +import { pickBestDisplayName } from "../../../app/util"; +import { Tooltip } from "@mui/material"; + +export default function PropLabel(params:{prop:string,refs:Refs}) { + + let { prop, refs } = params + + let ref = refs.get(prop) + + let displayName:string|undefined = ({ + 'grebi:name': 'Name', + 'grebi:synonym': 'Synonym', + 'grebi:description': 'Description', + 'grebi:type': 'Type', + })[prop] + + if(displayName) { + return {displayName} + } + + if(ref) { + displayName = pickBestDisplayName(ref.name) + if(displayName) { + return {displayName} + + + + + } + } + + return + {prop} + +} \ No newline at end of file