hooks.ts 652 B

12345678910111213141516171819202122232425262728293031323334
  1. import { useTranslation } from 'react-i18next'
  2. import { BLOCKS } from './constants'
  3. import { TabsEnum } from './types'
  4. export const useBlocks = () => {
  5. const { t } = useTranslation()
  6. return BLOCKS.map((block) => {
  7. return {
  8. ...block,
  9. title: t(`workflow.blocks.${block.type}`),
  10. }
  11. })
  12. }
  13. export const useTabs = () => {
  14. const { t } = useTranslation()
  15. return [
  16. {
  17. key: TabsEnum.Blocks,
  18. name: t('workflow.tabs.blocks'),
  19. },
  20. {
  21. key: TabsEnum.BuiltInTool,
  22. name: t('workflow.tabs.builtInTool'),
  23. },
  24. {
  25. key: TabsEnum.CustomTool,
  26. name: t('workflow.tabs.customTool'),
  27. },
  28. ]
  29. }