1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < link rel ="stylesheet " href ="styles.css ">
5
+ <!-- <link rel="stylesheet" href="formStyle.css"> -->
6
+ < meta charset ="UTF-8 ">
7
+ < meta http-equiv ="X-UA-Compatible " content ="IE=edge ">
8
+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
9
+ < script src ="https://code.iconify.design/2/2.0.3/iconify.min.js "> </ script >
10
+ < title > Warta - Chatting App</ title >
11
+ </ head >
12
+ < body >
13
+ < div class ="new-room ">
14
+ < h1 > Warta App</ h1 >
15
+ < form id ="createForm " name ="roomF " onsubmit ="return viewSelection() ">
16
+ < input type ="text " id ="name " name ="nameInput " placeholder ="Enter your name " autocomplete ="off " autofocus > < br >
17
+ < div class ="radio ">
18
+
19
+ < input type ="radio " id ="create-room " class ="choose " name ="choose " onclick ="javascript:checkSelection(); " value ="create "> < label for ="create-room " class ="lableCreate "> Create room </ label >
20
+
21
+ <!-- </div>
22
+ <div style="display: flex;"> -->
23
+
24
+ < input type ="radio " id ="join-room " class ="choose " style ="margin-left: 3%; " name ="choose " onclick ="javascript:checkSelection(); " value ="join "> < label for ="join-room " class ="lableJoin "> Join room </ label > < br >
25
+
26
+ </ div >
27
+ <!-- <input type="text" id="roomJ" class="room" name="room" placeholder="Enter room name"><br> -->
28
+ < input type ="text " id ="roomC " class ="room " name ="room " placeholder ="Create room name " autocomplete ="off " autofocus > < br >
29
+
30
+ < input class ="button-submit " onclick ="javascript:viewSelection(); " type ="button " value ="Next " >
31
+ </ form >
32
+ </ div >
33
+ < div class ="chat ">
34
+ < div class ="status-bar ">
35
+ < h2 > Warta App</ h2 >
36
+ < h4 > </ h4 >
37
+ </ div >
38
+
39
+ < div class ="chat-container ">
40
+ < div class ="conversation ">
41
+ < div class ="conversation-container ">
42
+
43
+
44
+ </ div >
45
+ < form id ="form-container " onclick ="return checkNull(); ">
46
+ < input class ="input-msg " name ="input " placeholder ="Type a message " autocomplete ="off " autofocus > </ input >
47
+ < button class ="send " type ="submit ">
48
+ < div class ="circle ">
49
+ < span class ="iconify " data-icon ="zmdi:mail-send "> </ span >
50
+ </ div >
51
+ </ button >
52
+ </ form >
53
+ </ div >
54
+ </ div >
55
+ </ div >
56
+ <!-- <script src="http://localhost:8000/socket.io/socket.io.js"></script> -->
57
+ < script src ='https://guarded-falls-33664.herokuapp.com/socket.io/socket.io.js '> </ script >
58
+
59
+ <!-- <script src="node_modules/socket.io-client/dist/socket.io.js"></script> -->
60
+ < script src ="index.js "> </ script >
61
+ < script >
62
+ function checkNull ( ) {
63
+ if ( document . querySelector ( ".input-msg" ) . value === '' ) {
64
+ return false ;
65
+ }
66
+ }
67
+
68
+ function checkSelection ( ) {
69
+
70
+ if ( document . querySelector ( ".radio #create-room" ) . checked ) {
71
+ document . querySelector ( "#roomC" ) . style . visibility = 'visible' ;
72
+ }
73
+ if ( document . querySelector ( ".radio #join-room" ) . checked ) {
74
+ document . querySelector ( "#roomC" ) . style . visibility = 'visible' ;
75
+ document . querySelector ( "#roomC" ) . placeholder = "Enter room name" ;
76
+ }
77
+ }
78
+
79
+ function validateForm ( ) {
80
+ if ( document . forms [ "roomF" ] [ "nameInput" ] . value === '' ) {
81
+ alert ( "Name cannot be empty" ) ;
82
+ return false ;
83
+ }
84
+ if ( document . querySelector ( "#roomC" ) . value === '' ) {
85
+ alert ( "Please provide a room name" ) ;
86
+ return false ;
87
+ }
88
+ }
89
+ </ script >
90
+ </ body >
91
+ </ html >
0 commit comments