page.tsx 935 B

12345678910111213141516171819202122232425262728
  1. 'use client'
  2. import type { FC } from 'react'
  3. import { useRouter } from 'next/navigation'
  4. import { useTranslation } from 'react-i18next'
  5. import React, { useEffect } from 'react'
  6. import ToolProviderList from '@/app/components/tools/provider-list'
  7. import { useAppContext } from '@/context/app-context'
  8. const Layout: FC = () => {
  9. const { t } = useTranslation()
  10. const router = useRouter()
  11. const { isCurrentWorkspaceDatasetOperator } = useAppContext()
  12. useEffect(() => {
  13. if (typeof window !== 'undefined')
  14. document.title = `${t('tools.title')} - 智脑云平台`
  15. if (isCurrentWorkspaceDatasetOperator)
  16. return router.replace('/datasets')
  17. }, [isCurrentWorkspaceDatasetOperator, router, t])
  18. useEffect(() => {
  19. if (isCurrentWorkspaceDatasetOperator)
  20. return router.replace('/datasets')
  21. }, [isCurrentWorkspaceDatasetOperator, router])
  22. return <ToolProviderList />
  23. }
  24. export default React.memo(Layout)