19 lines
919 B
TypeScript
19 lines
919 B
TypeScript
import { Fragment } from "react";
|
|
import { Colors } from "~/application/enums/shared/Colors";
|
|
import SimpleBadge from "~/components/ui/badges/SimpleBadge";
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
export default function ApiCallSpeedBadge({ duration }: { duration: number }) {
|
|
const { t } = useTranslation();
|
|
|
|
return (
|
|
<Fragment>
|
|
{duration < 10 && <SimpleBadge title={t("metrics.speed.lightningFast")} color={Colors.GREEN} />}
|
|
{duration >= 10 && duration < 100 && <SimpleBadge title={t("metrics.speed.fast")} color={Colors.TEAL} />}
|
|
{duration >= 100 && duration < 1000 && <SimpleBadge title={t("metrics.speed.average")} color={Colors.YELLOW} />}
|
|
{duration >= 1000 && duration < 2000 && <SimpleBadge title={t("metrics.speed.slow")} color={Colors.ORANGE} />}
|
|
{duration >= 2000 && <SimpleBadge title={t("metrics.speed.verySlow")} color={Colors.RED} />}
|
|
</Fragment>
|
|
);
|
|
}
|