Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,35 @@
|
||||
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 (
|
||||
<>
|
||||
<div className="flex items-center space-x-2">
|
||||
<RenderOption option={translatedSelected} display={display} hasColors={true} />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user