Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename binary data type labels #296

Merged
merged 1 commit into from
Feb 11, 2025
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
2 changes: 2 additions & 0 deletions public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
"Boolean": "Boolean",
"a data type where the data only has two possible variables: true or false": "a data type where the data only has two possible variables: true or false",
"Binary": "Binary",
"Binaryfile": "Binaryfile",
"a data type that defines a binary code signal": "a data type that defines a binary code signal",
"DateTime": "DateTime",
"a data type that defines dates. Common formats include dates ...": "a data type that defines dates. Common formats include dates (e.g., YYYY-MM-DD), times (e.g., hh:mm:ss), dates and times concatenated (e.g., YYYY-MM-DDThh:mm:ss.sss+zz:zz), and durations (e.g., PnYnMnD)",
Expand Down Expand Up @@ -170,6 +171,7 @@
"This is a language specific description of the attribute...": "This is a language specific description of the attribute and should contain information that will help dataset users understand necessary details about each attribute.",
"Toggles between the one or more languages used in the schema": "Toggles between the one or more languages used in the schema.",
"Array[Binary]": "Array[Binary]",
"Array[Binaryfile]": "Array[Binaryfile]",
"Array[Boolean]": "Array[Boolean]",
"Array[DateTime]": "Array[DateTime]",
"Array[Numeric]": "Array[Numeric]",
Expand Down
2 changes: 2 additions & 0 deletions public/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
"Boolean": "Booléen",
"a data type where the data only has two possible variables: true or false": "un type de données où les données n'ont que deux variables possibles : vrai ou faux",
"Binary": "Binaire",
"Binaryfile": "Fichier binaire",
"a data type that defines a binary code signal": "un type de données qui définit un signal de code binaire",
"DateTime": "DateHeure",
"a data type that defines dates. Common formats include dates ...": "un type de données qui définit les dates. Les formats courants incluent les dates (par exemple, AAAA-MM-JJ), les heures (par exemple, hh:mm:ss), les dates et les heures concaténées (par exemple, AAAA-MM-JJThh:mm:ss.sss+zz:zz) et durées (par exemple, PnYnMnD)",
Expand Down Expand Up @@ -169,6 +170,7 @@
"This is a language specific description of the attribute...": "Il s'agit d'une description spécifique à la langue de l'attribut et doit contenir des informations qui aideront les utilisateurs de l'ensemble de données à comprendre les détails nécessaires sur chaque attribut.",
"Toggles between the one or more languages used in the schema": "Bascule entre une ou plusieurs langues utilisées dans le schéma.",
"Array[Binary]": "Tableau[Binaire]",
"Array[Binaryfile]": "Tableau[Fichier binaire]",
"Array[Boolean]": "Tableau[Booléen]",
"Array[DateTime]": "Tableau[DateHeure]",
"Array[Numeric]": "Tableau[Numérique]",
Expand Down
34 changes: 17 additions & 17 deletions src/AttributeDetails/TypeRenderer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ const TypeRenderer = ({ data, attributeRowData, typesObjectRef, dropRefs }) => {
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
const { t } = useTranslation();
const displayValues = [
"",
"Binary",
"Boolean",
"DateTime",
"Numeric",
// "Reference",
"Text",
"Array[Binary]",
"Array[Boolean]",
"Array[DateTime]",
"Array[Numeric]",
// "Array[Reference]",
"Array[Text]"
{ value: "", label: "" },
{ value: "Binary", label: "Binaryfile" },
{ value: "Boolean", label: "Boolean" },
{ value: "DateTime", label: "DateTime" },
{ value: "Numeric", label: "Numeric" },
// { value: "Reference", label: "Reference" },
{ value: "Text", label: "Text" },
{ value: "Array[Binary]", label: "Array[Binaryfile]" },
{ value: "Array[Boolean]", label: "Array[Boolean]" },
{ value: "Array[DateTime]", label: "Array[DateTime]" },
{ value: "Array[Numeric]", label: "Array[Numeric]" },
// { value: "Array[Reference]", label: "Array[Reference]" },
{ value: "Array[Text]", label: "Array[Text]" }
];

const attributeName = data.Attribute;
Expand All @@ -29,16 +29,16 @@ const TypeRenderer = ({ data, attributeRowData, typesObjectRef, dropRefs }) => {

const index = attributeRowData.findIndex((item) => item.Attribute === attributeName);
const [type, setType] = useState(
(currentAttribute && currentAttribute.Type) || displayValues[0]
(currentAttribute && currentAttribute.Type) || displayValues[0].value
);

const typesDisplay = displayValues.map((value) => (
<MenuItem
key={value}
value={value}
key={value.value}
value={value.value}
sx={{ border: "none", height: "2rem", fontSize: "small" }}
>
{t(value)}
{t(value.label)}
</MenuItem>
));

Expand Down
80 changes: 37 additions & 43 deletions src/AttributeDetails/TypeTooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,67 +2,61 @@ import React from "react";
import { Typography } from "@mui/material";
import { useTranslation } from "react-i18next";

const BulletDot = () => (
<div
style={{
width: "4px",
height: "4px",
borderRadius: "50%",
backgroundColor: "white",
display: "inline-block",
verticalAlign: "middle",
marginRight: "5px",
marginBottom: "2px"
}}
/>
);

export default function TypeTooltip() {
const { t } = useTranslation();

const BulletDot = () => {
return (
<div
style={{
width: "4px",
height: "4px",
borderRadius: "50%",
backgroundColor: "white",
display: "inline-block",
verticalAlign: "middle",
marginRight: "5px",
marginBottom: "2px",
}}
/>
);
};

const listArray = [
{ name: t("Text"), content: t("text, mixed text and numbers") },
{ name: t("Numeric"), content: t("only numbers") },
{
name: t("Boolean"),
content:
t("a data type where the data only has two possible variables: true or false"),
content: t(
"a data type where the data only has two possible variables: true or false"
)
},
{
name: t("Binary"),
content: t("a data type that defines a binary code signal"),
name: t("Binaryfile"),
content: t("a data type that defines a binary code signal")
},
{
name: t("DateTime"),
content:
t("a data type that defines dates. Common formats include dates ..."),
content: t("a data type that defines dates. Common formats include dates ...")
},
{
name: t("Array [attribute type]"),
content:
t("a data type that defines a structure that holds several data items or elements of the same data type"),
},
content: t(
"a data type that defines a structure that holds several data items or elements of the same data type"
)
}
];

const tooltipDisplay = listArray.map((item) => {
return (
<div sx={{ p: 0 }} key={item.name}>
<BulletDot />
<Typography
variant="caption"
sx={{ display: "inline", fontWeight: "bold" }}
>
{item.name}:
</Typography>
<Typography variant="caption">
&nbsp;
{item.content}
</Typography>
</div>
);
});
const tooltipDisplay = listArray.map((item) => (
<div key={item.name}>
<BulletDot />
<Typography variant="caption" sx={{ display: "inline", fontWeight: "bold" }}>
{item.name}:
</Typography>
<Typography variant="caption">
&nbsp;
{item.content}
</Typography>
</div>
));

return <div>{tooltipDisplay}</div>;
}