Showing
2 changed files
with
6 additions
and
11 deletions
| 1 | import React from 'react'; | 1 | import React from 'react'; |
| 2 | import { BrowserRouter as Router, Switch, Route } from 'react-router-dom'; | 2 | import { BrowserRouter as Router, Switch, Route } from 'react-router-dom'; |
| 3 | -import { socket, SocketProvider } from './SocketContext'; | 3 | +import { socket, SocketProvider } from './contexts/SocketContext'; |
| 4 | -import { Login } from './Login'; | 4 | +import { Login } from './pages/Login'; |
| 5 | -import { Rooms } from './Rooms'; | 5 | +import { Rooms } from './pages/Rooms'; |
| 6 | 6 | ||
| 7 | const App: React.FC = () => { | 7 | const App: React.FC = () => { |
| 8 | return ( | 8 | return ( | ... | ... |
| 1 | import React, { useContext, useEffect, useState } from 'react'; | 1 | import React, { useContext, useEffect, useState } from 'react'; |
| 2 | import { RouteComponentProps } from 'react-router'; | 2 | import { RouteComponentProps } from 'react-router'; |
| 3 | +import { Footer } from '../components/common/Footer'; | ||
| 3 | import { MessageResponse, MessageType } from '../components/common/types'; | 4 | import { MessageResponse, MessageType } from '../components/common/types'; |
| 5 | +import { Room } from '../components/rooms/types'; | ||
| 4 | import SocketContext from '../contexts/SocketContext'; | 6 | import SocketContext from '../contexts/SocketContext'; |
| 5 | 7 | ||
| 6 | -interface Room { | ||
| 7 | - uuid: string; | ||
| 8 | - name: string; | ||
| 9 | - currentUsers: number; | ||
| 10 | - maxUsers: number; | ||
| 11 | -} | ||
| 12 | - | ||
| 13 | export const Rooms: React.FC<RouteComponentProps> = ({ history }) => { | 8 | export const Rooms: React.FC<RouteComponentProps> = ({ history }) => { |
| 14 | const socket = useContext(SocketContext); | 9 | const socket = useContext(SocketContext); |
| 15 | const [ rooms, setRooms ] = useState<Room[]>([]); | 10 | const [ rooms, setRooms ] = useState<Room[]>([]); |
| ... | @@ -33,7 +28,7 @@ export const Rooms: React.FC<RouteComponentProps> = ({ history }) => { | ... | @@ -33,7 +28,7 @@ export const Rooms: React.FC<RouteComponentProps> = ({ history }) => { |
| 33 | <div className='flex items-center'> | 28 | <div className='flex items-center'> |
| 34 | <div>room test</div> | 29 | <div>room test</div> |
| 35 | </div> | 30 | </div> |
| 36 | - <footer>footer footer</footer> | 31 | + <Footer /> |
| 37 | </div> | 32 | </div> |
| 38 | ) | 33 | ) |
| 39 | } | 34 | } | ... | ... |
-
Please register or login to post a comment