https://dev.kronoz.win/r/marzneshin.git
| 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 |
e6e6467 |
Dawsh |
2y ago |
import { UserProp } from "@marzneshin/modules/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 |
|