mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-15 22:06:52 +08:00
Chore: frontend infrastructure upgrade (#16420)
Co-authored-by: NFish <douxc512@gmail.com> Co-authored-by: zxhlyh <jasonapring2015@outlook.com> Co-authored-by: twwu <twwu@dify.ai> Co-authored-by: jZonG <jzongcode@gmail.com>
This commit is contained in:
@@ -43,11 +43,11 @@ const ContextMenu: FC<ContextMenuProps> = (props: ContextMenuProps) => {
|
||||
>
|
||||
<PortalToFollowElemTrigger>
|
||||
<Button size='small' className='px-1' onClick={handleClickTrigger}>
|
||||
<RiMoreFill className='w-4 h-4' />
|
||||
<RiMoreFill className='h-4 w-4' />
|
||||
</Button>
|
||||
</PortalToFollowElemTrigger>
|
||||
<PortalToFollowElemContent className='z-10'>
|
||||
<div className='flex flex-col w-[184px] rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur shadow-lg shadow-shadow-shadow-5 backdrop-blur-[5px]'>
|
||||
<div className='flex w-[184px] flex-col rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur shadow-lg shadow-shadow-shadow-5 backdrop-blur-[5px]'>
|
||||
<div className='flex flex-col p-1'>
|
||||
{
|
||||
options.map((option) => {
|
||||
@@ -64,7 +64,7 @@ const ContextMenu: FC<ContextMenuProps> = (props: ContextMenuProps) => {
|
||||
{
|
||||
isShowDelete && (
|
||||
<>
|
||||
<Divider type='horizontal' className='h-[1px] bg-divider-subtle my-0' />
|
||||
<Divider type='horizontal' className='my-0 h-[1px] bg-divider-subtle' />
|
||||
<div className='p-1'>
|
||||
<MenuItem
|
||||
item={deleteOperation}
|
||||
|
||||
@@ -19,7 +19,7 @@ const MenuItem: FC<MenuItemProps> = ({
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
'flex items-center justify-between px-2 py-1.5 cursor-pointer rounded-lg ',
|
||||
'flex cursor-pointer items-center justify-between rounded-lg px-2 py-1.5 ',
|
||||
isDestructive ? 'hover:bg-state-destructive-hover' : 'hover:bg-state-base-hover',
|
||||
)}
|
||||
onClick={() => {
|
||||
@@ -27,7 +27,7 @@ const MenuItem: FC<MenuItemProps> = ({
|
||||
}}
|
||||
>
|
||||
<div className={cn(
|
||||
'flex-1 text-text-primary system-md-regular',
|
||||
'system-md-regular flex-1 text-text-primary',
|
||||
isDestructive && 'hover:text-text-destructive',
|
||||
)}>
|
||||
{item.name}
|
||||
|
||||
@@ -21,10 +21,10 @@ const DeleteConfirmModal: FC<DeleteConfirmModalProps> = ({
|
||||
|
||||
return <Modal className='p-0' isShow={isOpen} onClose={onClose}>
|
||||
<div className='flex flex-col gap-y-2 p-6 pb-4 '>
|
||||
<div className='text-text-primary title-2xl-semi-bold'>
|
||||
<div className='title-2xl-semi-bold text-text-primary'>
|
||||
{`${t('common.operation.delete')} ${versionInfo.marked_name || t('workflow.versionHistory.defaultName')}`}
|
||||
</div>
|
||||
<p className='text-text-secondary system-md-regular'>
|
||||
<p className='system-md-regular text-text-secondary'>
|
||||
{t('workflow.versionHistory.deletionTip')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -12,11 +12,11 @@ const Empty: FC<EmptyProps> = ({
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
return <div className='h-5/6 w-full flex flex-col justify-center gap-y-2'>
|
||||
return <div className='flex h-5/6 w-full flex-col justify-center gap-y-2'>
|
||||
<div className='flex justify-center'>
|
||||
<RiHistoryLine className='w-10 h-10 text-text-empty-state-icon' />
|
||||
<RiHistoryLine className='h-10 w-10 text-text-empty-state-icon' />
|
||||
</div>
|
||||
<div className='flex justify-center text-text-tertiary system-xs-regular'>
|
||||
<div className='system-xs-regular flex justify-center text-text-tertiary'>
|
||||
{t('workflow.versionHistory.filter.empty')}
|
||||
</div>
|
||||
<div className='flex justify-center'>
|
||||
|
||||
@@ -18,13 +18,13 @@ const FilterItem: FC<FilterItemProps> = ({
|
||||
}) => {
|
||||
return (
|
||||
<div
|
||||
className='flex items-center justify-between gap-x-1 px-2 py-1.5 cursor-pointer rounded-lg hover:bg-state-base-hover'
|
||||
className='flex cursor-pointer items-center justify-between gap-x-1 rounded-lg px-2 py-1.5 hover:bg-state-base-hover'
|
||||
onClick={() => {
|
||||
onClick(item.key)
|
||||
}}
|
||||
>
|
||||
<div className='flex-1 text-text-primary system-md-regular'>{item.name}</div>
|
||||
{isSelected && <RiCheckLine className='w-4 h-4 text-text-accent shrink-0' />}
|
||||
<div className='system-md-regular flex-1 text-text-primary'>{item.name}</div>
|
||||
{isSelected && <RiCheckLine className='h-4 w-4 shrink-0 text-text-accent' />}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ const FilterSwitch: FC<FilterSwitchProps> = ({
|
||||
|
||||
return (
|
||||
<div className='flex items-center p-1'>
|
||||
<div className='flex items-center gap-x-1 w-full px-2 py-1.5'>
|
||||
<div className='flex-1 px-1 text-text-secondary system-md-regular'>
|
||||
<div className='flex w-full items-center gap-x-1 px-2 py-1.5'>
|
||||
<div className='system-md-regular flex-1 px-1 text-text-secondary'>
|
||||
{t('workflow.versionHistory.filter.onlyShowNamedVersions')}
|
||||
</div>
|
||||
<Switch
|
||||
|
||||
@@ -47,15 +47,15 @@ const Filter: FC<FilterProps> = ({
|
||||
<PortalToFollowElemTrigger onClick={() => setOpen(v => !v)}>
|
||||
<div
|
||||
className={cn(
|
||||
'flex items-center justify-center w-6 h-6 p-0.5 cursor-pointer rounded-md',
|
||||
'flex h-6 w-6 cursor-pointer items-center justify-center rounded-md p-0.5',
|
||||
isFiltering ? 'bg-state-accent-active-alt' : 'hover:bg-state-base-hover',
|
||||
)}
|
||||
>
|
||||
<RiFilter3Line className={cn('w-4 h-4', isFiltering ? 'text-text-accent' : ' text-text-tertiary')} />
|
||||
<RiFilter3Line className={cn('h-4 w-4', isFiltering ? 'text-text-accent' : ' text-text-tertiary')} />
|
||||
</div>
|
||||
</PortalToFollowElemTrigger>
|
||||
<PortalToFollowElemContent className='z-[12]'>
|
||||
<div className='flex flex-col w-[248px] rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur shadow-lg shadow-shadow-shadow-5 backdrop-blur-[5px]'>
|
||||
<div className='flex w-[248px] flex-col rounded-xl border-[0.5px] border-components-panel-border bg-components-panel-bg-blur shadow-lg shadow-shadow-shadow-5 backdrop-blur-[5px]'>
|
||||
<div className='flex flex-col p-1'>
|
||||
{
|
||||
options.map((option) => {
|
||||
@@ -70,7 +70,7 @@ const Filter: FC<FilterProps> = ({
|
||||
})
|
||||
}
|
||||
</div>
|
||||
<Divider type='horizontal' className='h-[1px] bg-divider-subtle my-0' />
|
||||
<Divider type='horizontal' className='my-0 h-[1px] bg-divider-subtle' />
|
||||
<FilterSwitch enabled={isOnlyShowNamedVersions} handleSwitch={handleSwitch} />
|
||||
</div>
|
||||
</PortalToFollowElemContent>
|
||||
|
||||
@@ -191,24 +191,24 @@ const VersionHistoryPanel = () => {
|
||||
}, [t, updateWorkflow, resetWorkflowVersionHistory])
|
||||
|
||||
return (
|
||||
<div className='flex flex-col w-[268px] bg-components-panel-bg rounded-l-2xl border-y-[0.5px] border-l-[0.5px] border-components-panel-border shadow-xl shadow-shadow-shadow-5'>
|
||||
<div className='flex w-[268px] flex-col rounded-l-2xl border-y-[0.5px] border-l-[0.5px] border-components-panel-border bg-components-panel-bg shadow-xl shadow-shadow-shadow-5'>
|
||||
<div className='flex items-center gap-x-2 px-4 pt-3'>
|
||||
<div className='flex-1 py-1 text-text-primary system-xl-semibold'>{t('workflow.versionHistory.title')}</div>
|
||||
<div className='system-xl-semibold flex-1 py-1 text-text-primary'>{t('workflow.versionHistory.title')}</div>
|
||||
<Filter
|
||||
filterValue={filterValue}
|
||||
isOnlyShowNamedVersions={isOnlyShowNamedVersions}
|
||||
onClickFilterItem={handleClickFilterItem}
|
||||
handleSwitch={handleSwitch}
|
||||
/>
|
||||
<Divider type='vertical' className='h-3.5 mx-1' />
|
||||
<Divider type='vertical' className='mx-1 h-3.5' />
|
||||
<div
|
||||
className='flex items-center justify-center w-6 h-6 p-0.5 cursor-pointer'
|
||||
className='flex h-6 w-6 cursor-pointer items-center justify-center p-0.5'
|
||||
onClick={handleClose}
|
||||
>
|
||||
<RiCloseLine className='w-4 h-4 text-text-tertiary' />
|
||||
<RiCloseLine className='h-4 w-4 text-text-tertiary' />
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex-1 relative px-3 py-2 overflow-y-auto">
|
||||
<div className="relative flex-1 overflow-y-auto px-3 py-2">
|
||||
{(isFetching && !versionHistory?.pages?.length)
|
||||
? (
|
||||
<Loading />
|
||||
@@ -230,18 +230,18 @@ const VersionHistoryPanel = () => {
|
||||
})
|
||||
))}
|
||||
{hasNextPage && (
|
||||
<div className='flex absolute bottom-2 left-2 p-2'>
|
||||
<div className='absolute bottom-2 left-2 flex p-2'>
|
||||
<div
|
||||
className='flex items-center gap-x-1 cursor-pointer'
|
||||
className='flex cursor-pointer items-center gap-x-1'
|
||||
onClick={handleNextPage}
|
||||
>
|
||||
<div className='flex item-center justify-center p-0.5'>
|
||||
<div className='item-center flex justify-center p-0.5'>
|
||||
{
|
||||
isFetching
|
||||
? <RiLoader2Line className='w-3.5 h-3.5 text-text-accent animate-spin' />
|
||||
: <RiArrowDownDoubleLine className='w-3.5 h-3.5 text-text-accent' />}
|
||||
? <RiLoader2Line className='h-3.5 w-3.5 animate-spin text-text-accent' />
|
||||
: <RiArrowDownDoubleLine className='h-3.5 w-3.5 text-text-accent' />}
|
||||
</div>
|
||||
<div className='py-[1px] text-text-accent system-xs-medium-uppercase'>
|
||||
<div className='system-xs-medium-uppercase py-[1px] text-text-accent'>
|
||||
{t('workflow.common.loadMore')}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -11,7 +11,7 @@ const itemConfig = Array.from({ length: 8 }).map((_, index) => {
|
||||
|
||||
const Loading = () => {
|
||||
return <div className='relative w-full overflow-y-hidden'>
|
||||
<div className='absolute z-10 top-0 left-0 w-full h-full bg-dataset-chunk-list-mask-bg' />
|
||||
<div className='absolute left-0 top-0 z-10 h-full w-full bg-dataset-chunk-list-mask-bg' />
|
||||
{itemConfig.map((config, index) => <Item key={index} {...config} />)}
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -15,19 +15,19 @@ const Item: FC<ItemProps> = ({
|
||||
isLast,
|
||||
}) => {
|
||||
return (
|
||||
<div className='flex gap-x-1 relative p-2' >
|
||||
{!isLast && <div className='absolute w-0.5 h-[calc(100%-0.75rem)] left-4 top-6 bg-divider-subtle' />}
|
||||
<div className=' flex items-center justify-center shrink-0 w-[18px] h-5'>
|
||||
<div className='w-2 h-2 border-[2px] rounded-lg border-text-quaternary' />
|
||||
<div className='relative flex gap-x-1 p-2' >
|
||||
{!isLast && <div className='absolute left-4 top-6 h-[calc(100%-0.75rem)] w-0.5 bg-divider-subtle' />}
|
||||
<div className=' flex h-5 w-[18px] shrink-0 items-center justify-center'>
|
||||
<div className='h-2 w-2 rounded-lg border-[2px] border-text-quaternary' />
|
||||
</div>
|
||||
<div className='flex flex-col grow gap-y-0.5'>
|
||||
<div className='flex items-center h-3.5'>
|
||||
<div className={cn('h-2 w-full bg-text-quaternary rounded-sm opacity-20', titleWidth)} />
|
||||
<div className='flex grow flex-col gap-y-0.5'>
|
||||
<div className='flex h-3.5 items-center'>
|
||||
<div className={cn('h-2 w-full rounded-sm bg-text-quaternary opacity-20', titleWidth)} />
|
||||
</div>
|
||||
{
|
||||
!isFirst && (
|
||||
<div className='flex items-center h-3'>
|
||||
<div className={cn('h-1.5 w-full bg-text-quaternary rounded-sm opacity-20', releaseNotesWidth)} />
|
||||
<div className='flex h-3 items-center'>
|
||||
<div className={cn('h-1.5 w-full rounded-sm bg-text-quaternary opacity-20', releaseNotesWidth)} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@ const RestoreConfirmModal: FC<RestoreConfirmModalProps> = ({
|
||||
|
||||
return <Modal className='p-0' isShow={isOpen} onClose={onClose}>
|
||||
<div className='flex flex-col gap-y-2 p-6 pb-4 '>
|
||||
<div className='text-text-primary title-2xl-semi-bold'>
|
||||
<div className='title-2xl-semi-bold text-text-primary'>
|
||||
{`${t('workflow.common.restore')} ${versionInfo.marked_name || t('workflow.versionHistory.defaultName')}`}
|
||||
</div>
|
||||
<p className='text-text-secondary system-md-regular'>
|
||||
<p className='system-md-regular text-text-secondary'>
|
||||
{t('workflow.versionHistory.restorationTip')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -67,8 +67,8 @@ const VersionHistoryItem: React.FC<VersionHistoryItemProps> = ({
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
'flex gap-x-1 relative p-2 rounded-lg group',
|
||||
isSelected ? 'bg-state-accent-active cursor-not-allowed' : 'hover:bg-state-base-hover cursor-pointer',
|
||||
'group relative flex gap-x-1 rounded-lg p-2',
|
||||
isSelected ? 'cursor-not-allowed bg-state-accent-active' : 'cursor-pointer hover:bg-state-base-hover',
|
||||
)}
|
||||
onClick={handleClickItem}
|
||||
onMouseEnter={() => setIsHovering(true)}
|
||||
@@ -81,38 +81,38 @@ const VersionHistoryItem: React.FC<VersionHistoryItemProps> = ({
|
||||
setOpen(true)
|
||||
}}
|
||||
>
|
||||
{!isLast && <div className='absolute w-0.5 h-[calc(100%-0.75rem)] left-4 top-6 bg-divider-subtle' />}
|
||||
<div className=' flex items-center justify-center shrink-0 w-[18px] h-5'>
|
||||
{!isLast && <div className='absolute left-4 top-6 h-[calc(100%-0.75rem)] w-0.5 bg-divider-subtle' />}
|
||||
<div className=' flex h-5 w-[18px] shrink-0 items-center justify-center'>
|
||||
<div className={cn(
|
||||
'w-2 h-2 border-[2px] rounded-lg',
|
||||
'h-2 w-2 rounded-lg border-[2px]',
|
||||
isSelected ? 'border-text-accent' : 'border-text-quaternary',
|
||||
)}/>
|
||||
</div>
|
||||
<div className='flex flex-col gap-y-0.5 grow overflow-hidden'>
|
||||
<div className='flex items-center gap-x-1 h-5 mr-6'>
|
||||
<div className='flex grow flex-col gap-y-0.5 overflow-hidden'>
|
||||
<div className='mr-6 flex h-5 items-center gap-x-1'>
|
||||
<div className={cn(
|
||||
'py-[1px] system-sm-semibold truncate',
|
||||
'system-sm-semibold truncate py-[1px]',
|
||||
isSelected ? 'text-text-accent' : 'text-text-secondary',
|
||||
)}>
|
||||
{isDraft ? t('workflow.versionHistory.currentDraft') : item.marked_name || t('workflow.versionHistory.defaultName')}
|
||||
</div>
|
||||
{isLatest && (
|
||||
<div className='flex items-center shrink-0 h-5 px-[5px] rounded-md border border-text-accent-secondary
|
||||
bg-components-badge-bg-dimm text-text-accent-secondary system-2xs-medium-uppercase'>
|
||||
<div className='system-2xs-medium-uppercase flex h-5 shrink-0 items-center rounded-md border border-text-accent-secondary
|
||||
bg-components-badge-bg-dimm px-[5px] text-text-accent-secondary'>
|
||||
{t('workflow.versionHistory.latest')}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{
|
||||
!isDraft && (
|
||||
<div className='text-text-secondary system-xs-regular break-words'>
|
||||
<div className='system-xs-regular break-words text-text-secondary'>
|
||||
{item.marked_comment || ''}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
{
|
||||
!isDraft && (
|
||||
<div className='text-text-tertiary system-xs-regular truncate'>
|
||||
<div className='system-xs-regular truncate text-text-tertiary'>
|
||||
{`${formatTime(item.created_at)} · ${item.created_by.name}`}
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user