import { useTranslation } from 'react-i18next' import { BLOCKS, START_BLOCKS } from './constants' import { TabsEnum, ToolTypeEnum, } from './types' export const useBlocks = () => { const { t } = useTranslation() return BLOCKS.map((block) => { return { ...block, title: t(`workflow.blocks.${block.type}`), } }) } export const useStartBlocks = () => { const { t } = useTranslation() return START_BLOCKS.map((block) => { return { ...block, title: t(`workflow.blocks.${block.type}`), } }) } export const useTabs = (showStartTab = false) => { const { t } = useTranslation() const tabs = [ { key: TabsEnum.Blocks, name: t('workflow.tabs.blocks'), }, { key: TabsEnum.Tools, name: t('workflow.tabs.tools'), }, ] if (showStartTab) { tabs.push({ key: TabsEnum.Start, name: t('workflow.tabs.start'), }) } return tabs } export const useToolTabs = (isHideMCPTools?: boolean) => { const { t } = useTranslation() const tabs = [ { key: ToolTypeEnum.All, name: t('workflow.tabs.allTool'), }, { key: ToolTypeEnum.BuiltIn, name: t('workflow.tabs.plugin'), }, { key: ToolTypeEnum.Custom, name: t('workflow.tabs.customTool'), }, { key: ToolTypeEnum.Workflow, name: t('workflow.tabs.workflowTool'), }, ] if(!isHideMCPTools) { tabs.push({ key: ToolTypeEnum.MCP, name: 'MCP', }) } return tabs }