mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 09:09:36 +02:00
46 lines
1.5 KiB
TypeScript
46 lines
1.5 KiB
TypeScript
import useWaitForI18n from '@/shared/hooks/use-wait-for-i18n'
|
|
import withErrorBoundary from '@/infrastructure/error-boundary'
|
|
import { GenericErrorBoundaryFallback } from '@/shared/components/generic-error-boundary-fallback'
|
|
import { SplitTestProvider } from '@/shared/context/split-test-context'
|
|
import { UserSettingsProvider } from '@/shared/context/user-settings-context'
|
|
import { UsersPageProvider, useUsersPageContext } from './users-page-context.tsx'
|
|
import { UserListProvider } from './user-list/context/user-list-context'
|
|
import UserListRoot from './user-list/components/user-list-root'
|
|
import { ProjectListProvider } from './project-list/context/project-list-context'
|
|
import ProjectListRoot from './project-list/components/project-list-root'
|
|
|
|
function UsersPageSelector() {
|
|
const { page } = useUsersPageContext()
|
|
|
|
if (page.type === 'projects') {
|
|
return (
|
|
<ProjectListProvider projectsOwnerId={page.userId}>
|
|
<ProjectListRoot />
|
|
</ProjectListProvider>
|
|
)
|
|
}
|
|
return <UserListRoot />
|
|
}
|
|
|
|
function ManageUsersRoot() {
|
|
const { isReady } = useWaitForI18n()
|
|
|
|
if (!isReady) return null
|
|
|
|
return (
|
|
<UsersPageProvider>
|
|
<UserListProvider>
|
|
<SplitTestProvider>
|
|
<UserSettingsProvider>
|
|
<UsersPageSelector />
|
|
</UserSettingsProvider>
|
|
</SplitTestProvider>
|
|
</UserListProvider>
|
|
</UsersPageProvider>
|
|
)
|
|
}
|
|
|
|
export default withErrorBoundary(ManageUsersRoot, () => (
|
|
<GenericErrorBoundaryFallback />
|
|
))
|