Commit 4f30121d by Finley Ge Committed by GitHub

refactor(app): optimize tool selector UI/UX (#7127)

Refactor tool selector and modal layout to improve responsiveness and
consistency. Update grid structures, adjust padding and sizing, and
streamline component interaction flows.
parent 2a715bcc
...@@ -84,15 +84,19 @@ const ToolSelect = ({ ...@@ -84,15 +84,19 @@ const ToolSelect = ({
return ( return (
<MyTooltip key={item.id} label={item.intro}> <MyTooltip key={item.id} label={item.intro}>
<Flex <Grid
overflow={'hidden'} overflow={'hidden'}
alignItems={'center'} alignItems={'center'}
p={2.5} gridTemplateColumns={'auto minmax(0, 1fr) auto'}
columnGap={2}
minW={0}
h={'46px'}
px={3}
py={0}
bg={'white'} bg={'white'}
boxShadow={'0 4px 8px -2px rgba(16,24,40,.1),0 2px 4px -2px rgba(16,24,40,.06)'} borderRadius={'6px'}
borderRadius={'md'}
border={'base'} border={'base'}
borderColor={toolError ? 'red.600' : ''} borderColor={toolError ? 'red.600' : 'myGray.200'}
userSelect={'none'} userSelect={'none'}
_hover={{ _hover={{
borderColor: toolError ? 'red.600' : 'primary.300', borderColor: toolError ? 'red.600' : 'primary.300',
...@@ -107,66 +111,60 @@ const ToolSelect = ({ ...@@ -107,66 +111,60 @@ const ToolSelect = ({
} }
}} }}
> >
<Avatar src={item.avatar} w={'1.5rem'} h={'1.5rem'} borderRadius={'sm'} /> <Avatar src={item.avatar} w={'28px'} h={'28px'} borderRadius={'sm'} />
<Box <Box minW={0} className={'textEllipsis'} fontSize={'sm'} color={'myGray.900'}>
flex={'1 0 0'}
ml={2}
gap={2}
className={'textEllipsis'}
fontSize={'sm'}
color={'myGray.900'}
>
{item.name} {item.name}
</Box> </Box>
{status !== undefined && status !== PluginStatusEnum.Normal && ( <Flex gap={1} minW={0} justifySelf={'end'} alignItems={'center'}>
<MyTooltip label={t(PluginStatusMap[status].tooltip)}> {status !== undefined && status !== PluginStatusEnum.Normal && (
<MyTag <MyTooltip label={t(PluginStatusMap[status].tooltip)}>
display={'block'} <MyTag
className="unHoverStyle" display={'block'}
mr={2} className="unHoverStyle"
colorSchema={PluginStatusMap[status].tagColor} colorSchema={PluginStatusMap[status].tagColor}
type="borderFill" type="borderFill"
> >
{t(PluginStatusMap[status].label)} {t(PluginStatusMap[status].label)}
</MyTag>
</MyTooltip>
)}
{toolError && (
<MyTag colorSchema="red" type="fill" className="unHoverStyle">
<MyIcon name={'common/error'} w={'14px'} mr={1} />
<Box color={'red.600'} maxW={'150px'} className="textEllipsis">
{t(toolError as any)}
</Box>
</MyTag> </MyTag>
</MyTooltip> )}
)} {isUnconfigured && (
{toolError && ( <MyTag colorSchema="blue" type="fill" className="unHoverStyle">
<MyTag colorSchema="red" type="fill" className="unHoverStyle"> {t('app:wait_for_config')}
<MyIcon name={'common/error'} w={'14px'} mr={1} /> </MyTag>
<Box color={'red.600'} maxW={'150px'} className="textEllipsis"> )}
{t(toolError as any)} {/* Edit icon */}
</Box> {hasFormInput && !toolError && (
</MyTag> <MyIconButton
)} className="hoverStyle"
{isUnconfigured && ( display={['flex', 'none']}
<MyTag colorSchema="blue" type="fill" className="unHoverStyle"> icon="common/setting"
{t('app:wait_for_config')} onClick={() => setConfigTool(item)}
</MyTag> />
)} )}
{/* Edit icon */} {/* Delete icon */}
{hasFormInput && !toolError && ( <Box className="hoverStyle" display={['flex', 'none']}>
<MyIconButton <MyIconButton
className="hoverStyle" icon="delete"
display={['flex', 'none']} hoverBg="red.50"
icon="common/setting" hoverColor="red.600"
onClick={() => setConfigTool(item)} onClick={(e) => {
/> e.stopPropagation();
)} onRemoveTool(item.pluginId!);
{/* Delete icon */} }}
<Box className="hoverStyle" display={['flex', 'none']} ml={0.5}> />
<MyIconButton </Box>
icon="delete" </Flex>
hoverBg="red.50" </Grid>
hoverColor="red.600"
onClick={(e) => {
e.stopPropagation();
onRemoveTool(item.pluginId!);
}}
/>
</Box>
</Flex>
</MyTooltip> </MyTooltip>
); );
})} })}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment