Skip to content
This repository has been archived by the owner on Sep 8, 2021. It is now read-only.

[ seonkim, nkim, iha, jikwon ] 수고하셨습니다 #2

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
05d929c
client init commit
nfl1ryxditimo12 Aug 30, 2021
28678b9
gitignore
nfl1ryxditimo12 Aug 30, 2021
3e0efd3
rush01 init
earthkingman Aug 30, 2021
7485aa7
login & main page
nyeoni Aug 30, 2021
17ee6cd
Merge pull request #1 from nfl1ryxditimo12/nkim
nyeoni Aug 30, 2021
6d0e323
GamePage start
nfl1ryxditimo12 Aug 30, 2021
c8ca163
42passport
earthkingman Aug 30, 2021
d7f42c7
server init
nfl1ryxditimo12 Aug 30, 2021
a3236ac
Merge pull request #2 from earthkingman/develop
nfl1ryxditimo12 Aug 30, 2021
9a181b3
main page design complete
nyeoni Aug 30, 2021
3dd2817
Merge pull request #3 from nfl1ryxditimo12/nkim
nyeoni Aug 30, 2021
ab86a63
ing..
nfl1ryxditimo12 Aug 30, 2021
7c88f18
GamePage UI 구현 & 카드 추가
nfl1ryxditimo12 Aug 30, 2021
add4095
UI 주석 추가
nfl1ryxditimo12 Aug 31, 2021
43e80ae
Merge branch 'client' into seonkim
nfl1ryxditimo12 Aug 31, 2021
77fc406
background image 위치 수정
nfl1ryxditimo12 Aug 31, 2021
1012a78
Merge branch 'main' of https://github.com/nfl1ryxditimo12/piscine-rush01
nfl1ryxditimo12 Aug 31, 2021
4b9b5ce
.
nfl1ryxditimo12 Aug 31, 2021
0483756
.
nfl1ryxditimo12 Aug 31, 2021
b04edb6
client update
nyeoni Aug 31, 2021
68ebf7c
git add .gitignore
nyeoni Aug 31, 2021
d0bd67f
client merge
nyeoni Aug 31, 2021
acd17cb
크로스 오리진 이슈 해결
earthkingman Aug 31, 2021
f4334e9
add : register page
nyeoni Aug 31, 2021
8e925a3
add register components
nyeoni Aug 31, 2021
cd188d3
Merge pull request #5 from earthkingman/develop
nyeoni Aug 31, 2021
d6993fd
Merge remote-tracking branch 'origin/server' into nkim
nyeoni Aug 31, 2021
23d46cb
Merge pull request #6 from nfl1ryxditimo12/nkim
earthkingman Aug 31, 2021
876587c
Merge pull request #2 from nfl1ryxditimo12/server
earthkingman Aug 31, 2021
96d0382
Merge branch 'nkim' into seonkim
nfl1ryxditimo12 Aug 31, 2021
57016ce
크로스 오리진 에러 해결
earthkingman Aug 31, 2021
aade418
Merge pull request #7 from earthkingman/develop
hainho Aug 31, 2021
8b04f30
add socket.io room api
Aug 31, 2021
8fbbd7f
Merge pull request #8 from nfl1ryxditimo12/iha
hainho Aug 31, 2021
1f7b65a
merge server & client
nyeoni Aug 31, 2021
a944647
not done
nfl1ryxditimo12 Aug 31, 2021
9e5ce54
Merge pull request #10 from nfl1ryxditimo12/nkim
nyeoni Aug 31, 2021
cb29c61
delete
nfl1ryxditimo12 Aug 31, 2021
0250ffb
go
nfl1ryxditimo12 Aug 31, 2021
bd635c2
go
nfl1ryxditimo12 Aug 31, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
client/node_modules

3 changes: 3 additions & 0 deletions client/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["react-app", "plugin:prettier/recommended"]
}
23 changes: 23 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -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 changes: 70 additions & 0 deletions client/README.md
Original file line number Diff line number Diff line change
@@ -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 the browser.

The page will reload if you make edits.\
You will 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)
Binary file added client/public/favicon.ico
Binary file not shown.
43 changes: 43 additions & 0 deletions client/public/index.html
Original file line number Diff line number Diff line change
@@ -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>
Binary file added client/public/logo192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/public/logo512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions client/public/manifest.json
Original file line number Diff line number Diff line change
@@ -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 changes: 3 additions & 0 deletions client/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
11 changes: 11 additions & 0 deletions client/setupProxy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const { createProxyMiddleware } = require("http-proxy-middleware");

module.exports = function (app) {
app.use(
"/login",
createProxyMiddleware({
target: "http://localhost:5000",
changeOrigin: true,
})
);
};
47 changes: 47 additions & 0 deletions client/src/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import React from "react";
import bg from "./image/bg0.jpeg";
import { createGlobalStyle } from "styled-components";
import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
import LoginPage from "./component/View/LoginPage";
import MainPage from "./component/View/MainPage";
import GamePage from "./component/View/GamePage";
import RegisterPage from "./component/View/RegisterPage";

const GlobalStyle = createGlobalStyle`
html {
width: 100%;
height: 100%;
}
body {
background-image: linear-gradient(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.8)),
url(${bg});
width: 100%;
height: 100%;
margin: 0;
font-family: -apple-system, Noto Sans KR, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
#root {
width: 100%;
height: 100%;
}
`;

function App() {
return (
<Router>
<GlobalStyle />
<Switch>
<Route path="/" exact component={MainPage} />
<Route path="/login" exact component={LoginPage} />
<Route path="/register" exact component={RegisterPage} />
<Route path="/game/:game_id" exact component={GamePage} />
</Switch>
</Router>
);
}

export default App;
23 changes: 23 additions & 0 deletions client/src/_action/game_action.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ROOM_STATE, ROOM_INFO } from "../_type/user_type";
const io = require("socket.io-client");

const socket = io.connect("http://localhost:5000");

export function roomInfo() {
socket.emit("room_info");
socket.on("room_info", (data) => {
return {
type: ROOM_INFO,
payload: data,
};
});
}

export function roomState() {
const ret = {};

return {
type: ROOM_STATE,
payload: ret,
};
}
22 changes: 22 additions & 0 deletions client/src/_action/socket_action.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { LOAD_ROOMS, LOGIN } from "../_type/socket_type";
import { io } from "socket.io-client";

const socket = io.connect("http://localhost:5000/socket");

export function loadRooms() {
socket.emit("load rooms");
socket.on("load rooms", (res) => {
console.log(`Socket Connected : ${res}`);
});
return {
type: LOAD_ROOMS,
payload: null,
};
}

export function socketLogin(requestData) {
return {
type: LOGIN,
payload: null,
};
}
42 changes: 42 additions & 0 deletions client/src/_action/user_action.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { LOGIN_USER, REGIST_USER, AUTH_USER } from "../_type/user_type";
import axios from "axios";

export function loginUser() {
const res = axios("/login", {
method: "GET",
headers: {
"Content-Type": "application/json",
"Access-Control-Allow-Origin": "http://localhost:5000",
"Access-Control-Allow-Methods": "GET, POST, OPTIONS, PUT, PATCH, DELETE",
"Access-Control-Allow-Headers": "X-Requested-With,content-type",
"Access-Control-Allow-Credentials": true,
},
withCredentials: true,
data: undefined,
}).then((res) => res.data);

return {
type: LOGIN_USER,
payload: res,
};
}

export function registUser(requestData) {
const res = axios
.post("/register", requestData)
.then((res) => res.data)
.catch((err) => console.log(err));

return {
type: REGIST_USER,
payload: res,
};
}

export function auth() {
const res = axios.get("/login/authResult").then((res) => res.data);
return {
type: AUTH_USER,
payload: res,
};
}
10 changes: 10 additions & 0 deletions client/src/_reduce/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { combineReducers } from "redux";
import user from "./user_reducer";
import socket from "./socket_reducer";

const rootReducer = combineReducers({
user,
socket,
});

export default rootReducer;
21 changes: 21 additions & 0 deletions client/src/_reduce/socket_reducer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { LOAD_ROOMS, LOGIN } from "../_type/socket_type";

const roomState = {
rooms: [],
};

// eslint-disable-next-line import/no-anonymous-default-export
export default function (state = roomState, action) {
switch (action.type) {
case LOAD_ROOMS:
return { ...state, loadRooms: action.payload };
// eslint-disable-next-line no-unreachable
break;
case LOGIN:
return { ...state, register: action.payload };
// eslint-disable-next-line no-unreachable
break;
default:
return state;
}
}
Loading