gitscope
https://dev.kronoz.win/r/marzneshin.git
dashboard/src/modules/users/components/user-expiration-value.tsx · nightly
Source
1 d377c4c Dawsh 2y ago import { type FC } from 'react'
2 e6e6467 Dawsh 2y ago import { UserProp } from "@marzneshin/modules/users";
3 d377c4c Dawsh 2y ago import { useTranslation } from "react-i18next";
4 8bd2e3d Aslan 1y ago import dayjs from "dayjs";
5 8bd2e3d Aslan 1y ago import relativeTime from "dayjs/plugin/relativeTime";
6 8bd2e3d Aslan 1y ago import advancedFormat from "dayjs/plugin/advancedFormat";
7 d377c4c Dawsh 2y ago
8 d377c4c Dawsh 2y ago export const UserExpirationValue: FC<UserProp> = ({ user }) => {
9 d377c4c Dawsh 2y ago const { t } = useTranslation();
10 8bd2e3d Aslan 1y ago
11 8bd2e3d Aslan 1y ago dayjs.extend(relativeTime);
12 8bd2e3d Aslan 1y ago dayjs.extend(advancedFormat);
13 8bd2e3d Aslan 1y ago
14 d377c4c Dawsh 2y ago return ({
15 d377c4c Dawsh 2y ago start_on_first_use: user.usage_duration && `${(user.usage_duration / 86400)} Day`,
16 8bd2e3d Aslan 1y ago fixed_date: user.expire_date && (dayjs(user.expire_date).format("MMMM Do, YYYY") + ' (' + dayjs(user.expire_date).fromNow()) + ')',
17 d377c4c Dawsh 2y ago never: t('never'),
18 d377c4c Dawsh 2y ago }[user.expire_strategy])
19 d377c4c Dawsh 2y ago }
20 d377c4c Dawsh 2y ago