diff --git a/src/assets/languageMap.ts b/src/assets/languageMap.ts index 7c10aa3..8b88e9a 100644 --- a/src/assets/languageMap.ts +++ b/src/assets/languageMap.ts @@ -39,7 +39,7 @@ type LanguageLabelsMapping = { export const languageLabels: LanguageLabelsMapping = { BG: { primary: "Bulgarian", secondary: "bg" }, HR: { primary: "Croatian", secondary: "hr" }, - CZ: { primary: "Czech", secondary: "cs" }, + CZ: { primary: "Czech", secondary: "cz" }, DK: { primary: "Danish", secondary: "da" }, NL: { primary: "Dutch", secondary: "nl" }, GB: { primary: "English", secondary: "en" }, diff --git a/src/pages/Deployment/InformedConsentCard/index.tsx b/src/pages/Deployment/InformedConsentCard/index.tsx index b14cc39..b14db62 100644 --- a/src/pages/Deployment/InformedConsentCard/index.tsx +++ b/src/pages/Deployment/InformedConsentCard/index.tsx @@ -144,7 +144,7 @@ const InformedConsentCard = () => { downloadPdf(consent)}> - {t("common:export_data")} + {t("common:download_pdf")} diff --git a/src/pages/Deployments/DeploymentCard/index.tsx b/src/pages/Deployments/DeploymentCard/index.tsx index 8ccb454..18d5e64 100644 --- a/src/pages/Deployments/DeploymentCard/index.tsx +++ b/src/pages/Deployments/DeploymentCard/index.tsx @@ -1,6 +1,6 @@ /* eslint-disable no-underscore-dangle */ import CopyButton from "@Components/Buttons/CopyButton"; -import { ParticipantGroup } from "@carp-dk/client"; +import { ParticipantGroup } from "@carp-dk/client/models/ParticipantGroups"; import KeyboardArrowDownRoundedIcon from "@mui/icons-material/KeyboardArrowDownRounded"; import { Skeleton, Typography } from "@mui/material"; import { useEffect, useMemo, useState } from "react"; @@ -79,7 +79,11 @@ const DeploymentCard = ({ ) } > - {names && names[0].length > 0 ? names : Generated deployment} + {!deployment.participants.every((p) => p.email == null) ? ( + names + ) : ( + Generated deployment + )} diff --git a/src/pages/Export/ExportsTable/index.tsx b/src/pages/Export/ExportsTable/index.tsx index 90ddffe..6cb5534 100644 --- a/src/pages/Export/ExportsTable/index.tsx +++ b/src/pages/Export/ExportsTable/index.tsx @@ -53,7 +53,7 @@ const ExportsTable = memo(({ exports, exportsLoading }: Props) => { }, { accessorKey: "download", - header: "Export", + header: "Download", Cell: DownloadButton, enableSorting: false, size: 100, diff --git a/src/pages/Participant/InformedConsent/index.tsx b/src/pages/Participant/InformedConsent/index.tsx index 9d7e0c3..55bc532 100644 --- a/src/pages/Participant/InformedConsent/index.tsx +++ b/src/pages/Participant/InformedConsent/index.tsx @@ -114,7 +114,7 @@ const InformedConsent = () => { <> downloadPdf()}> - Export + Download PDF diff --git a/src/pages/Participants/ParticipantsTable/index.tsx b/src/pages/Participants/ParticipantsTable/index.tsx index a46b498..be2c493 100644 --- a/src/pages/Participants/ParticipantsTable/index.tsx +++ b/src/pages/Participants/ParticipantsTable/index.tsx @@ -4,7 +4,7 @@ import { useParticipantsAccounts, } from "@Utils/queries/participants"; import { useStudyDetails } from "@Utils/queries/studies"; -import { formatDate } from "@Utils/utility"; +import { formatDateTime } from "@Utils/utility"; import carpStudies from "@cachet/carp-studies-core"; import { ParticipantAccount } from "@carp-dk/client"; import AddRoundedIcon from "@mui/icons-material/AddRounded"; @@ -90,7 +90,11 @@ const ParticipantsTable = ({ if (deployment) { return ( - {formatDate(deployment.invitedOn.toEpochMilliseconds())} + {formatDateTime(deployment.invitedOn.toEpochMilliseconds(), { + year: "numeric", + month: "short", + day: "numeric", + })} ); } diff --git a/src/pages/StudyOverview/Overview/DeploymentStatus/TooltipContent/index.tsx b/src/pages/StudyOverview/Overview/DeploymentStatus/TooltipContent/index.tsx index 4c7b0c4..3a98dad 100644 --- a/src/pages/StudyOverview/Overview/DeploymentStatus/TooltipContent/index.tsx +++ b/src/pages/StudyOverview/Overview/DeploymentStatus/TooltipContent/index.tsx @@ -14,7 +14,7 @@ const TooltipContent = () => { - Deploying Devices + Deploying : Participants have started registering devices, but are remaining devices. diff --git a/src/pages/StudyOverview/Overview/DeploymentStatus/index.tsx b/src/pages/StudyOverview/Overview/DeploymentStatus/index.tsx index fe39ac4..781f5f7 100644 --- a/src/pages/StudyOverview/Overview/DeploymentStatus/index.tsx +++ b/src/pages/StudyOverview/Overview/DeploymentStatus/index.tsx @@ -66,7 +66,7 @@ const DeploymentStatus = () => { deploying: { id: 1, value: 0, - label: "Deploying Devices", + label: "Deploying", color: getDeploymentStatusColor("DeployingDevices"), }, running: { diff --git a/src/pages/StudySettings/StudyData/index.tsx b/src/pages/StudySettings/StudyData/index.tsx index c8383da..b16445f 100644 --- a/src/pages/StudySettings/StudyData/index.tsx +++ b/src/pages/StudySettings/StudyData/index.tsx @@ -18,6 +18,7 @@ import LinkIcon from "@mui/icons-material/Link"; import { useFormik } from "formik"; import { useNavigate, useParams } from "react-router"; import * as yup from "yup"; +import { formatDateTime } from "@Utils/utility"; import StudySetupSkeleton from "../StudySetupSkeleton"; import { Heading, @@ -175,7 +176,17 @@ const StudyData = () => { key={protocol.id.stringRepresentation} value={protocol.id.stringRepresentation} > - {protocol.name} + + {protocol.name} + + {formatDateTime(protocol.createdOn.toEpochMilliseconds())} + + ))} diff --git a/src/pages/Translation/AddTranslationModal/index.tsx b/src/pages/Translation/AddTranslationModal/index.tsx index 08fb721..8de0297 100644 --- a/src/pages/Translation/AddTranslationModal/index.tsx +++ b/src/pages/Translation/AddTranslationModal/index.tsx @@ -1,12 +1,21 @@ +/* eslint-disable react/jsx-props-no-spreading */ import { languageLabels } from "@Assets/languageMap"; import DragAndDrop from "@Components/DragAndDrop"; -import { FormLabel, Modal } from "@mui/material"; +import { + Autocomplete, + FormLabel, + InputAdornment, + MenuItem, + Modal, + Stack, + TextField, +} from "@mui/material"; import { useCreateTranslation } from "@Utils/queries/studies"; import { useFormik } from "formik"; import { useEffect, useState } from "react"; -import ReactFlagsSelect from "react-flags-select"; import { useParams } from "react-router-dom"; import * as yup from "yup"; +import * as flags from "react-flags-select"; import { CancelButton, DoneButton, @@ -121,14 +130,99 @@ const AddTranslationModal = ({ open, onClose }: Props) => { - Language - formik.setFieldValue("language", code)} + + Language + + { + formik.setFieldValue("language", newValue); + }} + filterOptions={(options, params) => { + return options.filter((option) => + languageLabels[option].primary + .toLowerCase() + .includes(params.inputValue.toLowerCase()), + ); + }} + onBlur={formik.handleBlur} + fullWidth + getOptionLabel={(option) => + `${languageLabels[option].primary} ${ + languageLabels[option].secondary + }` + } + renderInput={(params) => { + if (!formik.values.language) { + return ( + + ); + } + const countryCode = + formik.values.language[0].toUpperCase() + + formik.values.language[1].toLowerCase(); + let CountryFlag; + if (countryCode in flags) { + CountryFlag = flags[countryCode]; + } else { + CountryFlag = "div"; + } + return ( + + + + ), + }} + /> + ); + }} + renderOption={(props, option) => { + // eslint-disable-next-line react/prop-types + const { key, ...optionProps } = props; + const countryCode = + option[0].toUpperCase() + option[1].toLowerCase(); + let CountryFlag; + if (countryCode in flags) { + CountryFlag = flags[countryCode]; + } else { + CountryFlag = "div"; + } + return ( + + + + {languageLabels[option].primary} + + + ); + }} /> Upload Translation File { const date = new Date(dateString); - return `${date.toLocaleString("en-GB", options)}`; + return `${date.toLocaleString("en-US", options)}`; }; export const formatDate = (dateString: number | string) => {