mirror of https://github.com/msgbyte/tailchat
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
913 B
TypeScript
39 lines
913 B
TypeScript
3 years ago
|
import { Tooltip } from 'antd';
|
||
|
import React from 'react';
|
||
|
import {
|
||
|
datetimeFromNow,
|
||
|
formatFullTime,
|
||
|
GroupInvite,
|
||
|
t,
|
||
|
Trans,
|
||
|
} from 'tailchat-shared';
|
||
|
|
||
|
interface InviteCodeExpiredAtProps {
|
||
|
invite: Pick<GroupInvite, 'expiredAt'>;
|
||
|
}
|
||
|
export const InviteCodeExpiredAt: React.FC<InviteCodeExpiredAtProps> =
|
||
|
React.memo((props) => {
|
||
|
const { invite } = props;
|
||
|
|
||
|
if (!invite.expiredAt) {
|
||
|
return t('该邀请码永不过期');
|
||
|
}
|
||
|
|
||
3 years ago
|
if (new Date(invite.expiredAt).valueOf() < Date.now()) {
|
||
|
return t('该邀请码已过期');
|
||
|
}
|
||
|
|
||
3 years ago
|
return (
|
||
|
<Trans>
|
||
|
该邀请将于{' '}
|
||
|
<Tooltip title={formatFullTime(invite.expiredAt)}>
|
||
|
<span className="font-bold">
|
||
|
{{ date: datetimeFromNow(invite.expiredAt) }}
|
||
3 years ago
|
</span>
|
||
|
</Tooltip>{' '}
|
||
3 years ago
|
过期
|
||
|
</Trans>
|
||
|
);
|
||
|
});
|
||
|
InviteCodeExpiredAt.displayName = 'InviteCodeExpiredAt';
|