diff --git a/src/frontend/src/features/home/components/JoinMeetingDialog.tsx b/src/frontend/src/features/home/components/JoinMeetingDialog.tsx new file mode 100644 index 00000000..783fd9b7 --- /dev/null +++ b/src/frontend/src/features/home/components/JoinMeetingDialog.tsx @@ -0,0 +1,39 @@ +import { useTranslation } from 'react-i18next' +import { Div, Field, Ul, H, P, Form } from '@/primitives' +import { isRoomValid, navigateToRoom } from '@/features/rooms' + +export const JoinMeetingDialog = () => { + const { t } = useTranslation('home') + return ( +
+
{ + navigateToRoom((data.roomId as string).trim()) + }} + submitLabel={t('joinInputSubmit')} + > + { + return !isRoomValid(value.trim()) ? ( + <> +

{t('joinInputError')}

+
    +
  • {window.location.origin}/uio-azer-jkl
  • +
  • uio-azer-jkl
  • +
+ + ) : null + }} + /> + + {t('joinMeetingTipHeading')} +

{t('joinMeetingTipContent')}

+
+ ) +} diff --git a/src/frontend/src/features/home/routes/Home.tsx b/src/frontend/src/features/home/routes/Home.tsx index c55b3d32..f54f13d2 100644 --- a/src/frontend/src/features/home/routes/Home.tsx +++ b/src/frontend/src/features/home/routes/Home.tsx @@ -1,21 +1,10 @@ import { useTranslation } from 'react-i18next' -import { navigate } from 'wouter/use-browser-location' -import { - Button, - P, - Div, - Text, - H, - VerticallyOffCenter, - Dialog, - Form, - Field, - Ul, -} from '@/primitives' +import { Button, Div, Text, VerticallyOffCenter, Dialog } from '@/primitives' import { HStack } from '@/styled-system/jsx' import { authUrl, useUser } from '@/features/auth' -import { isRoomValid, navigateToNewRoom } from '@/features/rooms' +import { navigateToNewRoom } from '@/features/rooms' import { Screen } from '@/layout/Screen' +import { JoinMeetingDialog } from '../components/JoinMeetingDialog' export const Home = () => { const { t } = useTranslation('home') @@ -48,7 +37,7 @@ export const Home = () => { - + @@ -56,39 +45,3 @@ export const Home = () => { ) } - -const JoinMeetingDialogContent = () => { - const { t } = useTranslation('home') - return ( -
-
{ - navigate(`/${(data.roomId as string).trim()}`) - }} - submitLabel={t('joinInputSubmit')} - > - { - return !isRoomValid(value.trim()) ? ( - <> -

{t('joinInputError')}

-
    -
  • {window.location.origin}/uio-azer-jkl
  • -
  • uio-azer-jkl
  • -
- - ) : null - }} - /> - - {t('joinMeetingTipHeading')} -

{t('joinMeetingTipContent')}

-
- ) -} diff --git a/src/frontend/src/features/rooms/index.ts b/src/frontend/src/features/rooms/index.ts index 92a3af13..e138fa98 100644 --- a/src/frontend/src/features/rooms/index.ts +++ b/src/frontend/src/features/rooms/index.ts @@ -1,3 +1,4 @@ export { navigateToNewRoom } from './navigation/navigateToNewRoom' +export { navigateToRoom } from './navigation/navigateToRoom' export { Room as RoomRoute } from './routes/Room' export { roomRouteRegex, isRoomValid } from './utils/isRoomValid' diff --git a/src/frontend/src/features/rooms/navigation/navigateToRoom.ts b/src/frontend/src/features/rooms/navigation/navigateToRoom.ts new file mode 100644 index 00000000..cde5bad5 --- /dev/null +++ b/src/frontend/src/features/rooms/navigation/navigateToRoom.ts @@ -0,0 +1,5 @@ +import { navigate } from 'wouter/use-browser-location' + +export const navigateToRoom = (roomId: string) => { + navigate(`/${roomId}`) +}