Skip to content

Commit 8b6a146

Browse files
committed
react frontend application code
1 parent 4e38949 commit 8b6a146

File tree

14 files changed

+776
-59
lines changed

14 files changed

+776
-59
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
# dependencies
44
/node_modules
5+
/venv
6+
/instance
7+
*.pyc
58
/.pnp
69
.pnp.js
710

app.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import os
2+
3+
import eventlet
4+
eventlet.monkey_patch(os=False)
5+
6+
from api import create_app, socketio
7+
8+
# Create an application instance that web servers can use. We store it as
9+
# "application" (the wsgi default) and also the much shorter and convenient
10+
# "app".
11+
application = app = create_app(os.environ.get('FLASK_ENV', 'production'))
12+
13+
14+
if __name__ == '__main__':
15+
from api.main import before_first_request
16+
with app.app_context():
17+
before_first_request()
18+
socketio.run(app, log_output=True)

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,15 @@
66
"@testing-library/jest-dom": "^5.17.0",
77
"@testing-library/react": "^13.4.0",
88
"@testing-library/user-event": "^13.5.0",
9+
"axios": "^1.5.1",
10+
"bootstrap": "^5.3.2",
911
"react": "^18.2.0",
12+
"react-bootstrap": "^2.9.0",
13+
"react-bootstrap-icons": "^1.10.3",
1014
"react-dom": "^18.2.0",
15+
"react-router-dom": "^6.16.0",
1116
"react-scripts": "5.0.1",
17+
"socket.io-client": "^4.7.2",
1218
"web-vitals": "^2.1.4"
1319
},
1420
"scripts": {
@@ -34,5 +40,6 @@
3440
"last 1 firefox version",
3541
"last 1 safari version"
3642
]
37-
}
43+
},
44+
"proxy": "http://127.0.0.1:5000"
3845
}

requirements.txt

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
alembic==1.12.0
2+
amqp==5.1.1
3+
async-timeout==4.0.3
4+
beautifulsoup4==4.12.2
5+
bidict==0.22.1
6+
billiard==4.1.0
7+
bleach==6.0.0
8+
blinker==1.6.2
9+
celery==5.3.4
10+
certifi==2023.7.22
11+
charset-normalizer==3.3.0
12+
click==8.1.7
13+
click-didyoumean==0.3.0
14+
click-plugins==1.1.1
15+
click-repl==0.3.0
16+
coverage==7.3.1
17+
dnspython==2.4.2
18+
eventlet==0.33.3
19+
Flask==3.0.0
20+
Flask-HTTPAuth==4.8.0
21+
Flask-Migrate==4.0.5
22+
Flask-SocketIO==5.3.6
23+
Flask-SQLAlchemy==3.1.1
24+
greenlet==2.0.2
25+
h11==0.14.0
26+
html5lib==1.1
27+
idna==3.4
28+
importlib-metadata==6.8.0
29+
itsdangerous==2.1.2
30+
Jinja2==3.1.2
31+
kombu==5.3.2
32+
Mako==1.2.4
33+
Markdown==3.4.4
34+
MarkupSafe==2.1.3
35+
mock==5.1.0
36+
prompt-toolkit==3.0.39
37+
python-dateutil==2.8.2
38+
python-engineio==4.7.1
39+
python-socketio==5.9.0
40+
redis==5.0.1
41+
requests==2.31.0
42+
simple-websocket==0.10.1
43+
six==1.16.0
44+
soupsieve==2.5
45+
SQLAlchemy==2.0.21
46+
typing_extensions==4.8.0
47+
tzdata==2023.3
48+
urllib3==2.0.5
49+
vine==5.0.0
50+
wcwidth==0.2.8
51+
webencodings==0.5.1
52+
Werkzeug==3.0.0
53+
wsproto==1.2.0
54+
zipp==3.17.0

src/App.css

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/App.js

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
1-
import logo from './logo.svg';
2-
import './App.css';
1+
import React from "react";
2+
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
3+
import LoginForm from "./components/LoginForm";
4+
import SignUp from "./components/Signup";
5+
import ChatWindow from "./components/ChatWindow";
6+
import { UserProvider } from "./contexts/UserContext";
7+
import { SocketProvider } from "./contexts/SocketContext";
38

4-
function App() {
9+
const App = () => {
510
return (
6-
<div className="App">
7-
<header className="App-header">
8-
<img src={logo} className="App-logo" alt="logo" />
9-
<p>
10-
Edit <code>src/App.js</code> and save to reload.
11-
</p>
12-
<a
13-
className="App-link"
14-
href="https://reactjs.org"
15-
target="_blank"
16-
rel="noopener noreferrer"
17-
>
18-
Learn React
19-
</a>
20-
</header>
21-
</div>
11+
<Router>
12+
<UserProvider>
13+
<SocketProvider>
14+
{/* SocketProvider should wrap the components using useSocket */}
15+
<Routes>
16+
<Route path="/" element={<LoginForm />} />
17+
<Route path="/signup" element={<SignUp />} />
18+
<Route path="/chat" element={<ChatWindow />} />
19+
</Routes>
20+
</SocketProvider>
21+
</UserProvider>
22+
</Router>
2223
);
23-
}
24+
};
2425

2526
export default App;

0 commit comments

Comments
 (0)