16
16
17
17
'use client'
18
18
19
- import { useEffect } from 'react'
20
- import StartConferenceButton from "@/components/conference/StartConferenceButton" ;
21
- import CopyConferenceInfoButton from "@/components/conference/CopyConferenceInfoButton" ;
19
+ import { createContext , useEffect , useState } from 'react'
22
20
import { useGetOrCreateInstantMeeting } from "@/components/conference/useGetOrCreateInstantMeeting" ;
23
- import VideoTestButton from "@/components/conference/VideoTestButton" ;
24
21
import { useSnackbar } from "@/contexts/Snackbar/SnackbarContext" ;
25
22
import { useAuth } from "@/contexts/Auth/AuthProvider" ;
26
23
import { isVarTrue } from "@/lib/isVarTrue" ;
27
- import { Stack } from "@mui/material" ;
24
+ import { Card , Stack } from "@mui/material" ;
25
+ import ConferenceNameField from "@/components/conference/ConferenceNameField" ;
26
+ import StartConferenceButton from "@/components/conference/StartConferenceButton" ;
27
+ import CopyConferenceInfoButton from "@/components/conference/CopyConferenceInfoButton" ;
28
+ import VideoTestButton from "@/components/conference/VideoTestButton" ;
29
+ import { Meeting } from "@/types/types" ;
28
30
import "../../../i18n"
29
31
32
+ export type MeetingContext = {
33
+ meeting : Meeting | undefined ,
34
+ nameHasChanged : boolean ,
35
+ setNameHasChanged : ( val : boolean ) => void ,
36
+ }
37
+
38
+
39
+ export const ConferenceContext = createContext < MeetingContext | null > ( null ) ;
40
+
30
41
function ConferenceActions ( ) {
31
42
32
43
const {
@@ -35,10 +46,13 @@ function ConferenceActions() {
35
46
} ,
36
47
} = useAuth ( ) ;
37
48
49
+
38
50
const isVideoTestEnabled = isVarTrue ( NEXT_PUBLIC_VIDEO_TEST_ENABLED ) ;
39
51
40
52
const { meeting, isLoading, error, getOrCreateMeeting } = useGetOrCreateInstantMeeting ( ) ;
41
53
54
+ const [ nameHasChanged , setNameHasChanged ] = useState ( false ) ;
55
+
42
56
const { showSnackbar } = useSnackbar ( ) ;
43
57
44
58
useEffect ( ( ) => {
@@ -56,20 +70,26 @@ function ConferenceActions() {
56
70
57
71
return (
58
72
< >
59
- < Stack className = "space-y-6 w-full items-center justify-center" >
60
- < Stack className = "w-1/4" >
61
- < StartConferenceButton meeting = { meeting } />
62
- </ Stack >
63
- < Stack className = { "" } > </ Stack >
64
- < Stack className = "w-1/6" >
65
- < CopyConferenceInfoButton meeting = { meeting } />
66
- </ Stack >
67
- { isVideoTestEnabled &&
68
- < Stack className = "w-1/6" >
69
- < VideoTestButton />
73
+ < ConferenceContext . Provider value = { { meeting, nameHasChanged, setNameHasChanged } } >
74
+ < Card variant = "outlined" className = { 'w-2/3 p-4' } >
75
+ < Stack className = "space-y-6 w-full items-center justify-center" >
76
+ < Stack className = "w-1/3" >
77
+ < ConferenceNameField />
78
+ </ Stack >
79
+ < Stack className = "w-1/3" >
80
+ < StartConferenceButton />
81
+ </ Stack >
82
+ < Stack className = "w-1/4" >
83
+ < CopyConferenceInfoButton meeting = { meeting } />
84
+ </ Stack >
85
+ { isVideoTestEnabled &&
86
+ < Stack className = "w-1/4" >
87
+ < VideoTestButton />
88
+ </ Stack >
89
+ }
70
90
</ Stack >
71
- }
72
- </ Stack >
91
+ </ Card >
92
+ </ ConferenceContext . Provider >
73
93
</ >
74
94
)
75
95
}
0 commit comments