You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.tsx 1010B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { useCallback, useMemo, useState } from 'react'
  2. import Tab from './tab'
  3. import BuiltInPipelineList from './built-in-pipeline-list'
  4. import CustomizedList from './customized-list'
  5. import { useTranslation } from 'react-i18next'
  6. const List = () => {
  7. const { t } = useTranslation()
  8. const [activeTab, setActiveTab] = useState('built-in')
  9. const options = useMemo(() => {
  10. return [
  11. { value: 'built-in', label: t('datasetPipeline.tabs.builtInPipeline') },
  12. { value: 'customized', label: t('datasetPipeline.tabs.customized') },
  13. ]
  14. }, [t])
  15. const handleTabChange = useCallback((tab: string) => {
  16. setActiveTab(tab)
  17. }, [])
  18. return (
  19. <div className='flex grow flex-col'>
  20. <Tab
  21. activeTab={activeTab}
  22. handleTabChange={handleTabChange}
  23. options={options}
  24. />
  25. {
  26. activeTab === 'built-in' && <BuiltInPipelineList />
  27. }
  28. {
  29. activeTab === 'customized' && <CustomizedList />
  30. }
  31. </div>
  32. )
  33. }
  34. export default List