import loadable from '@loadable/component'
import React, { useEffect } from 'react'
import { Route, Routes } from 'react-router-dom'
import { StudioLoading } from '@/components/StudioEntrypoint'
import { TopbarBase } from '@/components/Topbar'
import { BASE_PATHS } from '@/config/routes'
import { isBrowserOutdated } from '@/utils/browser'
import { useDialog } from './providers/dialogs'
import { AdminView } from './views/admin'
import { LegalLayout } from './views/legal'
import { PlaygroundLayout } from './views/playground'
import { ViewerLayout } from './views/viewer/ViewerLayout'
const LoadableStudioLayout = loadable(() => import('./views/studio/StudioLayout'), {
fallback: (
<>
>
),
})
export const MainLayout: React.FC = () => {
const [openDialog, closeDialog] = useDialog({
title: 'Outdated browser detected',
description:
'It seems the browser version you are using is not fully supported by Joystream. Some of the features may be broken or not accessible. For the best experience, please upgrade your browser to the latest version.',
variant: 'warning',
primaryButton: {
text: 'Click here to see instructions',
onClick: () => window.open('https://www.whatismybrowser.com/guides/how-to-update-your-browser/auto'),
},
onExitClick: () => closeDialog(),
})
useEffect(() => {
if (isBrowserOutdated) {
openDialog()
}
}, [openDialog])
return (
} />
} />
} />
} />
} />
)
}