import React from 'react' import { useTranslation } from 'react-i18next' import AppIcon from '../base/app-icon' import Tooltip from '@/app/components/base/tooltip' import { Code, WindowCursor, } from '@/app/components/base/icons/src/vender/workflow' export type IAppBasicProps = { iconType?: 'app' | 'api' | 'dataset' | 'webapp' | 'notion' icon?: string icon_background?: string | null isExternal?: boolean name: string type: string | React.ReactNode hoverTip?: string textStyle?: { main?: string; extra?: string } isExtraInLine?: boolean mode?: string hideType?: boolean } const DatasetSvg = const NotionSvg = const ICON_MAP = { app: , api:
, dataset: , webapp:
, notion: , } export default function AppBasic({ icon, icon_background, name, isExternal, type, hoverTip, textStyle, isExtraInLine, mode = 'expand', iconType = 'app', hideType }: IAppBasicProps) { const { t } = useTranslation() return (
{icon && icon_background && iconType === 'app' && (
)} {iconType !== 'app' &&
{ICON_MAP[iconType]}
} {mode === 'expand' &&
{name}
{hoverTip && {hoverTip}
} popupClassName='ml-1' triggerClassName='w-4 h-4 ml-1' position='top' /> }
{!hideType && isExtraInLine && (
{type}
)} {!hideType && !isExtraInLine && (
{isExternal ? t('dataset.externalTag') : type}
)}
} ) }