Parcourir la source

refactor: update BlockIcon component to handle Tool and DataSource types for conditional rendering

tags/2.0.0-beta.1
twwu il y a 3 mois
Parent
révision
3e187ba6aa
1 fichiers modifiés avec 5 ajouts et 3 suppressions
  1. 5
    3
      web/app/components/workflow/block-icon.tsx

+ 5
- 3
web/app/components/workflow/block-icon.tsx Voir le fichier

className, className,
toolIcon, toolIcon,
}) => { }) => {
const isToolOrDataSource = type === BlockEnum.Tool || type === BlockEnum.DataSource

return ( return (
<div className={ <div className={
cn( cn(
'flex items-center justify-center border-[0.5px] border-white/2 text-white', 'flex items-center justify-center border-[0.5px] border-white/2 text-white',
ICON_CONTAINER_CLASSNAME_SIZE_MAP[size], ICON_CONTAINER_CLASSNAME_SIZE_MAP[size],
!toolIcon && ICON_CONTAINER_BG_COLOR_MAP[type],
!isToolOrDataSource && ICON_CONTAINER_BG_COLOR_MAP[type],
toolIcon && '!shadow-none', toolIcon && '!shadow-none',
className, className,
)} )}
> >
{ {
type !== BlockEnum.Tool && (
!isToolOrDataSource && (
getIcon(type, size === 'xs' ? 'w-3 h-3' : 'w-3.5 h-3.5') getIcon(type, size === 'xs' ? 'w-3 h-3' : 'w-3.5 h-3.5')
) )
} }
{ {
(type === BlockEnum.Tool || type === BlockEnum.DataSource) && toolIcon && (
isToolOrDataSource && toolIcon && (
<> <>
{ {
typeof toolIcon === 'string' typeof toolIcon === 'string'

Chargement…
Annuler
Enregistrer