mirror of
https://github.com/suitenumerique/meet.git
synced 2026-08-11 19:27:50 +00:00
e9ef2bc4ae
it worked with codes but not full urls!
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import { useTranslation } from 'react-i18next'
|
|
import { Field, Ul, H, P, Form, Dialog } from '@/primitives'
|
|
import { navigateTo } from '@/navigation/navigateTo'
|
|
import { isRoomValid } from '@/features/rooms'
|
|
|
|
export const JoinMeetingDialog = () => {
|
|
const { t } = useTranslation('home')
|
|
return (
|
|
<Dialog title={t('joinMeeting')}>
|
|
<Form
|
|
onSubmit={(data) => {
|
|
navigateTo(
|
|
'room',
|
|
(data.roomId as string)
|
|
.trim()
|
|
.replace(`${window.location.origin}/`, '')
|
|
)
|
|
}}
|
|
submitLabel={t('joinInputSubmit')}
|
|
>
|
|
<Field
|
|
type="text"
|
|
name="roomId"
|
|
label={t('joinInputLabel')}
|
|
description={t('joinInputExample', {
|
|
example: 'https://meet.numerique.gouv.fr/azer-tyu-qsdf',
|
|
})}
|
|
validate={(value) => {
|
|
return !isRoomValid(value.trim()) ? (
|
|
<>
|
|
<p>{t('joinInputError')}</p>
|
|
<Ul>
|
|
<li>{window.location.origin}/uio-azer-jkl</li>
|
|
<li>uio-azer-jkl</li>
|
|
</Ul>
|
|
</>
|
|
) : null
|
|
}}
|
|
/>
|
|
</Form>
|
|
<H lvl={2}>{t('joinMeetingTipHeading')}</H>
|
|
<P last>{t('joinMeetingTipContent')}</P>
|
|
</Dialog>
|
|
)
|
|
}
|