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,44 @@
|
||||
import { TFunction, t as i18nT } from "i18next";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Colors } from "~/application/enums/shared/Colors";
|
||||
import SimpleBadge from "~/components/ui/badges/SimpleBadge";
|
||||
import CheckIcon from "~/components/ui/icons/CheckIcon";
|
||||
import XIcon from "~/components/ui/icons/XIcon";
|
||||
import { BooleanFormatType } from "~/utils/shared/BooleanUtils";
|
||||
|
||||
export function getBooleanAsStringValue({ value, format, t }: { value?: boolean; format?: BooleanFormatType; t?: TFunction }) {
|
||||
const translate = t ?? i18nT;
|
||||
return !format || format === "yesNo"
|
||||
? value
|
||||
? translate("shared.yes")
|
||||
: translate("shared.no")
|
||||
: format === "trueFalse"
|
||||
? value
|
||||
? translate("shared.true")
|
||||
: translate("shared.false")
|
||||
: format === "enabledDisabled"
|
||||
? value
|
||||
? translate("shared.enabled")
|
||||
: translate("shared.disabled")
|
||||
: format === "onOff"
|
||||
? value
|
||||
? translate("shared.on")
|
||||
: translate("shared.off")
|
||||
: format === "activeInactive"
|
||||
? value
|
||||
? translate("shared.active")
|
||||
: translate("shared.inactive")
|
||||
: "";
|
||||
}
|
||||
export default function RowBooleanCell({ value, format }: { value?: boolean; format?: BooleanFormatType }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<>
|
||||
{!format ? (
|
||||
<div>{value ? <CheckIcon className="h-4 w-4 text-teal-500" /> : <XIcon className="text-muted-foreground h-4 w-4" />}</div>
|
||||
) : (
|
||||
<SimpleBadge title={getBooleanAsStringValue({ value, format, t })} color={value ? Colors.GREEN : Colors.GRAY} />
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user