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.

layout.tsx 819B

12345678910111213141516171819202122232425262728293031
  1. 'use client'
  2. import type { FC } from 'react'
  3. import React, { useEffect } from 'react'
  4. import { useRouter } from 'next/navigation'
  5. import { useTranslation } from 'react-i18next'
  6. import { useAppContext } from '@/context/app-context'
  7. import useDocumentTitle from '@/hooks/use-document-title'
  8. export type IAppDetail = {
  9. children: React.ReactNode
  10. }
  11. const AppDetail: FC<IAppDetail> = ({ children }) => {
  12. const router = useRouter()
  13. const { isCurrentWorkspaceDatasetOperator } = useAppContext()
  14. const { t } = useTranslation()
  15. useDocumentTitle(t('common.menus.appDetail'))
  16. useEffect(() => {
  17. if (isCurrentWorkspaceDatasetOperator)
  18. return router.replace('/datasets')
  19. }, [isCurrentWorkspaceDatasetOperator, router])
  20. return (
  21. <>
  22. {children}
  23. </>
  24. )
  25. }
  26. export default React.memo(AppDetail)