principal merge double front
This commit is contained in:
parent
a8ade1a433
commit
fafecdacc3
@ -41,7 +41,7 @@ export class AppController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@UseGuards(JwtAuthGuard)
|
@UseGuards(JwtAuthGuard)
|
||||||
@Get('profile')
|
@Get('/profile')
|
||||||
getProfile(@Request() req) {
|
getProfile(@Request() req) {
|
||||||
const myJSON = JSON.stringify(req.user);
|
const myJSON = JSON.stringify(req.user);
|
||||||
console.log(`req user api= ${req.user}`)
|
console.log(`req user api= ${req.user}`)
|
||||||
|
|||||||
23
containers/old_react/.gitignore
vendored
Normal file
23
containers/old_react/.gitignore
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
/node_modules
|
||||||
|
/.pnp
|
||||||
|
.pnp.js
|
||||||
|
|
||||||
|
# testing
|
||||||
|
/coverage
|
||||||
|
|
||||||
|
# production
|
||||||
|
/build
|
||||||
|
|
||||||
|
# misc
|
||||||
|
.DS_Store
|
||||||
|
.env.local
|
||||||
|
.env.development.local
|
||||||
|
.env.test.local
|
||||||
|
.env.production.local
|
||||||
|
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
70
containers/old_react/README.md
Normal file
70
containers/old_react/README.md
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
# Getting Started with Create React App
|
||||||
|
|
||||||
|
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
||||||
|
|
||||||
|
## Available Scripts
|
||||||
|
|
||||||
|
In the project directory, you can run:
|
||||||
|
|
||||||
|
### `npm start`
|
||||||
|
|
||||||
|
Runs the app in the development mode.\
|
||||||
|
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
|
||||||
|
|
||||||
|
The page will reload when you make changes.\
|
||||||
|
You may also see any lint errors in the console.
|
||||||
|
|
||||||
|
### `npm test`
|
||||||
|
|
||||||
|
Launches the test runner in the interactive watch mode.\
|
||||||
|
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
||||||
|
|
||||||
|
### `npm run build`
|
||||||
|
|
||||||
|
Builds the app for production to the `build` folder.\
|
||||||
|
It correctly bundles React in production mode and optimizes the build for the best performance.
|
||||||
|
|
||||||
|
The build is minified and the filenames include the hashes.\
|
||||||
|
Your app is ready to be deployed!
|
||||||
|
|
||||||
|
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
||||||
|
|
||||||
|
### `npm run eject`
|
||||||
|
|
||||||
|
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
|
||||||
|
|
||||||
|
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
||||||
|
|
||||||
|
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
|
||||||
|
|
||||||
|
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
|
||||||
|
|
||||||
|
## Learn More
|
||||||
|
|
||||||
|
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
||||||
|
|
||||||
|
To learn React, check out the [React documentation](https://reactjs.org/).
|
||||||
|
|
||||||
|
### Code Splitting
|
||||||
|
|
||||||
|
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
|
||||||
|
|
||||||
|
### Analyzing the Bundle Size
|
||||||
|
|
||||||
|
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
|
||||||
|
|
||||||
|
### Making a Progressive Web App
|
||||||
|
|
||||||
|
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
|
||||||
|
|
||||||
|
### Advanced Configuration
|
||||||
|
|
||||||
|
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
|
||||||
|
|
||||||
|
### Deployment
|
||||||
|
|
||||||
|
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
|
||||||
|
|
||||||
|
### `npm run build` fails to minify
|
||||||
|
|
||||||
|
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
|
||||||
17612
containers/old_react/package-lock.json
generated
Normal file
17612
containers/old_react/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
47
containers/old_react/package.json
Normal file
47
containers/old_react/package.json
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
{
|
||||||
|
"name": "my-app",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"private": true,
|
||||||
|
"compilerOptions": {
|
||||||
|
"topLevelAwait": true
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@testing-library/jest-dom": "^5.16.5",
|
||||||
|
"@testing-library/react": "^13.4.0",
|
||||||
|
"@testing-library/user-event": "^13.5.0",
|
||||||
|
"axios": "^1.3.5",
|
||||||
|
"query-string": "^8.1.0",
|
||||||
|
"react": "^18.2.0",
|
||||||
|
"react-dom": "^18.2.0",
|
||||||
|
"react-router-dom": "^6.10.0",
|
||||||
|
"react-scripts": "5.0.1",
|
||||||
|
"socket.io-client": "^4.6.1",
|
||||||
|
"typescript": "^4.9.5",
|
||||||
|
"web-vitals": "^2.1.4"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"start": "HOST=0.0.0.0 PORT=8080 react-scripts start",
|
||||||
|
"start:dev": "npm run start --watch",
|
||||||
|
"build": "react-scripts build",
|
||||||
|
"test": "react-scripts test",
|
||||||
|
"eject": "react-scripts eject"
|
||||||
|
},
|
||||||
|
"eslintConfig": {
|
||||||
|
"extends": [
|
||||||
|
"react-app",
|
||||||
|
"react-app/jest"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"browserslist": {
|
||||||
|
"production": [
|
||||||
|
">0.2%",
|
||||||
|
"not dead",
|
||||||
|
"not op_mini all"
|
||||||
|
],
|
||||||
|
"development": [
|
||||||
|
"last 1 chrome version",
|
||||||
|
"last 1 firefox version",
|
||||||
|
"last 1 safari version"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
containers/old_react/public/favicon.ico
Normal file
BIN
containers/old_react/public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
43
containers/old_react/public/index.html
Normal file
43
containers/old_react/public/index.html
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<!-- <link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> -->
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<meta name="theme-color" content="#000000" />
|
||||||
|
<meta
|
||||||
|
name="description"
|
||||||
|
content="Web site created using create-react-app"
|
||||||
|
/>
|
||||||
|
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||||
|
<!--
|
||||||
|
manifest.json provides metadata used when your web app is installed on a
|
||||||
|
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||||
|
-->
|
||||||
|
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||||
|
<!--
|
||||||
|
Notice the use of %PUBLIC_URL% in the tags above.
|
||||||
|
It will be replaced with the URL of the `public` folder during the build.
|
||||||
|
Only files inside the `public` folder can be referenced from the HTML.
|
||||||
|
|
||||||
|
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||||
|
work correctly both with client-side routing and a non-root public URL.
|
||||||
|
Learn how to configure a non-root public URL by running `npm run build`.
|
||||||
|
-->
|
||||||
|
<title>React App</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||||
|
<div id="root"></div>
|
||||||
|
<!--
|
||||||
|
This HTML file is a template.
|
||||||
|
If you open it directly in the browser, you will see an empty page.
|
||||||
|
|
||||||
|
You can add webfonts, meta tags, or analytics to this file.
|
||||||
|
The build step will place the bundled scripts into the <body> tag.
|
||||||
|
|
||||||
|
To begin the development, run `npm start` or `yarn start`.
|
||||||
|
To create a production bundle, use `npm run build` or `yarn build`.
|
||||||
|
-->
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
BIN
containers/old_react/public/logo192.png
Normal file
BIN
containers/old_react/public/logo192.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.2 KiB |
BIN
containers/old_react/public/logo512.png
Normal file
BIN
containers/old_react/public/logo512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
25
containers/old_react/public/manifest.json
Normal file
25
containers/old_react/public/manifest.json
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"short_name": "React App",
|
||||||
|
"name": "Create React App Sample",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"src": "favicon.ico",
|
||||||
|
"sizes": "64x64 32x32 24x24 16x16",
|
||||||
|
"type": "image/x-icon"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "logo192.png",
|
||||||
|
"type": "image/png",
|
||||||
|
"sizes": "192x192"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "logo512.png",
|
||||||
|
"type": "image/png",
|
||||||
|
"sizes": "512x512"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start_url": ".",
|
||||||
|
"display": "standalone",
|
||||||
|
"theme_color": "#000000",
|
||||||
|
"background_color": "#ffffff"
|
||||||
|
}
|
||||||
3
containers/old_react/public/robots.txt
Normal file
3
containers/old_react/public/robots.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# https://www.robotstxt.org/robotstxt.html
|
||||||
|
User-agent: *
|
||||||
|
Disallow:
|
||||||
@ -11,8 +11,9 @@ function MyComponent() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
api.get('/some-endpoint').then((response) => {
|
const response = api.get('/some-endpoint').then((response) => {
|
||||||
console.log(response.data);
|
console.log(response.data);
|
||||||
|
response.data.username
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
58
containers/old_react/src/index.js
Normal file
58
containers/old_react/src/index.js
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import ReactDOM from 'react-dom/client';
|
||||||
|
|
||||||
|
import './styles/index.css';
|
||||||
|
import App from './components/App';
|
||||||
|
import Header from './components/Header';
|
||||||
|
// import Home from './components/Home';
|
||||||
|
// import Login42 from './components/Login42';
|
||||||
|
import Head from './components/Head';
|
||||||
|
// import Field from './components/Field';
|
||||||
|
// import PlayButton from './components/PlayButton';
|
||||||
|
import reportWebVitals from './reportWebVitals';
|
||||||
|
// import SuccessToken from './script/tokenSuccess'
|
||||||
|
import { BrowserRouter, Route, Routes, Navigate} from 'react-router-dom'
|
||||||
|
|
||||||
|
// let redirectToUrl;
|
||||||
|
// if (localStorage.getItem('token') !== null) //check condition
|
||||||
|
// {
|
||||||
|
// redirectToUrl = <Navigate to='/'/>;
|
||||||
|
// }
|
||||||
|
|
||||||
|
const root = ReactDOM.createRoot(document.getElementById('root'));
|
||||||
|
root.render(
|
||||||
|
<>
|
||||||
|
<Head />
|
||||||
|
<Header />
|
||||||
|
<BrowserRouter>
|
||||||
|
<App></App>
|
||||||
|
</BrowserRouter>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
|
||||||
|
// If you want to start measuring performance in your app, pass a function
|
||||||
|
// to log results (for example: reportWebVitals(console.log))
|
||||||
|
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
||||||
|
reportWebVitals();
|
||||||
|
|
||||||
|
{/* <Route exact path="/login42" element={<Login42 />}/> */}
|
||||||
|
// <Routes>
|
||||||
|
// {/* {redirectToUrl} */}
|
||||||
|
// <Route exact path="/" element={<Home/>}/>
|
||||||
|
// <Route exact path="/pong" element={<PlayButton />}/>
|
||||||
|
// <Route exact path="/pong/play" element={<Field />}/>
|
||||||
|
// <Route exact path="/token" element={<SuccessToken />}/>
|
||||||
|
|
||||||
|
// <Route path='*' element={<Navigate to='/' />} />
|
||||||
|
|
||||||
|
// {/* <Route path="*"><Navigate to="/" /></Route>
|
||||||
|
// */}
|
||||||
|
|
||||||
|
// {/* Gestion des pages inexistantes */}
|
||||||
|
|
||||||
|
// {/* ------- ROUTE FOR CHAT APP HERE --------- */}
|
||||||
|
// {/* <Route exact path="/chat" element={<NOM DU COMPONENT == index dans le tuto/>}/> */}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// </Routes>
|
||||||
1
containers/old_react/src/logo.svg
Normal file
1
containers/old_react/src/logo.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>
|
||||||
|
After Width: | Height: | Size: 2.6 KiB |
13
containers/old_react/src/reportWebVitals.js
Normal file
13
containers/old_react/src/reportWebVitals.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
const reportWebVitals = onPerfEntry => {
|
||||||
|
if (onPerfEntry && onPerfEntry instanceof Function) {
|
||||||
|
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
||||||
|
getCLS(onPerfEntry);
|
||||||
|
getFID(onPerfEntry);
|
||||||
|
getFCP(onPerfEntry);
|
||||||
|
getLCP(onPerfEntry);
|
||||||
|
getTTFB(onPerfEntry);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default reportWebVitals;
|
||||||
28
containers/old_react/src/script/axiosApi.js
Normal file
28
containers/old_react/src/script/axiosApi.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// console.log(`toktoken= ${token}`)
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
// const token = localStorage.getItem('token');
|
||||||
|
|
||||||
|
|
||||||
|
function getToken() {
|
||||||
|
// your code to retrieve the token from localStorage or any other source
|
||||||
|
const token = localStorage.getItem('token');
|
||||||
|
if (typeof token === 'string') {
|
||||||
|
console.log("is a string !!!")
|
||||||
|
}
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`getToken = ${getToken()}`)
|
||||||
|
console.log(`Bearer ${localStorage.getItem("token")}`)
|
||||||
|
|
||||||
|
let api = axios.create({
|
||||||
|
baseURL: 'http://localhost/api',
|
||||||
|
headers: {
|
||||||
|
// Authorization: `Bearer ${getToken()}`,
|
||||||
|
Authorization : `Bearer ${localStorage.getItem("token")}`
|
||||||
|
},
|
||||||
|
withCredentials: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
export default api;
|
||||||
35
containers/old_react/src/script/tokenSuccess.js
Normal file
35
containers/old_react/src/script/tokenSuccess.js
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import { useLocation } from 'react-router-dom';
|
||||||
|
import queryString from 'query-string';
|
||||||
|
|
||||||
|
function SuccessToken() {
|
||||||
|
const location = useLocation();
|
||||||
|
const { data } = queryString.parse(location.search);
|
||||||
|
// localStorage data.token;
|
||||||
|
const cleanData = data.slice(1, -1);
|
||||||
|
// console.log(`prout token= ${cleanData}`)
|
||||||
|
localStorage.setItem('token', `${cleanData}`);
|
||||||
|
console.log(`prout token2= ${localStorage.getItem('token')}`)
|
||||||
|
window.location.replace("http://localhost/pong");
|
||||||
|
|
||||||
|
// return (
|
||||||
|
// <div>
|
||||||
|
// <h2>Success!</h2>
|
||||||
|
// <p>Data: {data}</p>
|
||||||
|
// </div>
|
||||||
|
// );
|
||||||
|
}
|
||||||
|
|
||||||
|
export default SuccessToken;
|
||||||
|
|
||||||
|
|
||||||
|
// // Store a value in localStorage
|
||||||
|
// localStorage.setItem('key', 'value');
|
||||||
|
|
||||||
|
// // Retrieve a value from localStorage
|
||||||
|
// const value = localStorage.getItem('key');
|
||||||
|
|
||||||
|
// // Remove a value from localStorage
|
||||||
|
// localStorage.removeItem('key');
|
||||||
|
|
||||||
|
// // Clear all values from localStorage
|
||||||
|
// localStorage.clear();
|
||||||
38
containers/old_react/src/styles/App.css
Normal file
38
containers/old_react/src/styles/App.css
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
.App {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.App-logo {
|
||||||
|
height: 40vmin;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-reduced-motion: no-preference) {
|
||||||
|
.App-logo {
|
||||||
|
animation: App-logo-spin infinite 20s linear;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.App-header {
|
||||||
|
background-color: #1f1919;
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: calc(10px + 2vmin);
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.App-link {
|
||||||
|
color: #61dafb;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes App-logo-spin {
|
||||||
|
from {
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
155
containers/old_react/src/styles/chat.css
Normal file
155
containers/old_react/src/styles/chat.css
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap');
|
||||||
|
|
||||||
|
* {
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
font-family: 'Poppins', sans-serif;
|
||||||
|
}
|
||||||
|
.home__container {
|
||||||
|
width: 100%;
|
||||||
|
height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.home__container > * {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
.home__header {
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
.username__input {
|
||||||
|
padding: 10px;
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
.home__cta {
|
||||||
|
width: 200px;
|
||||||
|
padding: 10px;
|
||||||
|
font-size: 16px;
|
||||||
|
cursor: pointer;
|
||||||
|
background-color: #607eaa;
|
||||||
|
color: #f9f5eb;
|
||||||
|
outline: none;
|
||||||
|
border: none;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
.chat {
|
||||||
|
width: 100%;
|
||||||
|
height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.chat__sidebar {
|
||||||
|
height: 100%;
|
||||||
|
background-color: #f9f5eb;
|
||||||
|
flex: 0.2;
|
||||||
|
padding: 20px;
|
||||||
|
border-right: 1px solid #fdfdfd;
|
||||||
|
}
|
||||||
|
.chat__main {
|
||||||
|
height: 100%;
|
||||||
|
flex: 0.8;
|
||||||
|
}
|
||||||
|
.chat__header {
|
||||||
|
margin: 30px 0 20px 0;
|
||||||
|
}
|
||||||
|
.chat__users > * {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
color: #607eaa;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
.online__users > * {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
color: rgb(238, 102, 102);
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
.chat__mainHeader {
|
||||||
|
width: 100%;
|
||||||
|
height: 10vh;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 20px;
|
||||||
|
background-color: #f9f5eb;
|
||||||
|
}
|
||||||
|
.leaveChat__btn {
|
||||||
|
padding: 10px;
|
||||||
|
width: 150px;
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
background-color: #d1512d;
|
||||||
|
cursor: pointer;
|
||||||
|
color: #eae3d2;
|
||||||
|
}
|
||||||
|
.message__container {
|
||||||
|
width: 100%;
|
||||||
|
height: 80vh;
|
||||||
|
background-color: #fff;
|
||||||
|
padding: 20px;
|
||||||
|
overflow-y: scroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message__container > * {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
.chat__footer {
|
||||||
|
padding: 10px;
|
||||||
|
background-color: #f9f5eb;
|
||||||
|
height: 10vh;
|
||||||
|
}
|
||||||
|
.form {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
.message {
|
||||||
|
width: 80%;
|
||||||
|
height: 100%;
|
||||||
|
border-radius: 10px;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
outline: none;
|
||||||
|
padding: 15px;
|
||||||
|
}
|
||||||
|
.sendBtn {
|
||||||
|
width: 150px;
|
||||||
|
background-color: green;
|
||||||
|
padding: 10px;
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
color: #eae3d2;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.sendBtn:hover {
|
||||||
|
background-color: rgb(129, 201, 129);
|
||||||
|
}
|
||||||
|
.message__recipient {
|
||||||
|
background-color: #f5ccc2;
|
||||||
|
width: 300px;
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 10px;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
.message__sender {
|
||||||
|
background-color: rgb(194, 243, 194);
|
||||||
|
max-width: 300px;
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 10px;
|
||||||
|
margin-left: auto;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
.message__chats > p {
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
.sender__name {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
.message__status {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 50px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
55
containers/old_react/src/styles/field.css
Normal file
55
containers/old_react/src/styles/field.css
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
.playButton {
|
||||||
|
background-color: rgb(0, 0, 0);
|
||||||
|
border-radius: 5vh;
|
||||||
|
color: white;
|
||||||
|
display: block;
|
||||||
|
margin: auto;
|
||||||
|
margin-top: 30vh;
|
||||||
|
padding: 2vh 5vw;
|
||||||
|
height: 10vh;
|
||||||
|
width: 20vw;
|
||||||
|
font-size: 300%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clicked{
|
||||||
|
/* justify-content: center; */
|
||||||
|
/* display: flex;
|
||||||
|
justify-content: center; */
|
||||||
|
background-color: rgb(0, 0, 0);
|
||||||
|
width: 70vw;
|
||||||
|
/* height: 70vh; */
|
||||||
|
margin:auto;
|
||||||
|
margin-right: 15vw;
|
||||||
|
margin-left: 15vw;
|
||||||
|
margin-top: 10vh;
|
||||||
|
position: relative;
|
||||||
|
padding-top: 35%;
|
||||||
|
/* padding-top: 25; */
|
||||||
|
/* padding-top: 177.77% */
|
||||||
|
}
|
||||||
|
|
||||||
|
#myCanvas {
|
||||||
|
background-color: rgb(75, 33, 33);
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
cursor: none;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 768px) {
|
||||||
|
#canvas_container {
|
||||||
|
transform: rotate(90deg);
|
||||||
|
transform-origin: top right;
|
||||||
|
position: relative;
|
||||||
|
/* margin-right: 100vw; */
|
||||||
|
/* height: 100vw; */
|
||||||
|
width: 100vh;
|
||||||
|
}
|
||||||
|
/* #myCanvas {
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
} */
|
||||||
|
}
|
||||||
13
containers/old_react/src/styles/index.css
Normal file
13
containers/old_react/src/styles/index.css
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||||
|
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
||||||
|
sans-serif;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
||||||
|
monospace;
|
||||||
|
}
|
||||||
165
containers/old_react/src/styles/old.css
Normal file
165
containers/old_react/src/styles/old.css
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
body {
|
||||||
|
/* display: flex; */
|
||||||
|
margin: 0%;
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
background-color: rgb(71, 71, 71);
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
text-align: center;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
background-color: rgb(0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pp {
|
||||||
|
height: 7vw;
|
||||||
|
width: 7vw;
|
||||||
|
max-height: 7vh;
|
||||||
|
max-width: 7vh;
|
||||||
|
/* max-width: ; */
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 5px solid rgb(255, 255, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
.loginHere{
|
||||||
|
font-size: 5vh;
|
||||||
|
font-family: 'Rubik Iso';
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 10vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
::placeholder {
|
||||||
|
font-size: 3vh;
|
||||||
|
text-align: center;
|
||||||
|
align-items: center;
|
||||||
|
margin:auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.submit{
|
||||||
|
height: 5vh;
|
||||||
|
border-radius: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.submit:hover {
|
||||||
|
background-color: blueviolet;
|
||||||
|
}
|
||||||
|
|
||||||
|
input{
|
||||||
|
height: 5vh;
|
||||||
|
border-radius: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pp:hover {
|
||||||
|
border: 5px solid rgb(100, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.userTxt:hover {
|
||||||
|
color:blueviolet;;
|
||||||
|
}
|
||||||
|
|
||||||
|
.userTxt {
|
||||||
|
margin-right: 5%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.username {
|
||||||
|
/* justify-content: center; */
|
||||||
|
margin-right: 1vw;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 2vw;
|
||||||
|
max-width: 33%;
|
||||||
|
color: aqua;
|
||||||
|
justify-content: right;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* .loginButton {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
text-decoration: none;
|
||||||
|
background-color: black;
|
||||||
|
color: white;
|
||||||
|
border-radius: ;
|
||||||
|
padding: 10px 20px;
|
||||||
|
margin-left: 40vw;
|
||||||
|
margin-top: 40vh;
|
||||||
|
width: 20vw;
|
||||||
|
height: 10vh;
|
||||||
|
font-size: 5vh;
|
||||||
|
} */
|
||||||
|
|
||||||
|
.loginButton {
|
||||||
|
background-color: rgb(0, 0, 0);
|
||||||
|
border-radius: 5vh;
|
||||||
|
color: white;
|
||||||
|
display: block;
|
||||||
|
margin: auto;
|
||||||
|
margin-top: 30vh;
|
||||||
|
padding: 2vh 5vw;
|
||||||
|
height: 10vh;
|
||||||
|
width: 20vw;
|
||||||
|
font-size: 300%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* .loginButton {
|
||||||
|
border-radius: 100vh;
|
||||||
|
max-height: 10vh;
|
||||||
|
background-color: black;
|
||||||
|
font-family: 'Rubik Iso';
|
||||||
|
font-size: 5vh;
|
||||||
|
align-items: center;
|
||||||
|
height: 50vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-around;
|
||||||
|
} */
|
||||||
|
|
||||||
|
|
||||||
|
.menu {
|
||||||
|
margin-left: 2vw;
|
||||||
|
color: aqua;
|
||||||
|
/* font-size: 4vh; */
|
||||||
|
font-size: 2vw;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pong{
|
||||||
|
font-family:'Rubik Iso';
|
||||||
|
}
|
||||||
|
|
||||||
|
.box {
|
||||||
|
width: 33%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.center {
|
||||||
|
align-self: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.headerName {
|
||||||
|
display:flex;
|
||||||
|
max-width: 33%;
|
||||||
|
height: 100%;
|
||||||
|
/* font-size: 50px; */
|
||||||
|
color:blueviolet;
|
||||||
|
/* font-size: 10vw; */
|
||||||
|
font-size: min(10vw, 10vh);
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
display: flex;
|
||||||
|
margin: 0;
|
||||||
|
height: 10vw;
|
||||||
|
max-height: 10vh;
|
||||||
|
align-items: center;
|
||||||
|
background-color: rgb(0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
color:blueviolet
|
||||||
|
}
|
||||||
4295
containers/react/package-lock.json
generated
4295
containers/react/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -2,21 +2,21 @@
|
|||||||
"name": "my-app",
|
"name": "my-app",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"compilerOptions": {
|
|
||||||
"topLevelAwait": true
|
|
||||||
},
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@testing-library/jest-dom": "^5.16.5",
|
"@testing-library/jest-dom": "^5.16.5",
|
||||||
"@testing-library/react": "^13.4.0",
|
"@testing-library/react": "^13.4.0",
|
||||||
"@testing-library/user-event": "^13.5.0",
|
"@testing-library/user-event": "^13.5.0",
|
||||||
"axios": "^1.3.5",
|
"axios": "^1.3.5",
|
||||||
|
"framer-motion": "^10.12.8",
|
||||||
|
"npm": "^9.6.6",
|
||||||
"query-string": "^8.1.0",
|
"query-string": "^8.1.0",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
|
"react-icons": "^4.8.0",
|
||||||
"react-router-dom": "^6.10.0",
|
"react-router-dom": "^6.10.0",
|
||||||
"react-scripts": "5.0.1",
|
"react-scripts": "5.0.1",
|
||||||
"socket.io-client": "^4.6.1",
|
"socket.io-client": "^4.6.1",
|
||||||
"typescript": "^4.9.5",
|
"styled-components": "^5.3.10",
|
||||||
"web-vitals": "^2.1.4"
|
"web-vitals": "^2.1.4"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<!-- <link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> -->
|
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<meta name="theme-color" content="#000000" />
|
<meta name="theme-color" content="#000000" />
|
||||||
<meta
|
<meta
|
||||||
|
|||||||
10
containers/react/src/DataBase/DataProfileUser.jsx
Normal file
10
containers/react/src/DataBase/DataProfileUser.jsx
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import DefaultPic from '../assets/profile.jpg';
|
||||||
|
|
||||||
|
const UserProfile = [
|
||||||
|
{
|
||||||
|
Pic: DefaultPic,
|
||||||
|
UserName: "Dipper Ratman",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
export default UserProfile
|
||||||
30
containers/react/src/DataBase/DummyDBWinLoss.js
Normal file
30
containers/react/src/DataBase/DummyDBWinLoss.js
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
export const DBWinLoss = [
|
||||||
|
{
|
||||||
|
title: 'Victory',
|
||||||
|
score: '10 - 6',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Defeat',
|
||||||
|
score: '9 - 10',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Victory',
|
||||||
|
score: '10 - 0',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Victory',
|
||||||
|
score: '10 - 9',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Defeat',
|
||||||
|
score: '3 - 10',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Deafet',
|
||||||
|
score: '9 - 10',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Victory',
|
||||||
|
score: '10 - 9',
|
||||||
|
},
|
||||||
|
]
|
||||||
BIN
containers/react/src/assets/profile.jpg
Normal file
BIN
containers/react/src/assets/profile.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
26
containers/react/src/components/AnimatedRoute.jsx
Normal file
26
containers/react/src/components/AnimatedRoute.jsx
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import React from "react";
|
||||||
|
import {Routes, Route} from 'react-router-dom';
|
||||||
|
import Home from "../pages/Home.jsx";
|
||||||
|
import PlayButton from "../pages/PlayButton.js";
|
||||||
|
import Field from "../pages/Field";
|
||||||
|
import Login42 from "../pages/Login42.js";
|
||||||
|
import Messages from "../pages/Messages.jsx";
|
||||||
|
import { useLocation } from "react-router-dom";
|
||||||
|
import {AnimatePresence} from "framer-motion";
|
||||||
|
|
||||||
|
function AnimatedRoute () {
|
||||||
|
const location = useLocation();
|
||||||
|
return (
|
||||||
|
<AnimatePresence>
|
||||||
|
<Routes location={location} key={location.pathname}>
|
||||||
|
<Route exact path="/" element={<Home/>}/>
|
||||||
|
<Route path="/game" element={<PlayButton />}/>
|
||||||
|
<Route exact path="/pong/play" element={<Field />}/>
|
||||||
|
<Route exact path="/login42" element={<Login42 />}/>
|
||||||
|
<Route exact path="/messages" element={<Messages />}/>
|
||||||
|
</Routes>
|
||||||
|
</AnimatePresence>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AnimatedRoute
|
||||||
38
containers/react/src/components/App.jsx
Normal file
38
containers/react/src/components/App.jsx
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import React from "react";
|
||||||
|
import {Routes, Route} from 'react-router-dom';
|
||||||
|
import HomeLogin from "../pages/Home.js";
|
||||||
|
|
||||||
|
import Home from "../pages/Home.jsx";
|
||||||
|
|
||||||
|
import PlayButton from "../pages/PlayButton.js";
|
||||||
|
import Field from "../pages/Field";
|
||||||
|
import Login42 from "../pages/Login42.js";
|
||||||
|
import Messages from "../pages/Messages.jsx";
|
||||||
|
import { useLocation } from "react-router-dom";
|
||||||
|
import {AnimatePresence} from "framer-motion";
|
||||||
|
|
||||||
|
import SuccessToken from '../script/tokenSuccess'
|
||||||
|
|
||||||
|
|
||||||
|
function AnimatedRoute () {
|
||||||
|
const location = useLocation();
|
||||||
|
return (
|
||||||
|
<AnimatePresence>
|
||||||
|
<Routes location={location} key={location.pathname}>
|
||||||
|
|
||||||
|
<Route exact path="/" element={<HomeLogin/>}/>
|
||||||
|
<Route exact path="/profile" element={<Home/>}/>
|
||||||
|
<Route exact path="/token" element={<SuccessToken />}/>
|
||||||
|
<Route path="/game" element={<PlayButton />}/>
|
||||||
|
<Route exact path="/pong" element={<PlayButton />}/>
|
||||||
|
<Route exact path="/pong/play" element={<Field />}/>
|
||||||
|
{/* <Route path="/profile" element={<PlayButton />}/> */}
|
||||||
|
|
||||||
|
<Route exact path="/login42" element={<Login42 />}/>
|
||||||
|
<Route exact path="/messages" element={<Messages />}/>
|
||||||
|
</Routes>
|
||||||
|
</AnimatePresence>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AnimatedRoute
|
||||||
12
containers/react/src/components/Footer.jsx
Normal file
12
containers/react/src/components/Footer.jsx
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import React from 'react';
|
||||||
|
// import './Header.scss';
|
||||||
|
|
||||||
|
function Footer() {
|
||||||
|
return (
|
||||||
|
<footer className="footer">
|
||||||
|
<p>© 2023 Paris France</p>
|
||||||
|
</footer>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Footer;
|
||||||
90
containers/react/src/components/Header.jsx
Normal file
90
containers/react/src/components/Header.jsx
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
import React, {useState} from 'react';
|
||||||
|
import {AiOutlineMenuUnfold} from 'react-icons/ai';
|
||||||
|
// import * as AiIcons from 'react-icons/ai';
|
||||||
|
import {Link} from 'react-router-dom';
|
||||||
|
// import { SidebarData } from './Sidebar/SidebarData';
|
||||||
|
import DefaultPicture from '../assets/profile.jpg'
|
||||||
|
import { motion, AnimatePresence } from 'framer-motion'
|
||||||
|
import Modal from './Sidebar/Modal';
|
||||||
|
// import {BiLogOutCircle} from 'react-icons/bi';
|
||||||
|
// import AnimatePresence from
|
||||||
|
import '../styles/Header.css';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function Header() {
|
||||||
|
// const [sidebar, setSidebar] = useState(false);
|
||||||
|
// const showSidebar = () => setSidebar(!sidebar);
|
||||||
|
const [modalOpen, setModalOpen] = useState(false);
|
||||||
|
const close = () => setModalOpen(false);
|
||||||
|
const open = () => setModalOpen(true);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='Header'>
|
||||||
|
{/* <div className='Header'>
|
||||||
|
<Link to="#" className='menu-bars'>
|
||||||
|
<motion.div>
|
||||||
|
|
||||||
|
onClick={() => (modalOpen ? close() : open())}>
|
||||||
|
<AiOutlineMenuUnfold/>
|
||||||
|
</motion.div>
|
||||||
|
</Link>
|
||||||
|
<div className='end'>
|
||||||
|
<Link to="/" className='menu-bars'>
|
||||||
|
<img className='Header-pic' src={DefaultPicture} alt='profile'/>
|
||||||
|
</Link>
|
||||||
|
</div> */}
|
||||||
|
{/* <Link to="#" className='menu-bars'>
|
||||||
|
<AiOutlineMenuUnfold onClick={showSidebar}/>
|
||||||
|
</Link>
|
||||||
|
<div className='end'>
|
||||||
|
<Link to="/" className='menu-bars'>
|
||||||
|
<img className='Header-pic' src={DefaultPicture} alt='profile'/>
|
||||||
|
</Link>
|
||||||
|
</div> */}
|
||||||
|
{/* </div> */}
|
||||||
|
|
||||||
|
{/* <nav className={sidebar ? 'nav-menu active' : 'nav-menu'}>
|
||||||
|
<ul className='nav-menu-items' onClick={showSidebar}>
|
||||||
|
<li className='Header-toggle'>
|
||||||
|
<Link to="#" className='menu-bars'>
|
||||||
|
<AiIcons.AiOutlineClose />
|
||||||
|
</Link>
|
||||||
|
</li>
|
||||||
|
{SidebarData.map((item, index) => {
|
||||||
|
return (
|
||||||
|
<motion.div
|
||||||
|
whileHover={{scale: 1.1}}>
|
||||||
|
<li key={index} className={item.cName}>
|
||||||
|
<Link to={item.path}>
|
||||||
|
{item.icon}
|
||||||
|
<span>{item.title}</span>
|
||||||
|
</Link>
|
||||||
|
</li>
|
||||||
|
</motion.div>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</ul>
|
||||||
|
</nav> */}
|
||||||
|
|
||||||
|
<motion.div
|
||||||
|
onClick={() => (modalOpen ? close() : open())}>
|
||||||
|
<Link to="#" className='menu-bars'>
|
||||||
|
<AiOutlineMenuUnfold/>
|
||||||
|
</Link>
|
||||||
|
</motion.div>
|
||||||
|
<div className='end'>
|
||||||
|
<Link to="/profile" className='menu-bars'>
|
||||||
|
<img className='Header-pic' src={DefaultPicture} alt='profile'/>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
<AnimatePresence
|
||||||
|
initial={false}
|
||||||
|
onExitComplete={() => null}>
|
||||||
|
{modalOpen && <Modal modalOpen={modalOpen} handleClose={close}/>}
|
||||||
|
</AnimatePresence>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Header
|
||||||
62
containers/react/src/components/Messages/Chat.jsx
Normal file
62
containers/react/src/components/Messages/Chat.jsx
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
import React from "react"
|
||||||
|
import styled from "styled-components"
|
||||||
|
import '../../styles/Messages.css'
|
||||||
|
import DefaultPic from '../../assets/profile.jpg';
|
||||||
|
import { ImBlocked } from 'react-icons/im';
|
||||||
|
import { MdOutlineGroupAdd } from 'react-icons/md';
|
||||||
|
import Conversation from "./Conversation";
|
||||||
|
import Input from "./Input";
|
||||||
|
|
||||||
|
|
||||||
|
const TouchDiv = styled.div`
|
||||||
|
margin-left: 10px;
|
||||||
|
margin-right: 4px;
|
||||||
|
margin-bottom: 21px;
|
||||||
|
margin-top: 21px;
|
||||||
|
cursor: pointer;
|
||||||
|
justify-content: space-around;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: #F4F3EF;
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
function Chat(){
|
||||||
|
return (
|
||||||
|
<div className="chat">
|
||||||
|
<div className='navbar'>
|
||||||
|
<img src={DefaultPic} alt="profile" className="pic"/>
|
||||||
|
<TouchDiv>Dummy</TouchDiv>
|
||||||
|
<div className="end">
|
||||||
|
<TouchDiv>
|
||||||
|
<MdOutlineGroupAdd/>
|
||||||
|
</TouchDiv>
|
||||||
|
<TouchDiv>
|
||||||
|
<ImBlocked/>
|
||||||
|
</TouchDiv>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<Conversation/>
|
||||||
|
<Input/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Chat
|
||||||
|
|
||||||
|
|
||||||
|
// const SideSpan = styled.span`
|
||||||
|
// font-size: 18px;
|
||||||
|
// font-weight: 500;
|
||||||
|
// cursor: pointer;
|
||||||
|
// margin-bottom: 40px;
|
||||||
|
|
||||||
|
// &:hover {
|
||||||
|
// color: #F4F3EF;
|
||||||
|
// }
|
||||||
|
// `
|
||||||
|
|
||||||
|
// const SideP = styled.p`
|
||||||
|
// font-size: 14px;
|
||||||
|
// color: lightgray
|
||||||
|
// `
|
||||||
63
containers/react/src/components/Messages/Chats.jsx
Normal file
63
containers/react/src/components/Messages/Chats.jsx
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
import React from "react";
|
||||||
|
import '../../styles/Messages.css'
|
||||||
|
import styled from "styled-components";
|
||||||
|
import DefaultPic from '../../assets/profile.jpg'
|
||||||
|
|
||||||
|
const UserChat = styled.div `
|
||||||
|
padding: 5px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5px;
|
||||||
|
color: white;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover{
|
||||||
|
background-color: #3e3c61;
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
const SideSpan = styled.span`
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 500;
|
||||||
|
`
|
||||||
|
|
||||||
|
const SideP = styled.p`
|
||||||
|
font-size: 14px;
|
||||||
|
color: lightgray;
|
||||||
|
margin-left: 15px;
|
||||||
|
`
|
||||||
|
|
||||||
|
function Chats(){
|
||||||
|
return (
|
||||||
|
<div className="chat">
|
||||||
|
<UserChat>
|
||||||
|
<img className="pic-user" src={DefaultPic} alt="User" />
|
||||||
|
<div className="infoSideBar">
|
||||||
|
<SideSpan>Dummy</SideSpan>
|
||||||
|
<SideP>yo</SideP>
|
||||||
|
</div>
|
||||||
|
</UserChat>
|
||||||
|
<UserChat>
|
||||||
|
<img className="pic-user" src={DefaultPic} alt="User" />
|
||||||
|
<div className="infoSideBar">
|
||||||
|
<SideSpan>Dummy</SideSpan>
|
||||||
|
<SideP>yo</SideP>
|
||||||
|
</div>
|
||||||
|
</UserChat><UserChat>
|
||||||
|
<img className="pic-user" src={DefaultPic} alt="User" />
|
||||||
|
<div className="infoSideBar">
|
||||||
|
<SideSpan>Dummy</SideSpan>
|
||||||
|
<SideP>yo</SideP>
|
||||||
|
</div>
|
||||||
|
</UserChat><UserChat>
|
||||||
|
<img className="pic-user" src={DefaultPic} alt="User" />
|
||||||
|
<div className="infoSideBar">
|
||||||
|
<SideSpan>Dummy</SideSpan>
|
||||||
|
<SideP>yo</SideP>
|
||||||
|
</div>
|
||||||
|
</UserChat>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Chats
|
||||||
40
containers/react/src/components/Messages/Conversation.jsx
Normal file
40
containers/react/src/components/Messages/Conversation.jsx
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import MessageYou from "./MessageYou"
|
||||||
|
import MessageMe from "./MessageMe"
|
||||||
|
// import { useRef } from "react";
|
||||||
|
// import { useEffect } from "react";
|
||||||
|
import '../../styles/Messages.css'
|
||||||
|
|
||||||
|
function Conversation(){
|
||||||
|
// const scrollRef = useRef();
|
||||||
|
|
||||||
|
// useEffect(() => {
|
||||||
|
// scrollRef.current?.scrollIntoView({ behavior: "smooth"})
|
||||||
|
// }, [])
|
||||||
|
return (
|
||||||
|
<div className="messages">
|
||||||
|
<MessageYou/>
|
||||||
|
<MessageMe/>
|
||||||
|
<MessageYou/>
|
||||||
|
<MessageMe/>
|
||||||
|
<MessageMe/>
|
||||||
|
<MessageYou/>
|
||||||
|
<MessageMe/>
|
||||||
|
<MessageMe/>
|
||||||
|
<MessageYou/>
|
||||||
|
<MessageYou/>
|
||||||
|
<MessageMe/>
|
||||||
|
<MessageYou/>
|
||||||
|
<MessageMe/>
|
||||||
|
<MessageYou/>
|
||||||
|
<MessageMe/>
|
||||||
|
<MessageMe/>
|
||||||
|
<MessageYou/>
|
||||||
|
<MessageMe/>
|
||||||
|
<MessageMe/>
|
||||||
|
<MessageYou/>
|
||||||
|
<MessageMe/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Conversation
|
||||||
15
containers/react/src/components/Messages/Input.jsx
Normal file
15
containers/react/src/components/Messages/Input.jsx
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import { TbSend } from 'react-icons/tb';
|
||||||
|
|
||||||
|
|
||||||
|
function Input(){
|
||||||
|
return (
|
||||||
|
<div className="input">
|
||||||
|
<input type="text" placeholder="What do you want to say"/>
|
||||||
|
<div className="send">
|
||||||
|
<TbSend/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Input
|
||||||
34
containers/react/src/components/Messages/MessageMe.jsx
Normal file
34
containers/react/src/components/Messages/MessageMe.jsx
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import React from "react"
|
||||||
|
import styled from "styled-components"
|
||||||
|
import DefaultPic from '../../assets/profile.jpg'
|
||||||
|
import { useRef } from "react";
|
||||||
|
import { useEffect } from "react";
|
||||||
|
import '../../styles/Messages.css'
|
||||||
|
|
||||||
|
const MeStyleP = styled.p`
|
||||||
|
background-color: lightgray;
|
||||||
|
padding 10px 20px;
|
||||||
|
border-radius 10px 0px 10px 10px;
|
||||||
|
color: black;
|
||||||
|
margin-right: 20px;
|
||||||
|
`
|
||||||
|
|
||||||
|
function MessageMe(){
|
||||||
|
const scrollRef = useRef();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
scrollRef.current?.scrollIntoView({ behavior: "smooth"})
|
||||||
|
}, [])
|
||||||
|
return (
|
||||||
|
<div className="meMessage" ref={scrollRef}>
|
||||||
|
<div>
|
||||||
|
<img className="messageInfo" src={DefaultPic} alt="profile" />
|
||||||
|
</div>
|
||||||
|
<div className="messageContent">
|
||||||
|
<MeStyleP>bonjours ca va</MeStyleP>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default MessageMe
|
||||||
34
containers/react/src/components/Messages/MessageYou.jsx
Normal file
34
containers/react/src/components/Messages/MessageYou.jsx
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import React from "react"
|
||||||
|
import styled from "styled-components"
|
||||||
|
import DefaultPic from '../../assets/profile.jpg'
|
||||||
|
import { useRef } from "react"
|
||||||
|
import { useEffect } from "react"
|
||||||
|
import '../../styles/Messages.css'
|
||||||
|
|
||||||
|
const StyleP = styled.p`
|
||||||
|
background-color: white;
|
||||||
|
padding 10px 20px;
|
||||||
|
border-radius 0px 10px 10px 10px;
|
||||||
|
color: black;
|
||||||
|
margin-left: 20px;
|
||||||
|
`
|
||||||
|
|
||||||
|
function MessageYou(){
|
||||||
|
const scrollRef = useRef();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
scrollRef.current?.scrollIntoView({ behavior: "smooth"})
|
||||||
|
}, [])
|
||||||
|
return (
|
||||||
|
<div className="youMessage" ref={scrollRef}>
|
||||||
|
<div>
|
||||||
|
<img className="messageInfo" src={DefaultPic} alt="profile" />
|
||||||
|
</div>
|
||||||
|
<div className="messageContent">
|
||||||
|
<StyleP>bonjours ca va</StyleP>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default MessageYou
|
||||||
15
containers/react/src/components/Messages/Navbar.jsx
Normal file
15
containers/react/src/components/Messages/Navbar.jsx
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// import UserProfile from '../../DataBase/DataProfileUser'
|
||||||
|
import DefaultPic from '../../assets/profile.jpg';
|
||||||
|
// import Data from '../../DataBase/DataProfileUser';
|
||||||
|
import '../../styles/Messages.css'
|
||||||
|
|
||||||
|
function Navbar(){
|
||||||
|
return (
|
||||||
|
<div className='navbar'>
|
||||||
|
<img src={DefaultPic} alt="profile" className="pic"/>
|
||||||
|
<h4>Dipper Ratman</h4>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Navbar
|
||||||
14
containers/react/src/components/Messages/Sidebar.jsx
Normal file
14
containers/react/src/components/Messages/Sidebar.jsx
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import React from "react";
|
||||||
|
import Navbar from "./Navbar";
|
||||||
|
import Chats from "./Chats";
|
||||||
|
|
||||||
|
function Sidebar(){
|
||||||
|
return (
|
||||||
|
<div className="sidebar">
|
||||||
|
<Navbar/>
|
||||||
|
<Chats/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Sidebar
|
||||||
16
containers/react/src/components/Sidebar/Backdrop.jsx
Normal file
16
containers/react/src/components/Sidebar/Backdrop.jsx
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import { motion } from "framer-motion"
|
||||||
|
import "../../styles/Header.css"
|
||||||
|
|
||||||
|
const Backdrop = ({ children, onClick }) => {
|
||||||
|
return (
|
||||||
|
<motion.div className="backdrop"
|
||||||
|
onClick={onClick}
|
||||||
|
initial={{ opacity: 0}}
|
||||||
|
animate={{ opacity: 1}}
|
||||||
|
exit={{ opacity: 0}}>
|
||||||
|
{children}
|
||||||
|
</motion.div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Backdrop
|
||||||
76
containers/react/src/components/Sidebar/Modal.jsx
Normal file
76
containers/react/src/components/Sidebar/Modal.jsx
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
import {motion} from "framer-motion"
|
||||||
|
import Backdrop from "./Backdrop"
|
||||||
|
import { SidebarData } from "./SidebarData"
|
||||||
|
import {Link} from 'react-router-dom';
|
||||||
|
import * as AiIcons from 'react-icons/ai';
|
||||||
|
|
||||||
|
|
||||||
|
import "../../styles/Header.css"
|
||||||
|
|
||||||
|
const dropIn = {
|
||||||
|
hidden: {
|
||||||
|
x: "-100vh",
|
||||||
|
},
|
||||||
|
visible: {
|
||||||
|
x: "0",
|
||||||
|
},
|
||||||
|
exit: {
|
||||||
|
x: "-100vh",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// function showBar (){
|
||||||
|
// return (
|
||||||
|
// {SidebarData.map((item, index) => {
|
||||||
|
// return (
|
||||||
|
// <motion.div
|
||||||
|
// className="nav-menu"
|
||||||
|
// // whileHover={{scale: 1.1}}
|
||||||
|
// >
|
||||||
|
// <li key={index} className={item.cName}>
|
||||||
|
// <Link to={item.path}>
|
||||||
|
// {item.icon}
|
||||||
|
// <span>{item.title}</span>
|
||||||
|
// </Link>
|
||||||
|
// </li>
|
||||||
|
// </motion.div>
|
||||||
|
// )
|
||||||
|
// })}
|
||||||
|
// )
|
||||||
|
// }
|
||||||
|
const Modal = ({ handleClose }) => {
|
||||||
|
return (
|
||||||
|
<Backdrop onClick={handleClose}>
|
||||||
|
<motion.div
|
||||||
|
className="nav-menu"
|
||||||
|
variants={dropIn}
|
||||||
|
initial="hidden"
|
||||||
|
animate="visible"
|
||||||
|
exit="exit">
|
||||||
|
<li className='Header-toggle'>
|
||||||
|
<Link to="#" className='menu-bars'>
|
||||||
|
<AiIcons.AiOutlineClose />
|
||||||
|
</Link>
|
||||||
|
</li>
|
||||||
|
<div
|
||||||
|
className="nav-menu">
|
||||||
|
{SidebarData.map((item, index) => {
|
||||||
|
return (
|
||||||
|
<motion.div whileHover={{scale: 1.1}}>
|
||||||
|
<li key={index} className={item.cName}>
|
||||||
|
<Link to={item.path}>
|
||||||
|
{item.icon}
|
||||||
|
<span>{item.title}</span>
|
||||||
|
</Link>
|
||||||
|
</li>
|
||||||
|
</motion.div>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</motion.div>
|
||||||
|
</Backdrop>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Modal
|
||||||
46
containers/react/src/components/Sidebar/SidebarData.js
Normal file
46
containers/react/src/components/Sidebar/SidebarData.js
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
import React from "react";
|
||||||
|
import * as FaIcons from 'react-icons/fa';
|
||||||
|
import * as AiIcons from 'react-icons/ai';
|
||||||
|
import * as IoIcons from 'react-icons/io';
|
||||||
|
import {BiLogOutCircle} from 'react-icons/bi';
|
||||||
|
import {IoSettingsSharp} from 'react-icons/io5'
|
||||||
|
|
||||||
|
|
||||||
|
export const SidebarData = [
|
||||||
|
{
|
||||||
|
title: 'Dipper Ratman',
|
||||||
|
path: '/',
|
||||||
|
icon: <AiIcons.AiFillHome />,
|
||||||
|
cName: 'nav-text'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Game',
|
||||||
|
path: '/pong',
|
||||||
|
icon: <FaIcons.FaGamepad/>,
|
||||||
|
cName: 'nav-text'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Messages',
|
||||||
|
path: '/messages',
|
||||||
|
icon: <FaIcons.FaEnvelopeOpenText/>,
|
||||||
|
cName: 'nav-text'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Social',
|
||||||
|
path: '/team',
|
||||||
|
icon: <IoIcons.IoMdPeople />,
|
||||||
|
cName: 'nav-text'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Settings',
|
||||||
|
path: '/team',
|
||||||
|
icon: <IoSettingsSharp />,
|
||||||
|
cName: 'nav-text'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Log out',
|
||||||
|
path: '/team',
|
||||||
|
icon: <BiLogOutCircle />,
|
||||||
|
cName: 'nav-text'
|
||||||
|
},
|
||||||
|
]
|
||||||
67
containers/react/src/components/Win_Loss.jsx
Normal file
67
containers/react/src/components/Win_Loss.jsx
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
// import PropTypes from "prop-types"
|
||||||
|
import styled from 'styled-components';
|
||||||
|
import '../DataBase/DummyDBWinLoss.js'
|
||||||
|
import { DBWinLoss } from '../DataBase/DummyDBWinLoss.js';
|
||||||
|
// import color from '../../utils/style/color.js';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const CardWrapper = styled.div`
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 15px;
|
||||||
|
background-color: black;
|
||||||
|
// border-radius: 30px;
|
||||||
|
// width: 350px;
|
||||||
|
// transition: 200ms;
|
||||||
|
margin-top: 50px;
|
||||||
|
&:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
box-shadow: 2px 2px 10px #b6b6b6;
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
const CardLabel1 = styled.span`
|
||||||
|
color: #5843e4;
|
||||||
|
font-size: 22px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 25px;
|
||||||
|
`
|
||||||
|
const CardLabel2 = styled.span`
|
||||||
|
color: #5843e4;
|
||||||
|
font-size: 22px;
|
||||||
|
font-weight: bold;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
`
|
||||||
|
|
||||||
|
// const CardImage = styled.img`
|
||||||
|
// heigh: 80px;
|
||||||
|
// width: 80px;
|
||||||
|
// border-radius: 50%;
|
||||||
|
// `
|
||||||
|
|
||||||
|
function WinLoss() {
|
||||||
|
return (
|
||||||
|
<CardWrapper>
|
||||||
|
<CardLabel1>Match history Win/Loss</CardLabel1>
|
||||||
|
{/* <CardImage src={picture} alt="freelance" height={80} width={80} /> */}
|
||||||
|
{DBWinLoss.map((item, index) => {
|
||||||
|
return (
|
||||||
|
<li key={index}>
|
||||||
|
<CardLabel2>{item.title}</CardLabel2>
|
||||||
|
<CardLabel2>{item.score}</CardLabel2>
|
||||||
|
</li>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</CardWrapper>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Card.propTypes = {
|
||||||
|
// label: PropTypes.string,
|
||||||
|
// title: PropTypes.string.isRequired,
|
||||||
|
// picture: PropTypes.string,
|
||||||
|
// }
|
||||||
|
|
||||||
|
export default WinLoss
|
||||||
@ -1,58 +1,27 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ReactDOM from 'react-dom/client';
|
import ReactDOM from 'react-dom/client';
|
||||||
|
import { BrowserRouter } from 'react-router-dom';
|
||||||
|
|
||||||
|
import reportWebVitals from './reportWebVitals';
|
||||||
|
import Header from './components/Header';
|
||||||
|
import Head from './pages/Head';
|
||||||
|
import App from './components/App';
|
||||||
|
|
||||||
import './styles/index.css';
|
import './styles/index.css';
|
||||||
import App from './components/App';
|
import './styles/App.css'
|
||||||
import Header from './components/Header';
|
|
||||||
// import Home from './components/Home';
|
|
||||||
// import Login42 from './components/Login42';
|
|
||||||
import Head from './components/Head';
|
|
||||||
// import Field from './components/Field';
|
|
||||||
// import PlayButton from './components/PlayButton';
|
|
||||||
import reportWebVitals from './reportWebVitals';
|
|
||||||
// import SuccessToken from './script/tokenSuccess'
|
|
||||||
import { BrowserRouter, Route, Routes, Navigate} from 'react-router-dom'
|
|
||||||
|
|
||||||
// let redirectToUrl;
|
|
||||||
// if (localStorage.getItem('token') !== null) //check condition
|
|
||||||
// {
|
|
||||||
// redirectToUrl = <Navigate to='/'/>;
|
|
||||||
// }
|
|
||||||
|
|
||||||
const root = ReactDOM.createRoot(document.getElementById('root'));
|
const root = ReactDOM.createRoot(document.getElementById('root'));
|
||||||
root.render(
|
root.render(
|
||||||
<>
|
<div className='App'>
|
||||||
<Head />
|
<Head />
|
||||||
<Header />
|
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<App></App>
|
<Header />
|
||||||
|
<App/>
|
||||||
</BrowserRouter>
|
</BrowserRouter>
|
||||||
</>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
// If you want to start measuring performance in your app, pass a function
|
// If you want to start measuring performance in your app, pass a function
|
||||||
// to log results (for example: reportWebVitals(console.log))
|
// to log results (for example: reportWebVitals(console.log))
|
||||||
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
||||||
reportWebVitals();
|
reportWebVitals();
|
||||||
|
|
||||||
{/* <Route exact path="/login42" element={<Login42 />}/> */}
|
|
||||||
// <Routes>
|
|
||||||
// {/* {redirectToUrl} */}
|
|
||||||
// <Route exact path="/" element={<Home/>}/>
|
|
||||||
// <Route exact path="/pong" element={<PlayButton />}/>
|
|
||||||
// <Route exact path="/pong/play" element={<Field />}/>
|
|
||||||
// <Route exact path="/token" element={<SuccessToken />}/>
|
|
||||||
|
|
||||||
// <Route path='*' element={<Navigate to='/' />} />
|
|
||||||
|
|
||||||
// {/* <Route path="*"><Navigate to="/" /></Route>
|
|
||||||
// */}
|
|
||||||
|
|
||||||
// {/* Gestion des pages inexistantes */}
|
|
||||||
|
|
||||||
// {/* ------- ROUTE FOR CHAT APP HERE --------- */}
|
|
||||||
// {/* <Route exact path="/chat" element={<NOM DU COMPONENT == index dans le tuto/>}/> */}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// </Routes>
|
|
||||||
31
containers/react/src/pages/App.js
Normal file
31
containers/react/src/pages/App.js
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import React from "react";
|
||||||
|
import {Routes, Route} from 'react-router-dom';
|
||||||
|
import Home from "../pages/Home.jsx";
|
||||||
|
import PlayButton from "../pages/PlayButton.js";
|
||||||
|
import Field from "../pages/Field";
|
||||||
|
import Login42 from "../pages/Login42.js";
|
||||||
|
import Messages from "../pages/Messages.jsx";
|
||||||
|
import { useLocation } from "react-router-dom";
|
||||||
|
import {AnimatePresence} from "framer-motion";
|
||||||
|
|
||||||
|
import SuccessToken from '../script/tokenSuccess'
|
||||||
|
|
||||||
|
function App () {
|
||||||
|
const location = useLocation();
|
||||||
|
return (
|
||||||
|
<AnimatePresence>
|
||||||
|
<Routes location={location} key={location.pathname}>
|
||||||
|
|
||||||
|
<Route exact path="/" element={<Home/>}/>
|
||||||
|
<Route exact path="/token" element={<SuccessToken />}/>
|
||||||
|
<Route exact path="/pong/play" element={<Field />}/>
|
||||||
|
<Route path="/game" element={<PlayButton />}/>
|
||||||
|
<Route exact path="/login42" element={<Login42 />}/>
|
||||||
|
|
||||||
|
<Route exact path="/messages" element={<Messages />}/>
|
||||||
|
</Routes>
|
||||||
|
</AnimatePresence>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default App
|
||||||
20
containers/react/src/pages/Chat.js
Normal file
20
containers/react/src/pages/Chat.js
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
||||||
|
import Home from './components/Home';
|
||||||
|
import ChatPage from './components/ChatPage';
|
||||||
|
import socketIO from 'socket.io-client';
|
||||||
|
|
||||||
|
const socket = socketIO.connect('http://localhost:4000');
|
||||||
|
function App() {
|
||||||
|
return (
|
||||||
|
<BrowserRouter>
|
||||||
|
<div>
|
||||||
|
<Routes>
|
||||||
|
<Route path="/" element={<Home socket={socket} />}></Route>
|
||||||
|
<Route path="/chat" element={<ChatPage socket={socket} />}></Route>
|
||||||
|
</Routes>
|
||||||
|
</div>
|
||||||
|
</BrowserRouter>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default App;
|
||||||
72
containers/react/src/pages/Field.js
Normal file
72
containers/react/src/pages/Field.js
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
import { useEffect } from 'react';
|
||||||
|
// import { useState, useRef } from 'react';
|
||||||
|
import { drawCanvas } from './canvas.js';
|
||||||
|
import '../styles/field.css';
|
||||||
|
|
||||||
|
function Field()
|
||||||
|
{
|
||||||
|
useEffect(() => {
|
||||||
|
console.log("launch canva hehe")
|
||||||
|
drawCanvas();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// const [buttonClicked, setButtonClicked] = useState(false);
|
||||||
|
|
||||||
|
// const handleButtonClick = () => {
|
||||||
|
// drawCanvas();
|
||||||
|
// setButtonClicked(true);
|
||||||
|
// };
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="field" id="canvas_container">
|
||||||
|
<canvas id="myCanvas"></canvas>
|
||||||
|
{/* <button onClick={handleButtonClick}>Draw on Canvas</button> */}
|
||||||
|
{/* {buttonClicked && <canvas id="myCanvas"></canvas>}
|
||||||
|
{!buttonClicked && <button onClick={handleButtonClick}>Draw on Canvas</button>} */}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Field;
|
||||||
|
|
||||||
|
|
||||||
|
// function Field() {
|
||||||
|
// const [buttonClicked, setButtonClicked] = useState(false);
|
||||||
|
|
||||||
|
// const handleButtonClick = () => {
|
||||||
|
// const canvas = document.createElement('canvas');
|
||||||
|
// canvas.id = 'myCanvas';
|
||||||
|
// console.log("button clicked")
|
||||||
|
// document.getElementById('canvas_container').appendChild(canvas);
|
||||||
|
// setButtonClicked(true);
|
||||||
|
// drawCanvas(canvas);
|
||||||
|
// };
|
||||||
|
// setButtonClicked(true);
|
||||||
|
// return (
|
||||||
|
// // <div className="field" id="canvas_container">
|
||||||
|
// <div className={`notClicked ${buttonClicked ? 'clicked' : ''}`} id="canvas_container">
|
||||||
|
// {!buttonClicked && <button className="playButton" onClick={handleButtonClick}>Play</button>}
|
||||||
|
// </div>
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
|
// export default Field;
|
||||||
|
|
||||||
|
// function draw() {
|
||||||
|
// // Effacer le canvas
|
||||||
|
// ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||||
|
|
||||||
|
// // Dessiner la raquette
|
||||||
|
// ctx.fillRect(canvas.width - paddleWidth, paddleY, paddleWidth, paddleHeight);
|
||||||
|
|
||||||
|
// // Appeler la fonction draw à chaque frame
|
||||||
|
// requestAnimationFrame(draw);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// draw(); // Appeler la fonction draw pour la première fois
|
||||||
|
|
||||||
|
// const canvas = document.getElementById('myCanvas');
|
||||||
|
// canvas.width = 500;
|
||||||
|
// canvas.height = 500;
|
||||||
|
// const ctx = canvas.getContext('2d');
|
||||||
|
// ctx.fillRect(50, 50, 1000, 1000);
|
||||||
12
containers/react/src/pages/Footer.js
Normal file
12
containers/react/src/pages/Footer.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import '../styles/old.css';
|
||||||
|
|
||||||
|
function Footer()
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
<footer>
|
||||||
|
<p>@apommier | apommier@student.42.fr</p>
|
||||||
|
</footer>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Footer;
|
||||||
16
containers/react/src/pages/Head.js
Normal file
16
containers/react/src/pages/Head.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
function Head()
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<meta charSet="utf-8"></meta>
|
||||||
|
<link href="./css/header.css" rel="stylesheet"></link>
|
||||||
|
<title>BEST PONG EVER</title>
|
||||||
|
{/* <script src="./script/login.js"></script> */}
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com"></link>
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="true"></link>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Rubik+Iso&display=swap" rel="stylesheet"></link>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Head;
|
||||||
23
containers/react/src/pages/Header.js
Normal file
23
containers/react/src/pages/Header.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import '../styles/App.css';
|
||||||
|
import '../styles/old.css';
|
||||||
|
import logo from '../logo.svg';
|
||||||
|
|
||||||
|
function Header()
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
<div className="header">
|
||||||
|
<a href="http://localhost" className="box menu"> <p className="userTxt">Menu</p> </a>
|
||||||
|
<div className="box headerName">
|
||||||
|
<a href="https://api.intra.42.fr/oauth/authorize?client_id=u-s4t2ud-6d29dfa49ba7146577ffd8bf595ae8d9e5aaa3e0a9615df18777171ebf836a41&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Flogin42&response_type=code"
|
||||||
|
className="center pong">PONG</a>
|
||||||
|
</div>
|
||||||
|
<a href="http://localhost/pong" className="box username">
|
||||||
|
<p className="userTxt">Play</p>
|
||||||
|
{/* <img className="pp center" src="../../public/logo192.png" alt="profile picture"> */}
|
||||||
|
<img src={logo} className="pp center" alt="logo" />
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Header;
|
||||||
49
containers/react/src/pages/Home.js
Normal file
49
containers/react/src/pages/Home.js
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
import '../styles/old.css';
|
||||||
|
import '../styles/field.css';
|
||||||
|
|
||||||
|
import { useLocation } from 'react-router-dom';
|
||||||
|
import api from '../script/axiosApi';
|
||||||
|
|
||||||
|
function HomeLogin()
|
||||||
|
{
|
||||||
|
const login2 = () => {
|
||||||
|
console.log('Hello from myFunction');
|
||||||
|
api.get('/profile').then((response) => {
|
||||||
|
const data = response;
|
||||||
|
const myJSON = JSON.stringify(response.data);
|
||||||
|
console.log(`data response= ${myJSON}`)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const location = useLocation();
|
||||||
|
|
||||||
|
const handleButtonClick = () => {
|
||||||
|
const token = localStorage.getItem('token')
|
||||||
|
console.log(`token type= ${typeof token}`);
|
||||||
|
if (token !== null && typeof token === 'string')
|
||||||
|
{
|
||||||
|
console.log(`already token= ${localStorage.getItem('token')}`)
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
// else
|
||||||
|
let path = "https://api.intra.42.fr/oauth/authorize?client_id=u-s4t2ud-6d29dfa49ba7146577ffd8bf595ae8d9e5aaa3e0a9615df18777171ebf836a41&redirect_uri=http%3A%2F%2Flocalhost%3A80%2Fapi%2Fauth%2Flogin&response_type=code";
|
||||||
|
window.location.replace(path);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="notClicked">
|
||||||
|
<button onClick={handleButtonClick} className="playButton" >LOGIN</button>
|
||||||
|
{/* <div className ="loginForm">
|
||||||
|
<button className="submit" onClick={login2}>test button</button>
|
||||||
|
</div> */}
|
||||||
|
{/* <div className ="loginForm">
|
||||||
|
<button className="submit" onClick={() => api.post('/win')}>add win</button>
|
||||||
|
</div>
|
||||||
|
<div className ="loginForm">
|
||||||
|
<button className="submit" onClick={() => api.post('/loss')}>add loss</button>
|
||||||
|
</div> */}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default HomeLogin;
|
||||||
34
containers/react/src/pages/Home.jsx
Normal file
34
containers/react/src/pages/Home.jsx
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import React from "react";
|
||||||
|
import '../styles/Profile.css'
|
||||||
|
import '../styles/App.css'
|
||||||
|
import DefaultPicture from "../assets/profile.jpg";
|
||||||
|
// import WinLoss from "../components/Win_Loss";
|
||||||
|
import { motion } from 'framer-motion'
|
||||||
|
// import {AiOutlineHistory} from 'react-icons/ai'
|
||||||
|
import { Link } from "react-router-dom";
|
||||||
|
import UserProfile from "../DataBase/DataProfileUser";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function Home () {
|
||||||
|
let name = UserProfile.UserName
|
||||||
|
return (
|
||||||
|
<motion.div className="App"
|
||||||
|
initial={{opacity: 0}}
|
||||||
|
animate={{opacity: 1}}
|
||||||
|
exit={{opacity: 0}}>
|
||||||
|
<div className="profile">
|
||||||
|
<img className="profile-pic" src={DefaultPicture} alt="Profile pic" />
|
||||||
|
<h1>Dipper Ratman</h1>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div className="history">
|
||||||
|
<Link to='#' className=" history">Match history</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</motion.div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Home
|
||||||
43
containers/react/src/pages/Login42.js
Normal file
43
containers/react/src/pages/Login42.js
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
// import GoogleLogin from 'react-google-login';
|
||||||
|
import { useEffect } from 'react';
|
||||||
|
import axios from 'axios';
|
||||||
|
// import setupLogin from '../script/login42';
|
||||||
|
// import React, { useEffect } from 'react';
|
||||||
|
|
||||||
|
function Login42()
|
||||||
|
{
|
||||||
|
useEffect(() => {
|
||||||
|
console.log("you said yes to connect with 42");
|
||||||
|
const url = new URL(window.location.href);
|
||||||
|
// console.log(`url is= ${url}`);
|
||||||
|
const code = url.searchParams.get('code');
|
||||||
|
console.log(`code is= ${code}`);
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
grant_type: 'authorization_code',
|
||||||
|
client_id: 'u-s4t2ud-6d29dfa49ba7146577ffd8bf595ae8d9e5aaa3e0a9615df18777171ebf836a41',
|
||||||
|
client_secret: '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',
|
||||||
|
code: code,
|
||||||
|
redirect_uri: 'http://localhost:8080/login42',
|
||||||
|
};
|
||||||
|
|
||||||
|
axios.post('https://api.intra.42.fr/oauth/token', data)
|
||||||
|
.then(response => {
|
||||||
|
// handle success response
|
||||||
|
console.log(response);
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
// handle error response
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<p>"COUCOU LOGIN$@ jeje" </p>
|
||||||
|
{/* <script src="../script/login42.js"></script> */}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Login42;
|
||||||
45
containers/react/src/pages/Messages.jsx
Normal file
45
containers/react/src/pages/Messages.jsx
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
import React from "react";
|
||||||
|
import Sidebar from '../components/Messages/Sidebar'
|
||||||
|
import Chat from "../components/Messages/Chat"
|
||||||
|
import '../styles/Messages.css'
|
||||||
|
import { motion } from 'framer-motion'
|
||||||
|
|
||||||
|
// import {io} from 'socket.io-client'
|
||||||
|
|
||||||
|
function Messages(params) {
|
||||||
|
// const socket = useRef(io("ws://localhost:8900"))
|
||||||
|
|
||||||
|
// useEffect(() => {
|
||||||
|
// setSocket(io("ws://localhost:8900"))
|
||||||
|
// }, [])
|
||||||
|
// const socket = socketIO.connect('http://localhost:4000');
|
||||||
|
|
||||||
|
// axios.get('http://localhost/api/user/id')
|
||||||
|
// .then(function());
|
||||||
|
|
||||||
|
// console.log(socket)
|
||||||
|
// useEffect(() => {
|
||||||
|
// socket.current.emit("addUser", user._id);
|
||||||
|
// socket.current.on("getUsers", users=>{
|
||||||
|
// console.log(users)
|
||||||
|
// })
|
||||||
|
// }, [user])
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{/* <div>
|
||||||
|
<h1>Welcome to the messages page</h1>
|
||||||
|
</div> */}
|
||||||
|
<motion.div className="home"
|
||||||
|
initial={{opacity: 0}}
|
||||||
|
animate={{opacity: 1}}
|
||||||
|
exit={{opacity: 0}}>
|
||||||
|
<div className="container">
|
||||||
|
<Sidebar/>
|
||||||
|
<Chat/>
|
||||||
|
</div>
|
||||||
|
</motion.div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Messages
|
||||||
23
containers/react/src/pages/NewLogin.js
Normal file
23
containers/react/src/pages/NewLogin.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import '../styles/field.css';
|
||||||
|
// import { useHistory } from 'react-router-dom';
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
|
function PlayButton() {
|
||||||
|
|
||||||
|
const history = useNavigate();
|
||||||
|
|
||||||
|
const handleButtonClick = () => {
|
||||||
|
let path = `play`;
|
||||||
|
history(path);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="notClicked" id="canvas_container">
|
||||||
|
<button onClick={handleButtonClick} className="playButton">Play</button>
|
||||||
|
{/* !buttonClicked && <button onClick={handleButtonClick}>Draw on Canvas</button> */}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default PlayButton;
|
||||||
23
containers/react/src/pages/PlayButton.js
Normal file
23
containers/react/src/pages/PlayButton.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import '../styles/field.css';
|
||||||
|
// import { useHistory } from 'react-router-dom';
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
|
function PlayButton() {
|
||||||
|
|
||||||
|
const history = useNavigate();
|
||||||
|
|
||||||
|
const handleButtonClick = () => {
|
||||||
|
let path = `play`;
|
||||||
|
history(path);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="notClicked" id="canvas_container">
|
||||||
|
<button onClick={handleButtonClick} className="playButton">Play</button>
|
||||||
|
{/* !buttonClicked && <button onClick={handleButtonClick}>Draw on Canvas</button> */}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default PlayButton;
|
||||||
514
containers/react/src/pages/canvas.js
Normal file
514
containers/react/src/pages/canvas.js
Normal file
@ -0,0 +1,514 @@
|
|||||||
|
// import io from 'socket.io-client';
|
||||||
|
|
||||||
|
import api from '../script/axiosApi';
|
||||||
|
|
||||||
|
// import { useEffect } from 'react';
|
||||||
|
import io from 'socket.io-client';
|
||||||
|
// const socket = io('http://192.168.1.14:4000');
|
||||||
|
// const socket = io('http://86.209.110.20:4000');
|
||||||
|
// const socket = io('http://172.29.113.91:4000');
|
||||||
|
|
||||||
|
export function drawCanvas() {
|
||||||
|
const socket = io('http://localhost:4000');
|
||||||
|
// const socket = io()
|
||||||
|
console.log("start function");
|
||||||
|
const canvas = document.getElementById('myCanvas');
|
||||||
|
const ctx = canvas.getContext('2d');
|
||||||
|
|
||||||
|
//========================================================================================================
|
||||||
|
//========================================================================================================
|
||||||
|
// Var Declaration
|
||||||
|
//========================================================================================================
|
||||||
|
//========================================================================================================
|
||||||
|
|
||||||
|
//socket
|
||||||
|
let myId = 0;
|
||||||
|
let gameId = 0;
|
||||||
|
let opName;
|
||||||
|
let opRank;
|
||||||
|
|
||||||
|
//general canvas
|
||||||
|
const scale = window.devicePixelRatio;
|
||||||
|
canvas.width = canvas.offsetWidth;
|
||||||
|
canvas.height = canvas.offsetHeight;
|
||||||
|
|
||||||
|
//paddle var
|
||||||
|
let paddleWidth = canvas.width * 0.01;
|
||||||
|
let paddleHeight = canvas.height * 0.25;
|
||||||
|
let paddleY = canvas.height / 2 - (paddleHeight / 2);
|
||||||
|
let paddleX = canvas.width / 40;
|
||||||
|
let paddleSpeed = canvas.height / 40;
|
||||||
|
|
||||||
|
//opponent var
|
||||||
|
let oPaddleY = paddleY;
|
||||||
|
|
||||||
|
//mouse and touch
|
||||||
|
let lastMouseY = 0;
|
||||||
|
let lastTouchY = 0;
|
||||||
|
|
||||||
|
//ball var
|
||||||
|
let ballX = canvas.width / 2;
|
||||||
|
let ballY = canvas.height / 2;
|
||||||
|
|
||||||
|
//ball display
|
||||||
|
let ballRadius = canvas.width * 0.01;
|
||||||
|
let circleRadius = ballRadius * 3;
|
||||||
|
ctx.lineWidth = (canvas.width / 300);
|
||||||
|
|
||||||
|
//ball vector
|
||||||
|
let vX = 0;
|
||||||
|
let vY = 0;
|
||||||
|
|
||||||
|
//score
|
||||||
|
let myScore = 0;
|
||||||
|
let hisScore = 0;
|
||||||
|
const maxScore = 5;
|
||||||
|
|
||||||
|
let lastUpdateTime = performance.now();
|
||||||
|
|
||||||
|
const maxAngle = 50;
|
||||||
|
let maxBounceAngle = (maxAngle * Math.PI) / 180;
|
||||||
|
|
||||||
|
//========================================================================================================
|
||||||
|
//========================================================================================================
|
||||||
|
// Socket handler
|
||||||
|
//========================================================================================================
|
||||||
|
//========================================================================================================
|
||||||
|
|
||||||
|
function matchmaking()
|
||||||
|
{
|
||||||
|
console.log(`id ion matcj= ${myId}`)
|
||||||
|
const info = {
|
||||||
|
id: myId,
|
||||||
|
};
|
||||||
|
socket.emit('pong:matchmaking', info);
|
||||||
|
}
|
||||||
|
|
||||||
|
// socket.on('pong:gameId', (data) => {
|
||||||
|
// console.log("gameId received")
|
||||||
|
// gameId = data;
|
||||||
|
// // api.get('/profile');
|
||||||
|
|
||||||
|
// let myName;
|
||||||
|
|
||||||
|
// api.get('/profile').then((data) => {
|
||||||
|
// // Faire quelque chose avec les données
|
||||||
|
// console.log(data);
|
||||||
|
// myName = data.data.username;
|
||||||
|
// console.log(`myname= ${myName}`);
|
||||||
|
// }).catch((error) => {
|
||||||
|
// console.log(error);
|
||||||
|
// // exit() ;
|
||||||
|
// return;
|
||||||
|
// });
|
||||||
|
|
||||||
|
// const info = {
|
||||||
|
// id: myId,
|
||||||
|
// name: myName,
|
||||||
|
// gameId: gameId,
|
||||||
|
// };
|
||||||
|
// console.log("emit to name")
|
||||||
|
// socket.emit('pong:name', info);
|
||||||
|
// });
|
||||||
|
|
||||||
|
socket.on('pong:gameId', async (data) => {
|
||||||
|
console.log("gameId received");
|
||||||
|
gameId = data;
|
||||||
|
|
||||||
|
try {
|
||||||
|
let response = await api.get('/profile');
|
||||||
|
const myName = response.data.username;
|
||||||
|
response = await api.get('/rank');
|
||||||
|
opRank = response.data
|
||||||
|
console.log(`rank= ${opRank}`);
|
||||||
|
console.log(`myname= ${myName}`);
|
||||||
|
|
||||||
|
const info = {
|
||||||
|
id: myId,
|
||||||
|
name: myName,
|
||||||
|
gameId: gameId,
|
||||||
|
rank: opRank,
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log("emit to name");
|
||||||
|
socket.emit('pong:name', info);
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
// Handle error here
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('pong:name', (data) => {
|
||||||
|
opName = data;
|
||||||
|
console.log(`opponent Name= ${opName}`)
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('connect', () => {
|
||||||
|
console.log('Connected to NestJS server');
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('pong:clientId', (data) => {
|
||||||
|
console.log("receive id")
|
||||||
|
myId = data;
|
||||||
|
console.log(`id is= ${myId}`)
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.on('pong:info', (data) => {
|
||||||
|
oPaddleY = (data.paddleY / data.height) * canvas.height//canvas.height - data.ballY;
|
||||||
|
ballX = canvas.width - (data.ballX * (canvas.width / data.width));//- data.ballX;
|
||||||
|
ballY = ((data.ballY / data.height) * canvas.height)//canvas.height - data.ballY;
|
||||||
|
|
||||||
|
vX = -data.vX;
|
||||||
|
vY = data.vY;
|
||||||
|
});
|
||||||
|
|
||||||
|
function send_info()
|
||||||
|
{
|
||||||
|
if (gameId === 0)
|
||||||
|
return ;
|
||||||
|
const info = {
|
||||||
|
id: myId,
|
||||||
|
width: canvas.width,
|
||||||
|
height: canvas.height,
|
||||||
|
paddleY: paddleY,
|
||||||
|
vX: vX,
|
||||||
|
vY: vY,
|
||||||
|
ballX: ballX,
|
||||||
|
ballY: ballY,
|
||||||
|
gameId: gameId,
|
||||||
|
};
|
||||||
|
socket.emit('pong:message', info);
|
||||||
|
}
|
||||||
|
|
||||||
|
socket.on('pong:paddle', (data) => {
|
||||||
|
console.log("paddle info receive")
|
||||||
|
oPaddleY = (data.paddleY / data.height) * canvas.height
|
||||||
|
});
|
||||||
|
|
||||||
|
function send_point()
|
||||||
|
{
|
||||||
|
if (gameId === 0)
|
||||||
|
return ;
|
||||||
|
console.log("send point");
|
||||||
|
const info = {
|
||||||
|
id: myId,
|
||||||
|
gameId: gameId,
|
||||||
|
point: hisScore,
|
||||||
|
}
|
||||||
|
socket.emit('pong:point', info);
|
||||||
|
}
|
||||||
|
|
||||||
|
socket.on('pong:point', (data) => {
|
||||||
|
// hisScore += 1;
|
||||||
|
console.log("gain point");
|
||||||
|
// if (vX != 0)
|
||||||
|
// {
|
||||||
|
// console.log("up point");
|
||||||
|
myScore = data.point;
|
||||||
|
// }
|
||||||
|
vX = 0;
|
||||||
|
vY = 0;
|
||||||
|
ballX = canvas.width / 2;
|
||||||
|
ballY = canvas.height / 2;
|
||||||
|
});
|
||||||
|
|
||||||
|
function send_paddle_info()
|
||||||
|
{
|
||||||
|
if (gameId === 0)
|
||||||
|
return ;
|
||||||
|
const info = {
|
||||||
|
id: myId,
|
||||||
|
paddleY: paddleY,
|
||||||
|
// width: canvas.width,
|
||||||
|
height: canvas.height,
|
||||||
|
gameId: gameId,
|
||||||
|
};
|
||||||
|
socket.emit('pong:paddle', info);
|
||||||
|
}
|
||||||
|
|
||||||
|
function send_forced_info()
|
||||||
|
{
|
||||||
|
if (gameId === 0)
|
||||||
|
return ;
|
||||||
|
const info = {
|
||||||
|
gameId: gameId,
|
||||||
|
width: canvas.width,
|
||||||
|
height: canvas.height,
|
||||||
|
id: myId,
|
||||||
|
paddleY: paddleY,
|
||||||
|
vX: vX,
|
||||||
|
vY: vY,
|
||||||
|
ballX: ballX,
|
||||||
|
ballY: ballY,
|
||||||
|
};
|
||||||
|
socket.emit('pong:forced', info);
|
||||||
|
}
|
||||||
|
|
||||||
|
//========================================================================================================
|
||||||
|
//========================================================================================================
|
||||||
|
// Drawer
|
||||||
|
//========================================================================================================
|
||||||
|
//========================================================================================================
|
||||||
|
|
||||||
|
function drawcenter()
|
||||||
|
{
|
||||||
|
// ctx.restore();
|
||||||
|
ctx.fillStyle = 'white';
|
||||||
|
ctx.fillRect(canvas.width / 2 - ctx.lineWidth / 2, 0, canvas.width / 300, canvas.height);
|
||||||
|
|
||||||
|
ctx.beginPath();
|
||||||
|
// ctx.lineWidth = 5;
|
||||||
|
ctx.arc(canvas.width / 2, canvas.height / 2, circleRadius, 0, 2 * Math.PI);
|
||||||
|
ctx.strokeStyle = 'white'; // couleur de dessin
|
||||||
|
ctx.stroke(); // dessin du contour
|
||||||
|
|
||||||
|
ctx.font = canvas.width * 0.1 + "px Arial";
|
||||||
|
ctx.textAlign = "center";
|
||||||
|
ctx.textBaseline = "middle";
|
||||||
|
ctx.fillText(myScore, canvas.width/4, canvas.height/8);
|
||||||
|
ctx.fillText(hisScore, canvas.width/1.25, canvas.height/8);
|
||||||
|
}
|
||||||
|
|
||||||
|
function drawPaddle() {
|
||||||
|
ctx.fillStyle = 'white';
|
||||||
|
ctx.fillRect(paddleX, paddleY, paddleWidth, paddleHeight);
|
||||||
|
ctx.fillRect(canvas.width - paddleX - paddleWidth, oPaddleY, paddleWidth, paddleHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
function drawball()
|
||||||
|
{
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.arc(ballX, ballY, ballRadius, 0, 2 * Math.PI);
|
||||||
|
// ctx.lineWidth = 2;
|
||||||
|
ctx.fillStyle = 'red ';
|
||||||
|
ctx.fill();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//========================================================================================================
|
||||||
|
//========================================================================================================
|
||||||
|
// Loop
|
||||||
|
//========================================================================================================
|
||||||
|
//========================================================================================================
|
||||||
|
|
||||||
|
matchmaking();
|
||||||
|
// while (!gameId)
|
||||||
|
// ;
|
||||||
|
|
||||||
|
|
||||||
|
function draw(timestamp)
|
||||||
|
{
|
||||||
|
if (gameId === 0 )
|
||||||
|
{
|
||||||
|
requestAnimationFrame(draw);
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
if (myScore === maxScore || hisScore === maxScore)
|
||||||
|
{
|
||||||
|
const data = {
|
||||||
|
myScore: myScore,
|
||||||
|
opScore: hisScore,
|
||||||
|
opName: opName,
|
||||||
|
opRank: opRank,
|
||||||
|
};
|
||||||
|
if (myScore === maxScore)
|
||||||
|
{
|
||||||
|
api.post('/win', data);
|
||||||
|
console.log("send win");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
api.post('/loss', data);
|
||||||
|
console.log("send loose");
|
||||||
|
}
|
||||||
|
window.location.replace("http://localhost/pong");
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
const deltaTime = timestamp - lastUpdateTime;
|
||||||
|
lastUpdateTime = timestamp;
|
||||||
|
ballX += vX * deltaTime * canvas.width;
|
||||||
|
ballY += vY * deltaTime * canvas.width;
|
||||||
|
|
||||||
|
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||||
|
drawPaddle();
|
||||||
|
drawcenter();
|
||||||
|
drawball();
|
||||||
|
is_collision();
|
||||||
|
is_out();
|
||||||
|
requestAnimationFrame(draw);
|
||||||
|
}
|
||||||
|
requestAnimationFrame(draw);
|
||||||
|
|
||||||
|
//========================================================================================================
|
||||||
|
//========================================================================================================
|
||||||
|
// Logical Part
|
||||||
|
//========================================================================================================
|
||||||
|
//========================================================================================================
|
||||||
|
|
||||||
|
function updateVector()
|
||||||
|
{
|
||||||
|
const relativeBallY = ballY - (paddleY + paddleHeight / 2);
|
||||||
|
const normalizedRelativeBallY = relativeBallY / (paddleHeight / 2);
|
||||||
|
const bounceAngle = normalizedRelativeBallY * maxBounceAngle;
|
||||||
|
|
||||||
|
vY = vX * Math.sin(-bounceAngle);
|
||||||
|
if (vX < 0)
|
||||||
|
vX = -vX;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function updatePaddlePosition(newY)
|
||||||
|
{
|
||||||
|
if (newY >= 0 && newY <= canvas.height - paddleHeight)
|
||||||
|
paddleY = newY;
|
||||||
|
}
|
||||||
|
|
||||||
|
function is_collision()
|
||||||
|
{
|
||||||
|
if (ballX <= paddleX + paddleWidth + ballRadius)
|
||||||
|
{
|
||||||
|
if (ballY <= paddleY + paddleHeight + ballRadius && ballY >= paddleY - ballRadius)//touch paddle
|
||||||
|
{
|
||||||
|
if (ballX + ballRadius > paddleX && ballX - ballRadius < paddleX + paddleWidth)
|
||||||
|
{
|
||||||
|
console.log("hehe here")
|
||||||
|
ballX = paddleX + paddleWidth + ballRadius;
|
||||||
|
}
|
||||||
|
updateVector();
|
||||||
|
}
|
||||||
|
send_info();
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
if (ballY - ballRadius - 2 <= 0 || ballY + ballRadius + 2 >= canvas.height) //touch up or down wall
|
||||||
|
{
|
||||||
|
vY = -vY;
|
||||||
|
// send_info();
|
||||||
|
}
|
||||||
|
else if (ballX + ballRadius + 2 >= canvas.width) //touch right wall
|
||||||
|
{
|
||||||
|
vX = -vX;
|
||||||
|
// send_info();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function is_out()
|
||||||
|
{
|
||||||
|
if (ballX < 0)
|
||||||
|
{
|
||||||
|
if (ballY <= paddleY + paddleHeight + ballRadius && ballY >= paddleY - ballRadius)
|
||||||
|
{
|
||||||
|
console.log('true hehe');
|
||||||
|
ballX = paddleX + paddleWidth + ballRadius;
|
||||||
|
updateVector();
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
ballX = canvas.width / 2;
|
||||||
|
ballY = canvas.height / 2;
|
||||||
|
vX = 0;
|
||||||
|
vY = 0;
|
||||||
|
hisScore += 1;
|
||||||
|
send_point();
|
||||||
|
// send_forced_info();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//========================================================================================================
|
||||||
|
//========================================================================================================
|
||||||
|
// Listener
|
||||||
|
//========================================================================================================
|
||||||
|
//========================================================================================================
|
||||||
|
|
||||||
|
|
||||||
|
document.addEventListener('mousemove', event => {
|
||||||
|
const mouseY = event.clientY;
|
||||||
|
|
||||||
|
if (!lastMouseY)
|
||||||
|
{
|
||||||
|
lastMouseY = mouseY;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const newY = mouseY > lastMouseY ? paddleY - (lastMouseY - mouseY) : paddleY + (mouseY - lastMouseY);
|
||||||
|
updatePaddlePosition(newY);
|
||||||
|
lastMouseY = mouseY;
|
||||||
|
send_paddle_info();
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener("touchmove", event => {
|
||||||
|
const touchY = event.touches[0].pageY;
|
||||||
|
|
||||||
|
// if (!lastTouchY)
|
||||||
|
// {
|
||||||
|
// vX = -0.01;
|
||||||
|
// lastTouchY = touchY;
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
const newY = touchY > lastTouchY ? paddleY - (lastTouchY - touchY) : paddleY + (touchY - lastTouchY);
|
||||||
|
updatePaddlePosition(newY);
|
||||||
|
lastTouchY = touchY;
|
||||||
|
send_paddle_info();
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener("keydown", event => {
|
||||||
|
// console.log(event.code);
|
||||||
|
if (event.code === "ArrowUp")
|
||||||
|
{
|
||||||
|
if ((paddleY - paddleSpeed) > 0)
|
||||||
|
paddleY -= paddleSpeed; // déplacer la raquette vers le haut
|
||||||
|
send_paddle_info();
|
||||||
|
}
|
||||||
|
else if (event.code === "ArrowDown")
|
||||||
|
{
|
||||||
|
if (paddleY + paddleSpeed < canvas.height - paddleHeight)
|
||||||
|
paddleY += paddleSpeed; // déplacer la raquette vers le bas
|
||||||
|
send_paddle_info();
|
||||||
|
}
|
||||||
|
else if (event.code === "Space")//space
|
||||||
|
{
|
||||||
|
console.log('vx change to -1');
|
||||||
|
vX = -0.0001;
|
||||||
|
|
||||||
|
// ballSpeed = 0.0001;
|
||||||
|
vY = 0;
|
||||||
|
send_forced_info();
|
||||||
|
// vX = 0.0001;
|
||||||
|
}
|
||||||
|
else if (event.code === "KeyE")
|
||||||
|
{
|
||||||
|
// console.log('vx change to -1');
|
||||||
|
vX = 0;
|
||||||
|
vY = 0;
|
||||||
|
ballX = canvas.width / 2;
|
||||||
|
ballY = canvas.height / 2;
|
||||||
|
send_forced_info();
|
||||||
|
}
|
||||||
|
else if (event.code === "KeyQ" )
|
||||||
|
{
|
||||||
|
if (vX < 0.003 * canvas.width && vX > -0.003 * canvas.width)
|
||||||
|
{
|
||||||
|
if (vX > 0)
|
||||||
|
vX += 0.0001;
|
||||||
|
else
|
||||||
|
vX -= 0.0001;
|
||||||
|
}
|
||||||
|
send_forced_info();
|
||||||
|
// console.log(`vx = ${vX}`);
|
||||||
|
}
|
||||||
|
else if (event.code === "KeyR")
|
||||||
|
{
|
||||||
|
paddleY = 0;
|
||||||
|
paddleHeight = canvas.height;
|
||||||
|
setTimeout(() => {
|
||||||
|
// code à exécuter après 5 secondes
|
||||||
|
paddleHeight = canvas.height * 0.25;
|
||||||
|
paddleY = canvas.height / 2 - paddleHeight / 2;
|
||||||
|
console.log('Cinq secondes se sont écoulées.');
|
||||||
|
}, 5000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
13
containers/react/src/script/login.js
Normal file
13
containers/react/src/script/login.js
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// export const login()
|
||||||
|
// {
|
||||||
|
// alert("Le bouton a été cliqué !");
|
||||||
|
// var formulaire = document.getElementById("loginForm");
|
||||||
|
// formulaire.submit();
|
||||||
|
// }
|
||||||
|
|
||||||
|
export const login = () => {
|
||||||
|
console.log('Hello from myFunction');
|
||||||
|
// alert("Le bouton a été cliqué !");
|
||||||
|
var formulaire = document.getElementById("loginForm");
|
||||||
|
formulaire.submit();
|
||||||
|
}
|
||||||
7
containers/react/src/script/login42.js
Normal file
7
containers/react/src/script/login42.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
// function setupLogin()
|
||||||
|
// {
|
||||||
|
// // alert("Le bouton a été cliqué !");
|
||||||
|
// console.log('Hello from login42');
|
||||||
|
// }
|
||||||
|
|
||||||
|
// export default setupLogin;
|
||||||
@ -4,32 +4,10 @@ import queryString from 'query-string';
|
|||||||
function SuccessToken() {
|
function SuccessToken() {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const { data } = queryString.parse(location.search);
|
const { data } = queryString.parse(location.search);
|
||||||
// localStorage data.token;
|
|
||||||
const cleanData = data.slice(1, -1);
|
const cleanData = data.slice(1, -1);
|
||||||
// console.log(`prout token= ${cleanData}`)
|
|
||||||
localStorage.setItem('token', `${cleanData}`);
|
localStorage.setItem('token', `${cleanData}`);
|
||||||
console.log(`prout token2= ${localStorage.getItem('token')}`)
|
console.log(`prout token2= ${localStorage.getItem('token')}`)
|
||||||
window.location.replace("http://localhost/pong");
|
window.location.replace("http://localhost/pong");
|
||||||
|
|
||||||
// return (
|
|
||||||
// <div>
|
|
||||||
// <h2>Success!</h2>
|
|
||||||
// <p>Data: {data}</p>
|
|
||||||
// </div>
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default SuccessToken;
|
export default SuccessToken;
|
||||||
|
|
||||||
|
|
||||||
// // Store a value in localStorage
|
|
||||||
// localStorage.setItem('key', 'value');
|
|
||||||
|
|
||||||
// // Retrieve a value from localStorage
|
|
||||||
// const value = localStorage.getItem('key');
|
|
||||||
|
|
||||||
// // Remove a value from localStorage
|
|
||||||
// localStorage.removeItem('key');
|
|
||||||
|
|
||||||
// // Clear all values from localStorage
|
|
||||||
// localStorage.clear();
|
|
||||||
@ -1,5 +1,6 @@
|
|||||||
.App {
|
.App {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
background-color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
.App-logo {
|
.App-logo {
|
||||||
|
|||||||
116
containers/react/src/styles/Header.css
Normal file
116
containers/react/src/styles/Header.css
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
.Header {
|
||||||
|
background-image: linear-gradient(90deg, #5843e4, #5a0760);
|
||||||
|
/* background-color: blue; */
|
||||||
|
|
||||||
|
height: 80px;
|
||||||
|
display: flex;
|
||||||
|
/* justify-content: start; */
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-bars {
|
||||||
|
margin-left: 2rem;
|
||||||
|
font-size: 2rem;
|
||||||
|
background: none;
|
||||||
|
color:#f5f5f5
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-menu{
|
||||||
|
background-color: #060b26;
|
||||||
|
width: 250px;
|
||||||
|
height: 100vh;
|
||||||
|
display: grid;
|
||||||
|
justify-content: center;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
transition: 350ms;
|
||||||
|
/* margin-top: 10px; */
|
||||||
|
|
||||||
|
/* left: -100%; */
|
||||||
|
/* transition: 850ms; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-menu.active {
|
||||||
|
left: 0;
|
||||||
|
transition: 350ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-text {
|
||||||
|
display: flex;
|
||||||
|
/* justify-content: start; */
|
||||||
|
align-items: center;
|
||||||
|
padding: 8px 0px 8px 16px;
|
||||||
|
list-style: none;
|
||||||
|
height: 60px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-text a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #f5f5f5;
|
||||||
|
font-size: 18px;
|
||||||
|
width: 95%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0 16px;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-text a:hover {
|
||||||
|
background-color: #5843e4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-menu-items {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.Header-toggle {
|
||||||
|
background-color: #060b26;
|
||||||
|
width: 100%;
|
||||||
|
height: 80px;
|
||||||
|
display: flex;
|
||||||
|
/* justify-content: start; */
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
span {
|
||||||
|
margin-left: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.Header-pic {
|
||||||
|
height: 50px;
|
||||||
|
width: 50px;
|
||||||
|
border: solid;
|
||||||
|
border-color: black;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-pic{
|
||||||
|
text-align: end;
|
||||||
|
/* id: right; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
height: 0.1px;
|
||||||
|
color: #060b26;
|
||||||
|
}
|
||||||
|
|
||||||
|
.end{
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-right: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.backdrop{
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
/* background: #000000e1; */
|
||||||
|
backdrop-filter: blur(1.5rem);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
118
containers/react/src/styles/Messages.css
Normal file
118
containers/react/src/styles/Messages.css
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
.home{
|
||||||
|
background-color: black;
|
||||||
|
height: 90vh;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.container{
|
||||||
|
border-color: #FFFFFF ;
|
||||||
|
border-radius: 50%;
|
||||||
|
width: 65%;
|
||||||
|
height: 80%;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar{
|
||||||
|
flex:1;
|
||||||
|
border-right: 1px solid #3e3c61;
|
||||||
|
background-color: #060b26;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chat{
|
||||||
|
flex:2;
|
||||||
|
color: white;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.conv{
|
||||||
|
padding: 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
background-color: #000c66;
|
||||||
|
color: white;
|
||||||
|
padding: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pic{
|
||||||
|
height: 35px;
|
||||||
|
width: 35px;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-left: 10px;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.end{
|
||||||
|
display: flex;
|
||||||
|
flex: 3;
|
||||||
|
justify-content: flex-end;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.pic-user{
|
||||||
|
height: 50px;
|
||||||
|
width: 50px;
|
||||||
|
border-radius: 50%;
|
||||||
|
object-fit: cover;
|
||||||
|
/* margin-right: 10px; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.messages{
|
||||||
|
background-color: #349b83;
|
||||||
|
height: calc(100% - 118px);
|
||||||
|
overflow: scroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input{
|
||||||
|
display: flex;
|
||||||
|
height: 50px;
|
||||||
|
background-color: white;
|
||||||
|
color:#060b26;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
input{
|
||||||
|
margin-left: 10px;
|
||||||
|
width: 100%;
|
||||||
|
font-size: 18px;
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.send{
|
||||||
|
display: flex;
|
||||||
|
font-size: 30px;
|
||||||
|
align-items: center;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.youMessage{
|
||||||
|
display: flex;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.messageInfo{
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.messageContent{
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
max-width: 80%;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.meMessage{
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row-reverse;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
32
containers/react/src/styles/Profile.css
Normal file
32
containers/react/src/styles/Profile.css
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
.profile {
|
||||||
|
flex-direction: row;
|
||||||
|
height: 100vh;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-pic {
|
||||||
|
height: 350px;
|
||||||
|
width: 350px;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: thick;
|
||||||
|
border-color: red;
|
||||||
|
/* border-image: linear-gradient(90deg, #5843e4, #5a0760); */
|
||||||
|
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.history{
|
||||||
|
color: white;
|
||||||
|
background-color: #5843e4;
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 8px 8px 8px 8px;
|
||||||
|
font-size: 30px;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
/* canvas {
|
||||||
|
margin-top: 20px;
|
||||||
|
border: solid 0px #ccc;
|
||||||
|
background-color: #000;
|
||||||
|
border-radius: 3%;
|
||||||
|
} */
|
||||||
@ -77,47 +77,19 @@ input{
|
|||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* .loginButton {
|
label{
|
||||||
display: flex;
|
}
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: black;
|
|
||||||
color: white;
|
|
||||||
border-radius: ;
|
|
||||||
padding: 10px 20px;
|
|
||||||
margin-left: 40vw;
|
|
||||||
margin-top: 40vh;
|
|
||||||
width: 20vw;
|
|
||||||
height: 10vh;
|
|
||||||
font-size: 5vh;
|
|
||||||
} */
|
|
||||||
|
|
||||||
.loginButton {
|
.login {
|
||||||
background-color: rgb(0, 0, 0);
|
}
|
||||||
border-radius: 5vh;
|
|
||||||
color: white;
|
|
||||||
display: block;
|
|
||||||
margin: auto;
|
|
||||||
margin-top: 30vh;
|
|
||||||
padding: 2vh 5vw;
|
|
||||||
height: 10vh;
|
|
||||||
width: 20vw;
|
|
||||||
font-size: 300%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* .loginButton {
|
.loginForm {
|
||||||
border-radius: 100vh;
|
|
||||||
max-height: 10vh;
|
|
||||||
background-color: black;
|
|
||||||
font-family: 'Rubik Iso';
|
|
||||||
font-size: 5vh;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 50vh;
|
height: 50vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
} */
|
}
|
||||||
|
|
||||||
|
|
||||||
.menu {
|
.menu {
|
||||||
|
|||||||
@ -25,7 +25,8 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- 8080:8080
|
- 8080:8080
|
||||||
volumes:
|
volumes:
|
||||||
- ./containers/react:/app
|
- ./containers/react:/app
|
||||||
|
# - ./containers/react:/app
|
||||||
networks:
|
networks:
|
||||||
- pongNetwork
|
- pongNetwork
|
||||||
entrypoint: ["sh", "-c" , "npm install && npm run start:dev"]
|
entrypoint: ["sh", "-c" , "npm install && npm run start:dev"]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user