Skip to content

Commit

Permalink
Merge pull request #26 from Alpha-e-Um/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ji-hunc authored Apr 10, 2024
2 parents 61de1ca + 43ad63e commit 3793a1f
Show file tree
Hide file tree
Showing 97 changed files with 4,018 additions and 62 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/react.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Deploy React

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: react docker build and push
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t ${{ secrets.DOCKER_REPO }}/eum-react:latest .
docker push ${{ secrets.DOCKER_REPO }}/eum-react:latest
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.AWS_HOST }}
username: ${{ secrets.AWS_ID }}
key: ${{ secrets.AWS_KEY }}
script: |
if [ "$(sudo docker ps -qa)" ]; then
sudo docker rm -f $(sudo docker ps -qa)
fi
sudo docker pull ${{ secrets.DOCKER_REPO }}/eum-react:latest
cd alpha-e_um-deploy
sudo docker-compose -f docker-compose.yaml up -d
sudo docker image prune -f
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM node:alpine as builder
WORKDIR /usr/src/app
COPY package.json .
RUN npm install
COPY ./ ./
RUN npm run build

FROM nginx
EXPOSE 3000
COPY ./default.conf /etc/nginx/conf.d/default.conf
COPY --from=builder usr/src/app/build /usr/share/nginx/html
Binary file added Frontend.zip
Binary file not shown.
11 changes: 11 additions & 0 deletions default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
server {
listen 3000;

location / {

root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;

}
}
107 changes: 104 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@react-oauth/google": "^0.12.1",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"axios": "^1.6.8",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-modal": "^3.16.1",
"react-router-dom": "^6.22.3",
"react-scripts": "5.0.1",
"recoil": "^0.7.7",
"styled-components": "^6.1.8",
"web-vitals": "^2.1.4"
},
Expand Down
3 changes: 3 additions & 0 deletions public/icons/alert.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/icons/heart.svg
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 public/images/poster.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@
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`.
-->

<script
type="text/javascript"
src="https://static.nid.naver.com/js/naveridlogin_js_sdk_2.0.2.js"
charset="utf-8"
></script>

<script src="https://developers.kakao.com/sdk/js/kakao.js"></script>

<title>React App</title>
</head>
<body>
Expand Down
38 changes: 38 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,51 @@
import "./App.css";
import { BrowserRouter, Route, Routes } from "react-router-dom";
import Main from "./pages/Main/main";
import MyPage from "./pages/MyPage/myPage";
import TeamSearch from "./pages/TeamSearch/teamSearch";
import MemberSearch from "./pages/MemberSearch/memberSearch";
import Login from "./pages/Login/login";
import { useRecoilState } from "recoil";
import { useEffect } from "react";
import { axiosWithAuth } from "./lib/axios";
import { userInfoState } from "./states/authState";

const App = () => {
const [userInfo, setUserInfo] = useRecoilState(userInfoState);
const accessToken = localStorage.getItem("access_token");

const getUserInfo = async () => {
axiosWithAuth
.get("/api/user/me")
.then((res) => {
setUserInfo({
isLogin: true,
userId: res.data.userId,
email: res.data.email,
name: res.data.name.first,
fullName: res.data.name.fullName,
avatar: res.data.avatar,
mbti: res.data.mbti,
});
console.log(res);
console.log("userInfo", userInfo);
})
.catch((err) => console.error(err));
};

useEffect(() => {
getUserInfo();
}, []);

return (
<div className="App">
<BrowserRouter>
<Routes>
<Route path="/" element={<Main />} />
<Route path="/mypage/*" element={<MyPage />} />
<Route path="/team" element={<TeamSearch />} />
<Route path="/member" element={<MemberSearch />} />
<Route path="/login/*" element={<Login />} />
</Routes>
</BrowserRouter>
</div>
Expand Down
32 changes: 32 additions & 0 deletions src/api/contestTestData.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const contestTestData = [
{
id: 1,
deadline: 5,
name: "창의력을 키우는 공모전",
organizer: "창의력 협회",
views: "1,234",
},
{
id: 2,
deadline: 6,
name: "예술과 기술을 결합한 공모전",
organizer: "미술과 기술 협회",
views: "987",
},
{
id: 3,
deadline: 7,
name: "환경 보호를 위한 공모전",
organizer: "환경 보호 단체",
views: "5,678",
},
{
id: 4,
deadline: 8,
name: "환경 보호를 위한 공모전",
organizer: "환경 보호 단체",
views: "5,678",
},
];

export default contestTestData;
Loading

0 comments on commit 3793a1f

Please sign in to comment.