|
|
@ -11,18 +11,23 @@ import React from 'react';
|
|
|
|
import { Avatar } from 'tailchat-design';
|
|
|
|
import { Avatar } from 'tailchat-design';
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
modifyGroupField,
|
|
|
|
modifyGroupField,
|
|
|
|
|
|
|
|
PERMISSION,
|
|
|
|
showSuccessToasts,
|
|
|
|
showSuccessToasts,
|
|
|
|
showToasts,
|
|
|
|
showToasts,
|
|
|
|
t,
|
|
|
|
t,
|
|
|
|
UploadFileResult,
|
|
|
|
UploadFileResult,
|
|
|
|
useAsyncRequest,
|
|
|
|
useAsyncRequest,
|
|
|
|
useGroupInfo,
|
|
|
|
useGroupInfo,
|
|
|
|
|
|
|
|
useHasGroupPermission,
|
|
|
|
} from 'tailchat-shared';
|
|
|
|
} from 'tailchat-shared';
|
|
|
|
|
|
|
|
|
|
|
|
export const GroupSummary: React.FC<{
|
|
|
|
export const GroupSummary: React.FC<{
|
|
|
|
groupId: string;
|
|
|
|
groupId: string;
|
|
|
|
}> = React.memo(({ groupId }) => {
|
|
|
|
}> = React.memo(({ groupId }) => {
|
|
|
|
const groupInfo = useGroupInfo(groupId);
|
|
|
|
const groupInfo = useGroupInfo(groupId);
|
|
|
|
|
|
|
|
const [hasBaseInfoPermission] = useHasGroupPermission(groupId, [
|
|
|
|
|
|
|
|
PERMISSION.core.groupBaseInfo,
|
|
|
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
const [, handleUpdateGroupName] = useAsyncRequest(
|
|
|
|
const [, handleUpdateGroupName] = useAsyncRequest(
|
|
|
|
async (newName: string) => {
|
|
|
|
async (newName: string) => {
|
|
|
@ -70,7 +75,7 @@ export const GroupSummary: React.FC<{
|
|
|
|
<FullModalField
|
|
|
|
<FullModalField
|
|
|
|
title={t('群组名称')}
|
|
|
|
title={t('群组名称')}
|
|
|
|
value={groupInfo.name}
|
|
|
|
value={groupInfo.name}
|
|
|
|
editable={true}
|
|
|
|
editable={hasBaseInfoPermission}
|
|
|
|
renderEditor={DefaultFullModalInputEditorRender}
|
|
|
|
renderEditor={DefaultFullModalInputEditorRender}
|
|
|
|
onSave={handleUpdateGroupName}
|
|
|
|
onSave={handleUpdateGroupName}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
@ -84,7 +89,7 @@ export const GroupSummary: React.FC<{
|
|
|
|
title={t('群组描述')}
|
|
|
|
title={t('群组描述')}
|
|
|
|
value={groupInfo.description ?? ''}
|
|
|
|
value={groupInfo.description ?? ''}
|
|
|
|
content={<pre>{groupInfo.description ?? ''}</pre>}
|
|
|
|
content={<pre>{groupInfo.description ?? ''}</pre>}
|
|
|
|
editable={true}
|
|
|
|
editable={hasBaseInfoPermission}
|
|
|
|
renderEditor={GroupDescriptionEditorRender}
|
|
|
|
renderEditor={GroupDescriptionEditorRender}
|
|
|
|
onSave={handleUpdateGroupDescription}
|
|
|
|
onSave={handleUpdateGroupDescription}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|