mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 05:12:39 +00:00

* feat(member-group): Team (#2616) * feat: member-group schema define * feat(fe): create group * feat: add group edit modal * feat(fe): add avatar group component * feat: edit group fix: permission select menu style * feat: bio-mode support for select-member component * fix: avatar group key unique * feat: group manage * feat: divide member into group and clbs * feat: finish team permission * chore: adjust * fix: get clbs * perf: groups code * pref: member group for team (#2706) * chore: fe adjust fix: remove the member from groups when removing from team feat: change the groups avatar when updating the team's avatar * chore: DefaultGroupName as a constant string '' * fix: create default group when create team for root * feat: comment * feat: 4811 init * pref: member group for team (#2732) * chore: default group name * feat: get default group when get by tmbid * feat(fe): adjust * member ui * fix: delete group (#2736) * perf: init4811 * pref: member group (#2818) * fix: update clb per then refetch clb list * fix: calculate group permission * feat(fe): group tag * refactor(fe): team and group manage * feat: manage group member * feat: add group transfer owner modal * feat: group manage member * chore: adjust the file structure * pref: member group * chore: adjust fe style * fix: ts error * chore: fe adjust * chore: fe adjust * chore: adjust * chore: adjust the code * perf: i18n and schema name * pref: member-group (#2862) * feat: group list ordered by updateTime * fix: transfer ownership of group when deleting member * fix: i18n fix * feat: can not set member as admin/owner when user is not active * fix: GroupInfoModal hover input do not change color * fix(fe): searchinput do not scroll * perf: team group ui * doc * remove enum --------- Co-authored-by: Finley Ge <32237950+FinleyGe@users.noreply.github.com>
114 lines
2.6 KiB
TypeScript
114 lines
2.6 KiB
TypeScript
import React from 'react';
|
|
import {
|
|
Modal,
|
|
ModalOverlay,
|
|
ModalContent,
|
|
ModalHeader,
|
|
ModalCloseButton,
|
|
ModalContentProps,
|
|
Box,
|
|
ImageProps
|
|
} from '@chakra-ui/react';
|
|
import MyBox from '../MyBox';
|
|
import { useSystem } from '../../../hooks/useSystem';
|
|
import Avatar from '../Avatar';
|
|
|
|
export interface MyModalProps extends ModalContentProps {
|
|
iconSrc?: string;
|
|
iconColor?: ImageProps['color'];
|
|
title?: any;
|
|
isCentered?: boolean;
|
|
isLoading?: boolean;
|
|
isOpen?: boolean;
|
|
onClose?: () => void;
|
|
closeOnOverlayClick?: boolean;
|
|
size?: 'md' | 'lg';
|
|
}
|
|
|
|
const MyModal = ({
|
|
isOpen = true,
|
|
onClose,
|
|
iconSrc,
|
|
title,
|
|
children,
|
|
isCentered,
|
|
isLoading,
|
|
w = 'auto',
|
|
maxW = ['90vw', '600px'],
|
|
closeOnOverlayClick = true,
|
|
iconColor,
|
|
size = 'md',
|
|
...props
|
|
}: MyModalProps) => {
|
|
const { isPc } = useSystem();
|
|
|
|
return (
|
|
<Modal
|
|
isOpen={isOpen}
|
|
onClose={() => onClose && onClose()}
|
|
size={size}
|
|
autoFocus={false}
|
|
isCentered={isPc ? isCentered : true}
|
|
blockScrollOnMount={false}
|
|
closeOnOverlayClick={closeOnOverlayClick}
|
|
>
|
|
<ModalOverlay />
|
|
<ModalContent
|
|
w={w}
|
|
minW={['90vw', '400px']}
|
|
maxW={maxW}
|
|
position={'relative'}
|
|
maxH={'85vh'}
|
|
boxShadow={'7'}
|
|
{...props}
|
|
>
|
|
{!title && onClose && <ModalCloseButton zIndex={1} />}
|
|
{!!title && (
|
|
<ModalHeader
|
|
display={'flex'}
|
|
alignItems={'center'}
|
|
background={'#FBFBFC'}
|
|
borderBottom={'1px solid #F4F6F8'}
|
|
roundedTop={'lg'}
|
|
py={'10px'}
|
|
fontSize={'md'}
|
|
fontWeight={'bold'}
|
|
>
|
|
{iconSrc && (
|
|
<>
|
|
<Avatar
|
|
color={iconColor}
|
|
objectFit={'contain'}
|
|
alt=""
|
|
src={iconSrc}
|
|
w={'1.5rem'}
|
|
borderRadius={'sm'}
|
|
/>
|
|
</>
|
|
)}
|
|
<Box ml={3} color={'myGray.900'} fontWeight={'500'}>
|
|
{title}
|
|
</Box>
|
|
<Box flex={1} />
|
|
{onClose && (
|
|
<ModalCloseButton position={'relative'} fontSize={'xs'} top={0} right={0} />
|
|
)}
|
|
</ModalHeader>
|
|
)}
|
|
|
|
<MyBox
|
|
isLoading={isLoading}
|
|
overflow={props.overflow || 'overlay'}
|
|
h={'100%'}
|
|
display={'flex'}
|
|
flexDirection={'column'}
|
|
>
|
|
{children}
|
|
</MyBox>
|
|
</ModalContent>
|
|
</Modal>
|
|
);
|
|
};
|
|
|
|
export default React.memo(MyModal);
|