diff --git a/src/frontend/src/App.tsx b/src/frontend/src/App.tsx index 45b14798..9a055d34 100644 --- a/src/frontend/src/App.tsx +++ b/src/frontend/src/App.tsx @@ -5,12 +5,11 @@ import { ReactQueryDevtools } from '@tanstack/react-query-devtools' import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { useTranslation } from 'react-i18next' import { useLang } from 'hoofd' -import { Route, Switch } from 'wouter' -import { HomeRoute } from '@/features/home' -import { RoomRoute, roomRouteRegex } from '@/features/rooms' -import { NotFound } from './routes/NotFound' -import './i18n/init' +import { Switch, Route } from 'wouter' +import { NotFoundScreen } from './layout/NotFoundScreen' import { RenderIfUserFetched } from './features/auth' +import { routes } from './routes' +import './i18n/init' const queryClient = new QueryClient() @@ -22,9 +21,10 @@ function App() { - - - + {Object.entries(routes).map(([, route], i) => ( + + ))} + diff --git a/src/frontend/src/features/home/components/JoinMeetingDialog.tsx b/src/frontend/src/features/home/components/JoinMeetingDialog.tsx index 31a5f01a..fc2f5d45 100644 --- a/src/frontend/src/features/home/components/JoinMeetingDialog.tsx +++ b/src/frontend/src/features/home/components/JoinMeetingDialog.tsx @@ -1,6 +1,7 @@ import { useTranslation } from 'react-i18next' import { Field, Ul, H, P, Form, Dialog } from '@/primitives' -import { isRoomValid, navigateToRoom } from '@/features/rooms' +import { navigateTo } from '@/navigation/navigateTo' +import { isRoomValid } from '@/features/rooms' export const JoinMeetingDialog = () => { const { t } = useTranslation('home') @@ -8,7 +9,7 @@ export const JoinMeetingDialog = () => {
{ - navigateToRoom((data.roomId as string).trim()) + navigateTo('room', data.roomId as string) }} submitLabel={t('joinInputSubmit')} > diff --git a/src/frontend/src/features/home/index.ts b/src/frontend/src/features/home/index.ts index 0d677a0d..bda6a40d 100644 --- a/src/frontend/src/features/home/index.ts +++ b/src/frontend/src/features/home/index.ts @@ -1,2 +1 @@ -export { navigateToHome } from './navigation/navigateToHome' export { Home as HomeRoute } from './routes/Home' diff --git a/src/frontend/src/features/home/navigation/navigateToHome.ts b/src/frontend/src/features/home/navigation/navigateToHome.ts deleted file mode 100644 index 42f84d16..00000000 --- a/src/frontend/src/features/home/navigation/navigateToHome.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { navigate } from 'wouter/use-browser-location' - -export const navigateToHome = () => { - navigate(`/`) -} diff --git a/src/frontend/src/features/home/routes/Home.tsx b/src/frontend/src/features/home/routes/Home.tsx index f4f9274d..86ced491 100644 --- a/src/frontend/src/features/home/routes/Home.tsx +++ b/src/frontend/src/features/home/routes/Home.tsx @@ -2,8 +2,9 @@ import { useTranslation } from 'react-i18next' import { DialogTrigger } from 'react-aria-components' import { Button, Div, Text, VerticallyOffCenter } from '@/primitives' import { HStack } from '@/styled-system/jsx' +import { navigateTo } from '@/navigation/navigateTo' +import { generateRoomId } from '@/features/rooms' import { authUrl, useUser } from '@/features/auth' -import { navigateToNewRoom } from '@/features/rooms' import { Screen } from '@/layout/Screen' import { JoinMeetingDialog } from '../components/JoinMeetingDialog' @@ -28,7 +29,11 @@ export const Home = () => {