Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frontend #29

Open
wants to merge 70 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
b53e932
Delete App.css
jimin9038 Jan 27, 2021
03a3f44
Delete client/src directory
jimin9038 Jan 27, 2021
3be0fae
website
jimin9038 Jan 27, 2021
61f9e0e
delete sticky.css/sticky.js update App.js
jimin9038 Jan 27, 2021
807c9c6
update
jimin9038 Jan 27, 2021
4d2b207
Merge branch 'dev/main_page' of https://github.com/skku-npc/website i…
jimin9038 Jan 29, 2021
f6d9c7e
divide into header, main, footer
jimin9038 Jan 29, 2021
8a41b04
Create member page
Jinu-Lee Jan 29, 2021
d789df4
MemberList page
kangrnin Jan 30, 2021
77b533d
MemberList alignment, animation
kangrnin Jan 31, 2021
42379a9
Change folder structure
Jinu-Lee Jan 31, 2021
6f5d87a
refactor Main.js
Jinu-Lee Jan 31, 2021
d3a9f91
refactor Header.js Footer.js
Jinu-Lee Feb 1, 2021
8482040
Intro 추가
Jinu-Lee Feb 1, 2021
88de96b
Fix Typo
Jinu-Lee Feb 1, 2021
bc4712a
index.html 수정
Jinu-Lee Feb 2, 2021
811b161
Fix typo
Jinu-Lee Feb 3, 2021
3eae004
Member 수정
Jinu-Lee Feb 3, 2021
1f0dac8
Intro animation 추가
Jinu-Lee Feb 3, 2021
6abd4bb
Footer 수정
Jinu-Lee Feb 3, 2021
8507bbd
Header 수정
Jinu-Lee Feb 3, 2021
9d54879
Main 수정
Jinu-Lee Feb 3, 2021
1aaa46f
Merge MemberList from user/Kangmin
kangrnin Feb 4, 2021
245c205
Add MemberList to router
kangrnin Feb 4, 2021
51a5cf2
Calendar 코드
Heukma Feb 5, 2021
b26e8ee
Profile 추가
Jinu-Lee Feb 7, 2021
5a8a93b
Pending User 창 추가
Jinu-Lee Feb 7, 2021
d2d0bba
Modal 분리
Jinu-Lee Feb 15, 2021
04fb540
Add Font
Jinu-Lee Feb 15, 2021
5c0cc25
Fix font size in main page
Jinu-Lee Feb 15, 2021
727f7f1
Fix font size in Header, Footer
Jinu-Lee Feb 15, 2021
4c2a035
Login과 Header 연결
Jinu-Lee Feb 15, 2021
580528e
Login에 비밀번호 초기화 추가
Feb 17, 2021
8f1c456
일정 불러오기 추가
Jinu-Lee Feb 19, 2021
37921db
LogIn API 연동
Jinu-Lee Feb 19, 2021
15d64e7
Merge branch 'dev/member_page' into user/Jinu
Jinu-Lee Feb 19, 2021
e699fd5
일정 수정 디자인
Heukma Feb 19, 2021
5494898
Header 수정
Jinu-Lee Feb 20, 2021
7916085
Main 수정
Jinu-Lee Feb 20, 2021
7a807b8
Modal 수정
Jinu-Lee Feb 20, 2021
8a487c5
Intro 수정
Jinu-Lee Feb 20, 2021
c26e78a
Account Setting 창 추가
Jinu-Lee Feb 20, 2021
4941e77
Member API 연동 등 수정
Jinu-Lee Feb 20, 2021
728d6fa
Bug Fix
Jinu-Lee Feb 20, 2021
dd85472
Pending 처리 추가, 메인창 주소 변경 ('/' -> '/main')
Jinu-Lee Feb 22, 2021
c23047e
Support Profile Image
Jinu-Lee Feb 23, 2021
6c6d899
설정 창 링크 변경, 비밀번호 초기화 추가
Jinu-Lee Feb 23, 2021
676cb85
새로고침 시 로그인 유지, 활동 없거나 토큰 만료 시 자동 로그아웃
Jinu-Lee Feb 23, 2021
22adbc3
Merge branch 'dev/calendar' into user/Jinu
Jinu-Lee Feb 24, 2021
20694c1
Calendar 일정 추가, 수정, 삭제 API 연결
Jinu-Lee Feb 25, 2021
3c234c4
Study 새로 작성
Jinu-Lee Feb 28, 2021
ff3cdcb
Calendar 완성
Jinu-Lee Feb 28, 2021
b5299e4
Profile Tooltip 수정
Jinu-Lee Feb 28, 2021
2a1af2a
Setting창 Text 한글로 수정
Jinu-Lee Feb 28, 2021
1d8ffdb
[Member] link에 year 추가
Jinu-Lee Mar 1, 2021
68747fa
[Header] Logout 버그 수정
Jinu-Lee Mar 1, 2021
fc7e19f
[ResetPW] history 수정
Jinu-Lee Mar 1, 2021
15664f1
[Calendar] link에 month/week/day + date 설정 추가
Jinu-Lee Mar 1, 2021
8cd2d17
[Calendar] 뒤로가기 시 reload 되도록 수정
Jinu-Lee Mar 1, 2021
ee199d1
[Calendar] 1. Click to Edit/Remove 2. Drag to Add
Jinu-Lee Mar 1, 2021
fbd3f83
Button Text 굵게, Cursor 통일 등
Jinu-Lee Mar 1, 2021
de64023
[Intro] Cursor 수정
Jinu-Lee Mar 1, 2021
f9bf7ee
[Study] 완성
Jinu-Lee Mar 4, 2021
6253bf8
[ALL] Layout 상대값으로 수정
Jinu-Lee Mar 4, 2021
870d58c
[Main] '지원하기' 링크 추가
Jinu-Lee Mar 4, 2021
ae0671e
[Member] Github ID 표시
Jinu-Lee Mar 4, 2021
5c7f02f
[ALL] 세로 화면 지원
Jinu-Lee Mar 7, 2021
f95d98d
[ALL] 폭에 따라 폰트 크기 조절
Jinu-Lee Mar 7, 2021
4c08bda
[Header] 모바일 미지원 -> 다른 메뉴 Block
Jinu-Lee Mar 7, 2021
58fa358
[Main] 모바일 지원
Jinu-Lee Mar 7, 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
9 changes: 8 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,15 @@
"lint": "eslint --ext .js ."
},
"dependencies": {
"@uiw/react-md-editor": "^2.1.10",
"animate.css": "^4.1.1",
"axios": "^0.21.1",
"bootstrap": "^4.6.0",
"moment": "^2.29.1",
"react": "^17.0.1",
"react-big-calendar": "^0.31.0",
"react-dom": "^17.0.1",
"react-markdown": "^5.0.3",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.1",
"web-vitals": "^0.2.4"
Expand All @@ -32,5 +38,6 @@
"last 1 firefox version",
"last 1 safari version"
]
}
},
"main": "index.js"
}
Binary file added frontend/public/assets/main_1.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 frontend/public/assets/main_2.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 frontend/public/assets/main_3.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 frontend/public/icons/Footer/baekjoon.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 frontend/public/icons/Footer/github.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 frontend/public/icons/Footer/mail.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 frontend/public/icons/Footer/map.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 frontend/public/icons/baekjoon.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 frontend/public/icons/circled-plus.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 frontend/public/icons/codeforces.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 frontend/public/icons/default-profile.jpg
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 frontend/public/icons/github.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 frontend/public/icons/mail.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 frontend/public/icons/map.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 frontend/public/icons/npc.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 frontend/public/icons/pencil.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 frontend/public/icons/triangle-exclamation.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 frontend/public/icons/triangle.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 frontend/public/icons/user.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="icon" href="./icons/npc.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
Expand All @@ -24,7 +24,7 @@
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>
<title>NPC</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
Binary file added frontend/public/pics/main_1.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 frontend/public/pics/main_2.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 frontend/public/pics/main_3.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 frontend/public/pics/main_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 35 additions & 6 deletions frontend/src/App.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,50 @@
import React from 'react';
import React, { useState } from 'react';
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
import axios from 'axios';
import Header from './components/Header';
import Footer from './components/Footer';
import Main from './components/Main';
import Intro from './components/Intro';
import Settings from './components/User/Settings';
import ResetPassword from './components/User/ResetPassword';
import ModalWrapper from './components/ModalWrapper';
import MemberList from './components/MemberList';
import Calendar from './components/Calendar';
import Study from './components/Study';

const App = () => {
const [ modalOpen, setModalOpen ] = useState(false);
const [ isLoggedIn, setIsLoggedIn ] = useState(false);
const [ modalContent, setModalContent ] = useState(null);

axios.defaults.baseURL = 'http://localhost:4000';

return (
<Router>
<div className="App">
<Header />
<Header setModalContent={setModalContent} setModalOpen={setModalOpen} isLoggedIn={isLoggedIn} setIsLoggedIn={setIsLoggedIn} />
<ModalWrapper modalOpen={modalOpen} setModalOpen={setModalOpen} content={modalContent} />
<Switch>
<Route exact path="/" component={Main} />
{/* 기타 페이지 */}
<Route exact path="/" component={Intro} />
<Route path="/main" component={Main} />
<Route path="/members/:year" render={({ match, history }) =>
<MemberList match={match} history={history} setModalContent={setModalContent} setModalOpen={setModalOpen} isLoggedIn={isLoggedIn} />}
/>
<Route path="/calendar/:view/:date" render={({ match, history }) =>
<Calendar match={match} history={history} setModalContent={setModalContent} setModalOpen={setModalOpen} isLoggedIn={isLoggedIn} />}
/>
<Route path="/study/:class/:index?" render={({ match, history }) =>
<Study match={match} history={history} isLoggedIn={isLoggedIn} />}
/>
<Route path="/user/settings" render={({ history }) =>
<Settings history={history} setIsLoggedIn={setIsLoggedIn} />}
/>
<Route path="/user/resetPassword/:passwordResetToken" component={ResetPassword} />
<Route
render={({ location }) => (
<div>
<h3>존재하지 않는 페이지 {location.pathname}</h3>
<div style={{margin: '150px 0', textAlign: 'center'}}>
<h1>존재하지 않는 페이지입니다!</h1>
<h2>{location.pathname}</h2>
</div>
)}
/>
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/App.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { render, screen } from '@testing-library/react';
import App from './App';

test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});
28 changes: 28 additions & 0 deletions frontend/src/components/Calendar/Calendar.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.calendar {
width: 125vh;
margin: 15vh calc((100vw - 125vh) / 2);
}

.calendar-title {
margin-left: 5%;
font-size: 3rem;
font-weight: 600;
}

.calendar .row {
margin: 4rem 0;
}

.calendar .button {
font-size: 1.5rem;
text-decoration: underline;
cursor: default;
}

@media (max-aspect-ratio: 5/4) {
.calendar {
width: 100%;
margin: 15vh 0;
padding: 0 5%;
}
}
116 changes: 116 additions & 0 deletions frontend/src/components/Calendar/Calendar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import React, { useState, useEffect } from 'react';
import { Calendar as BigCalendar, momentLocalizer } from 'react-big-calendar';
import moment from 'moment';
import PropTypes from 'prop-types';
import axios from 'axios';
import FixEvent from './FixEvent';
import './Calendar.css';

import 'react-big-calendar/lib/css/react-big-calendar.css';

moment.locale('ko');
const localizer = momentLocalizer(moment);

const Calendar = ({ match, history, setModalContent, setModalOpen, isLoggedIn }) => {
const [ eventData, setEventData ] = useState([]);
const [ params, setParams ] = useState({});
const [ isAdmin, setIsAdmin ] = useState(false);

const loadData = async () => {
const { data } = await axios.get('/api/calendar/events', {
params: {
year: params.date.getFullYear(),
month: params.date.getMonth() + 1,
}
});
setEventData(data.map((data) => {
let result = {...data};
if (!result['allDay']) {
delete result['allDay'];
}
result['start'] = new Date(result['start']);
result['end'] = new Date(result['end']);
return result;
}));
};

useEffect(() => {
if (params.date) {
loadData();
}
}, [params]);

useEffect(() => {
setParams({
date: moment(match.params.date, 'YYYY-MM-DD').toDate(),
view: match.params.view
});
}, [match.params]);

useEffect(async () => {
if (isLoggedIn) {
const { data } = await axios.get('/api/user/profile');
if (data.role === 'Admin') {
setIsAdmin(true);
}
}
}, [isLoggedIn]);

const openModal = (mode, event) => {
if (isAdmin) {
setModalContent(<FixEvent setModalOpen={setModalOpen} mode={mode} event={event} loadData={loadData} />);
setModalOpen(true);
}
};

return (
<div className="calendar container-fluid p-0">
<div className="row">
<div className="col calendar-title p-0">
동아리 일정
</div>
</div>
<center>
<BigCalendar
step={15}
timeslots={8}
localizer={localizer}
events={eventData}
views={['month','week','day']}
date={params.date}
view={params.view}
onView={(view) => {
history.push(`/calendar/${view}/${moment(params.date).format('YYYY-MM-DD')}`);
}}
onNavigate={(newDate, view) => {
history.push(`/calendar/${view}/${moment(newDate).format('YYYY-MM-DD')}`);
}}
selectable={isAdmin}
onSelectEvent={(event) => openModal('edit', event)}
onSelectSlot={(slotInfo) => openModal('add', {
title: '',
start: slotInfo.start,
end: slotInfo.end,
allDay: false
})}
eventPropGetter={() => ({
style: {
backgroundColor: '#59861C',
},
})}
style={{ height: '70vh', width: '80%', margin: '0 10%'}}
/>
</center>
</div>
);
};

Calendar.propTypes = {
match: PropTypes.object.isRequired,
history: PropTypes.object.isRequired,
setModalContent: PropTypes.func.isRequired,
setModalOpen: PropTypes.func.isRequired,
isLoggedIn: PropTypes.bool.isRequired
};

export default Calendar;
29 changes: 29 additions & 0 deletions frontend/src/components/Calendar/FixEvent/FixEvent.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.fix-event {
width: 30vw;
height: auto;
padding: 10%;
}

.fix-event .title {
font-size: 2.5rem;
}

.fix-event .name {
font-size: 1.5rem;
}

.fix-event input {
font-size: 1.2rem;
font-family: "Manrope", "KoreanTITGD";
border-width: 0 0 0.1rem;
width: 100%;
height: 100%;
}

.fix-event button {
background: none;
border: none;
font-size: 1.3rem;
font-weight: 600;
color: #8dc63f;
}
Loading