Skip to content
This repository has been archived by the owner on Oct 23, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' into jueun
Browse files Browse the repository at this point in the history
  • Loading branch information
jueun275 committed May 11, 2020
2 parents 7507dda + 17d2872 commit 6bae63b
Show file tree
Hide file tree
Showing 35 changed files with 376 additions and 317 deletions.
32 changes: 21 additions & 11 deletions frontend/src/Components/Header/HeaderMenu.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { useState, useEffect } from 'react';
import './header.css';
import GroupAdd from '../../Containers/Group/GroupAdd';
import LongMenu from '../Other/MoreMenu';
Expand Down Expand Up @@ -34,10 +34,13 @@ const ColorCircularProgress = withStyles({
const HeaderMenu = (props) => {
const [data, setData] = useState({
...props.data,
// userPic: null,
});

console.log(data);
useEffect(() => {
setData(props.data);
console.log(data);
});

const [profileEditForm, setProfileEditForm] = useState(null);
// const [editor, setEditor] = useState(null);
const [setting, setSetting] = useState(null);
Expand Down Expand Up @@ -418,7 +421,6 @@ const HeaderMenu = (props) => {
return;
};

console.log(props.data);
return (
<Drawer
open={props.open}
Expand All @@ -430,7 +432,13 @@ const HeaderMenu = (props) => {
<div className='menu-profile'>
<div className='menu-profile-pic-nm'>
<div style={{ marginRight: '10px' }}>
{data.userPic === null ? setData({ ...data, userPic: 'http://placehold.it/250x250' }) : null}
{data.userPic === null
? setData({
...data,
userPic: 'https://recordary-springboot-upload.s3.ap-northeast-2.amazonaws.com/user/basic.png',
})
: null}

<img alt='userPic' src={data.userPic} style={{ borderRadius: '50%', width: '30px', overFit: 'cover' }} />
</div>
<span>
Expand Down Expand Up @@ -507,9 +515,11 @@ const GroupButton = styled(Button)({
paddingLeft: '10px',
});

export default React.memo(HeaderMenu, (props, newProps) => {
console.log(props, newProps);
return props === newProps;
// false 일시 랜더링
// true 일시 비랜더링
});
export default HeaderMenu;

// export default React.memo(HeaderMenu, (props, newProps) => {
// console.log(props, newProps);
// return props === newProps;
// // false 일시 랜더링
// // true 일시 비랜더링
// });
69 changes: 36 additions & 33 deletions frontend/src/Components/Header/ToDoList.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,87 +25,87 @@ const ToDoList = () => {
const [listOpen, setListOpen] = useState({
first: false,
second: false,
third: false
third: false,
});

const [selectedDate, setSelectedDate] = React.useState(new Date());
const handleDateChange = date => {
const handleDateChange = (date) => {
setSelectedDate(date);
};

const [doList, setDoList] = useState([
{
day: new Date('2020-03-24'),
ex: 'EnterPrise Java 강의 듣기',
checked: false
checked: false,
},
{
day: new Date('2020-03-25'),
ex: '시스템 분석 강의 듣기',
checked: false
checked: false,
},
{
day: new Date('2020-03-26'),
ex: '강교수님 강의 듣기',
checked: false
checked: false,
},
{
day: new Date('2020-03-26'),
ex: '모바일 프로그래밍 강의 듣기',
checked: false
checked: false,
},
{
day: new Date('2020-03-26'),
ex: '운영체제 강의 듣기',
checked: false
checked: false,
},
{
day: new Date('2020-03-27'),
ex: '투썸 강의 듣기',
checked: false
checked: false,
},
{
day: new Date('2020-03-27'),
ex: '스타벅스 듣기',
checked: false
checked: false,
},
{
day: new Date('2020-03-28'),
ex: '이디야',
checked: false
checked: false,
},
{
day: new Date('2020-03-29'),
ex: '카페베네',
checked: false
checked: false,
},
{
day: new Date('2020-03-29'),
ex: '아이스크림',
checked: false
checked: false,
},
{
day: new Date('2020-03-29'),
ex: '아이스 아메리카노',
checked: false
checked: false,
},
{
day: new Date('2020-03-30'),
ex: '아이스티',
checked: false
checked: false,
},
{
day: new Date('2020-03-31'),
ex: '카페라떼',
checked: false
}
checked: false,
},
]);

let count = 0;
const [beforeList, setBeforeList] = useState(false);
return (
<PopupState variant='popover' popupId='demo-popup-popover'>
{popupState => (
{(popupState) => (
<div className='header-ring'>
<ToDoButton {...bindTrigger(popupState)}>
<AssignmentIcon style={{ fontSize: 37, color: 'white' }} />
Expand All @@ -124,7 +124,7 @@ const ToDoList = () => {
display: 'flex',
flexDirection: 'column',
margin: '10px 20px 20px 20px',
maxHeight: '400px'
maxHeight: '400px',
}}
>
<div
Expand All @@ -134,7 +134,7 @@ const ToDoList = () => {
paddingBottom: '5px',
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between'
justifyContent: 'space-between',
}}
>
<span>To Do List</span>
Expand Down Expand Up @@ -162,7 +162,7 @@ const ToDoList = () => {
value={selectedDate}
onChange={handleDateChange}
KeyboardButtonProps={{
'aria-label': 'change date'
'aria-label': 'change date',
}}
/>
</MuiPickersUtilsProvider>
Expand All @@ -184,7 +184,7 @@ const ToDoList = () => {
display: 'flex',
justifyContent: 'flex-end',
marginBottom: '10px',
marginRight: '20px'
marginRight: '20px',
}}
>
<Button onClick={() => setToDoAdd(false)} autoFocus>
Expand All @@ -200,7 +200,7 @@ const ToDoList = () => {
</div>
<div style={{ border: '2px solid lightgray', marginBottom: '5px' }} />
<div style={{ display: 'flex', flexDirection: 'column', borderBottom: '1px solid lightgray' }}>
{doList.map(value => {
{doList.map((value) => {
if (dateFns.differenceInCalendarDays(today, value.day) > 0) {
count = count + 1;
}
Expand All @@ -220,7 +220,7 @@ const ToDoList = () => {
) : null}
<div style={beforeList === true ? { borderBottom: '1px solid lightgray' } : null}>
{beforeList === true
? doList.map(value => {
? doList.map((value) => {
const diffBeforeDay = dateFns.differenceInCalendarDays(today, value.day);
if (diffBeforeDay > 0) {
return (
Expand All @@ -239,12 +239,12 @@ const ToDoList = () => {
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
padding: '5px 0px'
padding: '5px 0px',
}}
>
<div style={{ fontSize: '15px', fontWeight: 'bold', paddingTop: '5px' }}>D-day</div>
</div>
{doList.map(value =>
{doList.map((value) =>
dateFns.differenceInCalendarDays(today, value.day) === 0 ? (
<FormControlLabel control={<Checkbox />} label={value.ex} />
) : null
Expand All @@ -257,7 +257,7 @@ const ToDoList = () => {
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
padding: '5px 0px'
padding: '5px 0px',
}}
>
<div style={{ fontSize: '15px', fontWeight: 'bold' }}>D-1</div>
Expand All @@ -270,7 +270,7 @@ const ToDoList = () => {
</div>
</div>
{listOpen.first === true
? doList.map(value => {
? doList.map((value) => {
if (Math.abs(dateFns.differenceInCalendarDays(value.day, today)) === 1) {
return <FormControlLabel control={<Checkbox />} label={value.ex} />;
}
Expand All @@ -283,7 +283,7 @@ const ToDoList = () => {
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
padding: '5px 0px'
padding: '5px 0px',
}}
>
<div style={{ fontSize: '15px', fontWeight: 'bold' }}>D-2</div>
Expand All @@ -296,7 +296,7 @@ const ToDoList = () => {
</div>
</div>
{listOpen.second === true
? doList.map(value => {
? doList.map((value) => {
if (Math.abs(dateFns.differenceInCalendarDays(value.day, today)) === 2) {
return <FormControlLabel control={<Checkbox />} label={value.ex} />;
}
Expand All @@ -310,7 +310,7 @@ const ToDoList = () => {
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
padding: '5px 0px'
padding: '5px 0px',
}}
>
<div style={{ fontSize: '15px', fontWeight: 'bold' }}>After Three Days</div>
Expand All @@ -323,8 +323,11 @@ const ToDoList = () => {
</div>
</div>
{listOpen.third === true
? doList.map(value => {
? doList.map((value) => {
const diffDay = Math.abs(dateFns.differenceInCalendarDays(value.day, today));
// console.log(value.day);
// console.log(today);
//이부분 고치기
if (diffDay >= 3) {
return (
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
Expand All @@ -346,12 +349,12 @@ const ToDoList = () => {

const ToDoButton = styled(Button)({
minWidth: '40px',
height: '50px'
height: '50px',
});
const ToDoPlusButton = styled(Button)({
minWidth: '30px',
height: '40px',
marginLeft: '10px'
marginLeft: '10px',
});

export default ToDoList;
7 changes: 7 additions & 0 deletions frontend/src/Components/Header/UserEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class UserEditor extends React.Component {
user_nm: '',
user_id: props.data.userId,
user_pw: '',
user_ex: props.data.userEx,
user_pic: props.data.userPic,
user_change_pw: '',
user_change_pw_check: '',
isSamePw: undefined,
Expand Down Expand Up @@ -285,7 +287,12 @@ class UserEditor extends React.Component {
const { data } = await axios.put(`user/${this.state.user_id}`, {
userPw: this.state.user_change_pw,
userNm: this.state.user_nm,
userPic: this.state.user_pic,
userEx: this.state.user_ex,
});

console.log(data);

if (data === this.state.user_id) {
this.setState({
alertDialog: () => {
Expand Down
32 changes: 16 additions & 16 deletions frontend/src/Components/Login/LoginPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,22 @@ class Login extends React.Component {
});
console.log(data, 'is data');

// if (data === '') {
// this.setState({
// failedLogin: () => {
// return (
// <AlertDialog
// severity='error'
// content='로그인에 실패하였습니다.'
// onAlertClose={() => {
// this.setState({ failedLogin: () => {} });
// }}
// />
// );
// },
// });
// return;
// }
if (data === '') {
this.setState({
failedLogin: () => {
return (
<AlertDialog
severity='error'
content='로그인에 실패하였습니다.'
onAlertClose={() => {
this.setState({ failedLogin: () => {} });
}}
/>
);
},
});
return;
}

this.setState({ isLoading: true });
// 유저에 대한 정보를 가져오고 그 결과값을 state 에 저장
Expand Down
Loading

0 comments on commit 6bae63b

Please sign in to comment.