From 3f83e307996ecfee9d560c5d977623d04292a024 Mon Sep 17 00:00:00 2001 From: sukyeongh <50071076+sukyeongh@users.noreply.github.com> Date: Thu, 30 Apr 2020 17:59:34 +0900 Subject: [PATCH 01/11] =?UTF-8?q?[frontend]=20headerMenu=20=ED=94=84?= =?UTF-8?q?=EB=A1=9C=ED=95=84=EC=88=98=EC=A0=95=203=EC=B0=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit + post연결 --- frontend/src/Components/Header/HeaderMenu.js | 10 +- frontend/src/Components/Header/UserEditor.js | 7 + frontend/src/Components/Main/MainPage.js | 2 +- .../src/Components/Main/MainPageButton.js | 4 +- .../Profile/PostMediaScheduleAppend.js | 136 +++++++++--------- .../src/Components/Profile/ProfileEditor.js | 111 +++++++++----- frontend/src/Components/Timeline/Timeline.js | 34 +++-- frontend/src/Components/UI/SimpleSpeedDial.js | 24 ++-- frontend/src/Containers/Group/GroupModify.js | 12 +- frontend/src/Containers/Main/MainPage.js | 4 +- frontend/src/Containers/Post/PostList.js | 0 11 files changed, 191 insertions(+), 153 deletions(-) create mode 100644 frontend/src/Containers/Post/PostList.js diff --git a/frontend/src/Components/Header/HeaderMenu.js b/frontend/src/Components/Header/HeaderMenu.js index 5c3efa0..183c9b5 100644 --- a/frontend/src/Components/Header/HeaderMenu.js +++ b/frontend/src/Components/Header/HeaderMenu.js @@ -34,10 +34,10 @@ const ColorCircularProgress = withStyles({ const HeaderMenu = (props) => { const [data, setData] = useState({ ...props.data, - // userPic: null, }); console.log(data); + const [profileEditForm, setProfileEditForm] = useState(null); // const [editor, setEditor] = useState(null); const [setting, setSetting] = useState(null); @@ -385,7 +385,6 @@ const HeaderMenu = (props) => { return; }; - console.log(props.data); return ( {
- {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} userPic
diff --git a/frontend/src/Components/Header/UserEditor.js b/frontend/src/Components/Header/UserEditor.js index 5cb66e2..f7895bb 100644 --- a/frontend/src/Components/Header/UserEditor.js +++ b/frontend/src/Components/Header/UserEditor.js @@ -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, @@ -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: () => { diff --git a/frontend/src/Components/Main/MainPage.js b/frontend/src/Components/Main/MainPage.js index 668c74b..cbbab67 100644 --- a/frontend/src/Components/Main/MainPage.js +++ b/frontend/src/Components/Main/MainPage.js @@ -21,7 +21,7 @@ class MainPage extends React.Component {
- +
); diff --git a/frontend/src/Components/Main/MainPageButton.js b/frontend/src/Components/Main/MainPageButton.js index 9b034b9..d968a0a 100644 --- a/frontend/src/Components/Main/MainPageButton.js +++ b/frontend/src/Components/Main/MainPageButton.js @@ -4,13 +4,13 @@ import ChattingButton from '../Other/ChattingButton'; import SpeedDials from '../UI/SimpleSpeedDial'; import Chatting from './Chatting'; -const MainPageButton = () => { +const MainPageButton = (props) => { const [isChatClick, setIsChatClick] = useState(false); console.log(isChatClick); return (
- +
diff --git a/frontend/src/Components/Profile/PostMediaScheduleAppend.js b/frontend/src/Components/Profile/PostMediaScheduleAppend.js index a9ffd6b..061d1a4 100644 --- a/frontend/src/Components/Profile/PostMediaScheduleAppend.js +++ b/frontend/src/Components/Profile/PostMediaScheduleAppend.js @@ -27,28 +27,28 @@ import Popover from '@material-ui/core/Popover'; import axios from 'axios'; import store from '../../store'; -const useStyles = makeStyles(theme => ({ +const useStyles = makeStyles((theme) => ({ content: { width: '552px', display: 'flex', - justifyContent: 'center' + justifyContent: 'center', }, marginBottom: { - marginBottom: '10px' + marginBottom: '10px', }, middleCenter: { display: 'flex', justifyContent: 'center', alignItems: 'center', - width: '250px;' + width: '250px;', }, chip: { marginRight: '4px', - marginBottom: '4px' - } + marginBottom: '4px', + }, })); -const PostMediaScheduleAppend = props => { +const PostMediaScheduleAppend = (props) => { const classes = useStyles(); const [mediaOpen, setMediaOpen] = useState(null); const [scheduleOpen, setScheduleOpen] = useState(false); @@ -59,24 +59,25 @@ const PostMediaScheduleAppend = props => { r: '20', g: '81', b: '51', - a: '1' + a: '1', }); const [userPost, setUserPost] = useState({ - user_id: store.getState().user.currentUser.user_id, + // user_id: store.getState().user.user_id, + user_id: props.data.userId, // group_cd: store.getState().user.userGroup[0].group_cd, group_cd: null, inputPost: { post_ex: null, post_pb_st: null, post_str_ymd: null, - post_end_ymd: null - } + post_end_ymd: null, + }, }); - const changeHandle = e => { + const changeHandle = (e) => { setUserPost({ ...userPost, - inputPost: { ...userPost.inputPost, [e.target.name]: e.target.value } + inputPost: { ...userPost.inputPost, [e.target.name]: e.target.value }, }); }; @@ -92,33 +93,51 @@ const PostMediaScheduleAppend = props => { setAlert(); try { - console.log(userPost); + // const form = new FormData(); + // form.append('userId', userPost.user_id); + // form.append('groupCd', userPost.group_cd); + // form.append('postOriginCd', null); + // form.append('scheduleCd', null); + // form.append('mediaCd', null); + // form.append('postEx', userPost.inputPost.post_ex); + // form.append('postPublicState', userPost.inputPost.post_pb_st); + // form.append('postStrYMD', userPost.inputPost.post_str_ymd); + // form.append('postEndYMD', userPost.inputPost.post_end_ymd); - const form = new FormData(); - form.append('user_id', userPost.user_id); - form.append('group_cd', userPost.group_cd); - form.append('inputPost', userPost.inputPost); + // for (var value of form.values()) { + // console.log(value); + // } - const { data } = await axios.post('/post/write', form); + // const { data } = await axios.post(`post/`, form); + + const { data } = await axios.post( + `post/`, + { + userId: userPost.user_id, + groupCd: userPost.group_cd, + postOriginCd: null, + scheduleCd: null, + mediaCd: null, + postEx: userPost.inputPost.post_ex, + postPublicState: userPost.inputPost.post_pb_st, + postStrYMD: userPost.inputPost.post_str_ymd, + postEndYMD: userPost.inputPost.post_end_ymd, + }, + { + headers: { + 'content-type': 'application/json', + }, + } + ); console.log(data); - if (data.isWrite) { + if (data) { setAlert( - setAlert(null)} - /> + setAlert(null)} /> ); } else { - setAlert( - setAlert(null)} - /> - ); + setAlert( setAlert(null)} />); } } catch (error) { console.log(error); @@ -137,9 +156,7 @@ const PostMediaScheduleAppend = props => { setMediaOpen(
setMediaOpen(null)}>
- +
); @@ -158,13 +175,11 @@ const PostMediaScheduleAppend = props => { transitionProperty: 'background-color', transitionDuration: '0.3s', transitionTimingFunction: 'ease-out', - backgroundColor: `rgba(${scheduleColor.r}, ${scheduleColor.g}, ${scheduleColor.b}, ${scheduleColor.a})` + backgroundColor: `rgba(${scheduleColor.r}, ${scheduleColor.g}, ${scheduleColor.b}, ${scheduleColor.a})`, }} >
- +
게시물 추가
@@ -177,27 +192,20 @@ const PostMediaScheduleAppend = props => {
-
setScheduleOpen(true)} - > +
setScheduleOpen(!scheduleOpen)}> {(() => { if (scheduleOpen === false) { return (
- - 일정추가 - + 일정추가
); } else { return (
- - 일정추가 - + 일정추가
); } @@ -209,18 +217,14 @@ const PostMediaScheduleAppend = props => { return (
- - 미디어 - + 미디어
); } else { return (
- - 미디어 - + 미디어
); } @@ -245,18 +249,15 @@ const PostMediaScheduleAppend = props => { open={colorClick} anchorOrigin={{ vertical: 'center', - horizontal: 'center' + horizontal: 'center', }} transformOrigin={{ vertical: 'center', - horizontal: 'left' + horizontal: 'left', }} onClose={() => setColorClick(false)} > - setScheduleColor(color.rgb)} - /> + setScheduleColor(color.rgb)} /> ) : null} {scheduleOpen === false ? null : ( @@ -269,7 +270,7 @@ const PostMediaScheduleAppend = props => { className='selectColor' onClick={() => setColorClick(true)} style={{ - backgroundColor: `rgba(${scheduleColor.r}, ${scheduleColor.g}, ${scheduleColor.b}, ${scheduleColor.a})` + backgroundColor: `rgba(${scheduleColor.r}, ${scheduleColor.g}, ${scheduleColor.b}, ${scheduleColor.a})`, }} />
@@ -290,7 +291,7 @@ const PostMediaScheduleAppend = props => { style={{ backgroundColor: 'rgba(20, 81, 51, 0.8)', color: '#ffffff', - marginLeft: '5px' + marginLeft: '5px', }} clickable /> @@ -313,15 +314,10 @@ const PostMediaScheduleAppend = props => { > {'게시물 추가'} - - 작성한 게시물을 추가하시겠습니까? - + 작성한 게시물을 추가하시겠습니까? -
- {doList.map(value => { + {doList.map((value) => { if (dateFns.differenceInCalendarDays(today, value.day) > 0) { count = count + 1; } @@ -220,7 +220,7 @@ const ToDoList = () => { ) : null}
{beforeList === true - ? doList.map(value => { + ? doList.map((value) => { const diffBeforeDay = dateFns.differenceInCalendarDays(today, value.day); if (diffBeforeDay > 0) { return ( @@ -239,12 +239,12 @@ const ToDoList = () => { display: 'flex', justifyContent: 'space-between', alignItems: 'center', - padding: '5px 0px' + padding: '5px 0px', }} >
D-day
- {doList.map(value => + {doList.map((value) => dateFns.differenceInCalendarDays(today, value.day) === 0 ? ( } label={value.ex} /> ) : null @@ -257,7 +257,7 @@ const ToDoList = () => { display: 'flex', justifyContent: 'space-between', alignItems: 'center', - padding: '5px 0px' + padding: '5px 0px', }} >
D-1
@@ -270,7 +270,7 @@ const ToDoList = () => {
{listOpen.first === true - ? doList.map(value => { + ? doList.map((value) => { if (Math.abs(dateFns.differenceInCalendarDays(value.day, today)) === 1) { return } label={value.ex} />; } @@ -283,7 +283,7 @@ const ToDoList = () => { display: 'flex', justifyContent: 'space-between', alignItems: 'center', - padding: '5px 0px' + padding: '5px 0px', }} >
D-2
@@ -296,7 +296,7 @@ const ToDoList = () => {
{listOpen.second === true - ? doList.map(value => { + ? doList.map((value) => { if (Math.abs(dateFns.differenceInCalendarDays(value.day, today)) === 2) { return } label={value.ex} />; } @@ -310,7 +310,7 @@ const ToDoList = () => { display: 'flex', justifyContent: 'space-between', alignItems: 'center', - padding: '5px 0px' + padding: '5px 0px', }} >
After Three Days
@@ -323,8 +323,11 @@ const ToDoList = () => { {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 (
@@ -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; diff --git a/frontend/src/Components/Main/Aside.js b/frontend/src/Components/Main/Aside.js index 86f8251..8c94452 100644 --- a/frontend/src/Components/Main/Aside.js +++ b/frontend/src/Components/Main/Aside.js @@ -2,23 +2,23 @@ import React from 'react'; import './mainPage.css'; class Aside extends React.Component { + constructor(props) { + super(props); + this.state = { + data: props.data, + }; + } + render() { return (