|
|
@ -7,13 +7,17 @@ import {
|
|
|
|
formatFullTime,
|
|
|
|
formatFullTime,
|
|
|
|
deleteGroupInvite,
|
|
|
|
deleteGroupInvite,
|
|
|
|
useAsyncRefresh,
|
|
|
|
useAsyncRefresh,
|
|
|
|
|
|
|
|
showToasts,
|
|
|
|
} from 'tailchat-shared';
|
|
|
|
} from 'tailchat-shared';
|
|
|
|
import { Button, Table, Tooltip } from 'antd';
|
|
|
|
import { Button, Space, Table, Tooltip } from 'antd';
|
|
|
|
import type { ColumnType } from 'antd/lib/table';
|
|
|
|
import type { ColumnType } from 'antd/lib/table';
|
|
|
|
import { UserName } from '@/components/UserName';
|
|
|
|
import { UserName } from '@/components/UserName';
|
|
|
|
import { openModal, openReconfirmModalP } from '@/components/Modal';
|
|
|
|
import { openModal, openReconfirmModalP } from '@/components/Modal';
|
|
|
|
import { CreateGroupInvite } from '../CreateGroupInvite';
|
|
|
|
import { CreateGroupInvite } from '../CreateGroupInvite';
|
|
|
|
import { LoadingOnFirst } from '@/components/LoadingOnFirst';
|
|
|
|
import { LoadingOnFirst } from '@/components/LoadingOnFirst';
|
|
|
|
|
|
|
|
import { IconBtn } from '@/components/IconBtn';
|
|
|
|
|
|
|
|
import copy from 'copy-to-clipboard';
|
|
|
|
|
|
|
|
import { generateInviteCodeUrl } from '@/utils/url-helper';
|
|
|
|
|
|
|
|
|
|
|
|
export const GroupInvite: React.FC<{
|
|
|
|
export const GroupInvite: React.FC<{
|
|
|
|
groupId: string;
|
|
|
|
groupId: string;
|
|
|
@ -36,6 +40,11 @@ export const GroupInvite: React.FC<{
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}, [groupId, refresh]);
|
|
|
|
}, [groupId, refresh]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handleCopyInviteCode = useCallback((inviteCode: string) => {
|
|
|
|
|
|
|
|
copy(generateInviteCodeUrl(inviteCode));
|
|
|
|
|
|
|
|
showToasts(t('邀请链接已复制到剪切板'), 'success');
|
|
|
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
|
|
const handleDeleteInvite = useCallback(
|
|
|
|
const handleDeleteInvite = useCallback(
|
|
|
|
async (inviteId: string) => {
|
|
|
|
async (inviteId: string) => {
|
|
|
|
if (await openReconfirmModalP()) {
|
|
|
|
if (await openReconfirmModalP()) {
|
|
|
@ -84,22 +93,28 @@ export const GroupInvite: React.FC<{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
title: t('操作'),
|
|
|
|
title: t('操作'),
|
|
|
|
dataIndex: '_id',
|
|
|
|
dataIndex: '_id',
|
|
|
|
render: (id: string) => {
|
|
|
|
render: (id: string, record) => {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<Space>
|
|
|
|
<Button
|
|
|
|
<IconBtn
|
|
|
|
type="primary"
|
|
|
|
title={t('复制邀请链接')}
|
|
|
|
|
|
|
|
shape="square"
|
|
|
|
|
|
|
|
icon="mdi:content-copy"
|
|
|
|
|
|
|
|
onClick={() => handleCopyInviteCode(record.code)}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
<IconBtn
|
|
|
|
|
|
|
|
title={t('删除')}
|
|
|
|
|
|
|
|
shape="square"
|
|
|
|
|
|
|
|
icon="mdi:delete-outline"
|
|
|
|
danger={true}
|
|
|
|
danger={true}
|
|
|
|
onClick={() => handleDeleteInvite(id)}
|
|
|
|
onClick={() => handleDeleteInvite(id)}
|
|
|
|
>
|
|
|
|
/>
|
|
|
|
{t('删除')}
|
|
|
|
</Space>
|
|
|
|
</Button>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
[handleDeleteInvite]
|
|
|
|
[handleCopyInviteCode, handleDeleteInvite]
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|