gitscope
https://dev.kronoz.win/r/marzneshin.git
dashboard/src/features/users/components/pills/user-expire-strategy-pill.tsx · v0.5.1
Source
1 d377c4c Dawsh 2y ago
2 d377c4c Dawsh 2y ago import { type FC } from "react";
3 d377c4c Dawsh 2y ago import { Badge } from "@marzneshin/components";
4 d377c4c Dawsh 2y ago import { useTranslation } from "react-i18next";
5 d377c4c Dawsh 2y ago import { UserProp } from "@marzneshin/features/users";
6 d377c4c Dawsh 2y ago
7 d377c4c Dawsh 2y ago export const UserExpireStrategyPill: FC<UserProp> = ({ user }) => {
8 d377c4c Dawsh 2y ago const { t } = useTranslation();
9 d377c4c Dawsh 2y ago const label = {
10 d377c4c Dawsh 2y ago start_on_first_use: t("page.users.on_first_use"),
11 d377c4c Dawsh 2y ago fixed_date: t("page.users.fixed_date"),
12 d377c4c Dawsh 2y ago never: t("page.users.never"),
13 d377c4c Dawsh 2y ago }[user.expire_strategy]
14 d377c4c Dawsh 2y ago const variant = {
15 d377c4c Dawsh 2y ago start_on_first_use: "royal",
16 d377c4c Dawsh 2y ago fixed_date: "warning",
17 d377c4c Dawsh 2y ago never: "disabled",
18 d377c4c Dawsh 2y ago }[user.expire_strategy]
19 d377c4c Dawsh 2y ago return (
20 d377c4c Dawsh 2y ago <Badge variant={variant as "royal" | "disabled" | "warning"}>
21 d377c4c Dawsh 2y ago {label}
22 d377c4c Dawsh 2y ago </Badge>
23 d377c4c Dawsh 2y ago )
24 d377c4c Dawsh 2y ago }
25 d377c4c Dawsh 2y ago