import { Colors } from "~/application/enums/shared/Colors"; import RenderOption from "../../properties/select/RenderOption"; import { SelectOptionsDisplay } from "~/utils/shared/SelectOptionsUtils"; import { translateSelectOptionLabel } from "~/utils/i18n/translateLabel"; import { useTranslation } from "react-i18next"; type ItemDto = { value: string; name: string | null; color: Colors }; export default function RowSelectedOptionCell({ value, options, display = "Name", entityName, propertyName, }: { value: string; options: ItemDto[]; display: SelectOptionsDisplay; entityName?: string; propertyName?: string; }) { const { t, i18n } = useTranslation(); const selected = options.find((f) => f.value === value); if (options.length === 0 || !selected) { return value; } const translatedSelected = entityName && propertyName ? { ...selected, name: translateSelectOptionLabel(t, i18n, entityName, propertyName, selected) } : selected; return ( <>
); }