refactor(web): Restructure the operation buttons layout in the app information component (#21742)

- Display the import DSL and switch app buttons directly on the interface, no longer hiding them in the more options menu
pull/21818/head
zhujiruo 11 months ago
parent 0c39490bb1
commit 9afc3e982a

@ -10,7 +10,6 @@ import {
RiFileCopy2Line, RiFileCopy2Line,
RiFileDownloadLine, RiFileDownloadLine,
RiFileUploadLine, RiFileUploadLine,
RiMoreLine,
} from '@remixicon/react' } from '@remixicon/react'
import AppIcon from '../base/app-icon' import AppIcon from '../base/app-icon'
import SwitchAppModal from '../app/switch-app-modal' import SwitchAppModal from '../app/switch-app-modal'
@ -35,7 +34,6 @@ import ContentDialog from '@/app/components/base/content-dialog'
import Button from '@/app/components/base/button' import Button from '@/app/components/base/button'
import CardView from '@/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/cardView' import CardView from '@/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/cardView'
import Divider from '../base/divider' import Divider from '../base/divider'
import { PortalToFollowElem, PortalToFollowElemContent, PortalToFollowElemTrigger } from '../base/portal-to-follow-elem'
export type IAppInfoProps = { export type IAppInfoProps = {
expand: boolean expand: boolean
@ -186,11 +184,6 @@ const AppInfo = ({ expand, onlyShowDetail = false, openState = false, onDetailEx
const { isCurrentWorkspaceEditor } = useAppContext() const { isCurrentWorkspaceEditor } = useAppContext()
const [showMore, setShowMore] = useState(false)
const handleTriggerMore = useCallback(() => {
setShowMore(true)
}, [setShowMore])
if (!appDetail) if (!appDetail)
return null return null
@ -294,52 +287,42 @@ const AppInfo = ({ expand, onlyShowDetail = false, openState = false, onDetailEx
<RiFileDownloadLine className='h-3.5 w-3.5 text-components-button-secondary-text' /> <RiFileDownloadLine className='h-3.5 w-3.5 text-components-button-secondary-text' />
<span className='system-xs-medium text-components-button-secondary-text'>{t('app.export')}</span> <span className='system-xs-medium text-components-button-secondary-text'>{t('app.export')}</span>
</Button> </Button>
{appDetail.mode !== 'agent-chat' && <PortalToFollowElem {appDetail.mode !== 'agent-chat'
open={showMore} && <>
onOpenChange={setShowMore} {
placement='bottom-end' (appDetail.mode === 'advanced-chat' || appDetail.mode === 'workflow')
offset={{ && <Button
mainAxis: 4,
}}>
<PortalToFollowElemTrigger onClick={handleTriggerMore}>
<Button
size={'small'} size={'small'}
variant={'secondary'} variant={'secondary'}
className='gap-[1px]' className='gap-[1px]'
>
<RiMoreLine className='h-3.5 w-3.5 text-components-button-secondary-text' />
<span className='system-xs-medium text-components-button-secondary-text'>{t('common.operation.more')}</span>
</Button>
</PortalToFollowElemTrigger>
<PortalToFollowElemContent className='z-[21]'>
<div className='flex w-[264px] flex-col rounded-[12px] border-[0.5px] border-components-panel-border bg-components-panel-bg-blur p-1 shadow-lg backdrop-blur-[5px]'>
{
(appDetail.mode === 'advanced-chat' || appDetail.mode === 'workflow')
&& <div className='flex h-8 cursor-pointer items-center gap-x-1 rounded-lg p-1.5 hover:bg-state-base-hover'
onClick={() => { onClick={() => {
setOpen(false) setOpen(false)
onDetailExpand?.(false) onDetailExpand?.(false)
setShowImportDSLModal(true) setShowImportDSLModal(true)
}}> }}
<RiFileUploadLine className='h-4 w-4 text-text-tertiary' /> >
<span className='system-md-regular text-text-secondary'>{t('workflow.common.importDSL')}</span> <RiFileUploadLine className='h-3.5 w-3.5 text-components-button-secondary-text' />
</div> <span className='system-xs-medium text-components-button-secondary-text'>{t('workflow.common.importDSL')}</span>
</Button>
} }
{ {
(appDetail.mode === 'completion' || appDetail.mode === 'chat') (appDetail.mode === 'completion' || appDetail.mode === 'chat')
&& <div className='flex h-8 cursor-pointer items-center gap-x-1 rounded-lg p-1.5 hover:bg-state-base-hover' && <Button
size={'small'}
variant={'secondary'}
className='gap-[1px]'
onClick={() => { onClick={() => {
setOpen(false) setOpen(false)
onDetailExpand?.(false) onDetailExpand?.(false)
setShowSwitchModal(true) setShowSwitchModal(true)
}}> }}
<RiExchange2Line className='h-4 w-4 text-text-tertiary' /> >
<span className='system-md-regular text-text-secondary'>{t('app.switch')}</span> <RiExchange2Line className='h-3.5 w-3.5 text-components-button-secondary-text' />
</div> <span className='system-xs-medium text-components-button-secondary-text'>{t('app.switch')}</span>
</Button>
}
</>
} }
</div>
</PortalToFollowElemContent>
</PortalToFollowElem>}
</div> </div>
</div> </div>
<div className='flex flex-1'> <div className='flex flex-1'>

Loading…
Cancel
Save