From 33b5abf5a5e5f253ad03a5c91671129529cec8fc Mon Sep 17 00:00:00 2001 From: Sangjun-man Date: Sat, 27 Nov 2021 12:58:05 +0900 Subject: [PATCH 1/4] =?UTF-8?q?Fix=20:=20header=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=ED=99=88=EB=B2=84=ED=8A=BC=20=EB=A7=88?= =?UTF-8?q?=EC=A7=84=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Header.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/common/Header.jsx b/src/components/common/Header.jsx index 569b92f..0b082c7 100644 --- a/src/components/common/Header.jsx +++ b/src/components/common/Header.jsx @@ -25,9 +25,9 @@ const Header = ({ user, onLogout, pathname }) => { ) : ( - + history.push('/')}> - + )} From cc9d52b79f612e2bb2db6f1e5ca4fdfc6848ec3f Mon Sep 17 00:00:00 2001 From: Sangjun-man Date: Sat, 27 Nov 2021 13:24:55 +0900 Subject: [PATCH 2/4] =?UTF-8?q?Feat=20:=20=EC=8B=A4=EC=8B=9C=EA=B0=84=20?= =?UTF-8?q?=EC=97=85=EB=A1=9C=EB=93=9C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Header.jsx | 2 +- src/containters/KeywordContainer.jsx | 11 +++++++++++ src/containters/MainInputContainer.jsx | 6 ++++++ src/containters/SearchContainer.jsx | 3 +-- src/containters/TIMViewContainer.jsx | 12 +++++++++++- src/containters/common/HeaderContainer.jsx | 3 +-- src/containters/postview/GridViewContainer.jsx | 9 +++++++++ src/containters/status/TIMLogContainer.jsx | 4 ++++ src/modules/reload.js | 2 +- 9 files changed, 45 insertions(+), 7 deletions(-) diff --git a/src/components/common/Header.jsx b/src/components/common/Header.jsx index 0b082c7..9d476e6 100644 --- a/src/components/common/Header.jsx +++ b/src/components/common/Header.jsx @@ -29,7 +29,7 @@ const Header = ({ user, onLogout, pathname }) => { )} - + diff --git a/src/containters/KeywordContainer.jsx b/src/containters/KeywordContainer.jsx index c0ebafb..e6ce79f 100644 --- a/src/containters/KeywordContainer.jsx +++ b/src/containters/KeywordContainer.jsx @@ -1,6 +1,7 @@ import React, { useEffect, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { withRouter } from 'react-router'; +import { useHistory } from 'react-router-dom/cjs/react-router-dom.min'; import Keyword from '../components/Keyword'; import { filterPostInTag, getPostInTag } from '../modules/post'; @@ -10,6 +11,8 @@ const KeywordContainer = ({ match }) => { postInTag: post.postInTag, loading: loading, })); + const reloaded = useSelector(({ reload }) => reload); + const history = useHistory(); const dispatch = useDispatch(); const { tagId } = match.params; @@ -17,6 +20,14 @@ const KeywordContainer = ({ match }) => { dispatch(getPostInTag(tagId)); }, [dispatch, tagId]); + useEffect(() => { + if (reloaded) { + if (reloaded.keyword === true) { + dispatch(getPostInTag(tagId)); + } + } + }, [reloaded]); + const onFilteringDate = (startDate, endDate) => { const startDateToISO = new Date(startDate); const endDateToISO = new Date( diff --git a/src/containters/MainInputContainer.jsx b/src/containters/MainInputContainer.jsx index a3135aa..88f99ca 100644 --- a/src/containters/MainInputContainer.jsx +++ b/src/containters/MainInputContainer.jsx @@ -6,11 +6,14 @@ import { createPost } from '../modules/post'; import { reloadAction } from '../modules/reload'; import theme from '../styles/theme'; import { randomIndex } from '../lib/util/randomIndex'; +import { useLocation } from 'react-router-dom/cjs/react-router-dom.min'; const MainInputContainer = () => { const { user } = useSelector(({ user }) => ({ user: user.user, })); + const { pathname } = useLocation(); + const dispatch = useDispatch(); const [image, setImage] = useState(null); const [tag, setTag] = useState(''); @@ -22,6 +25,8 @@ const MainInputContainer = () => { (color) => color !== 'gray' && color !== 'grey', ); + console.log(pathname.split('/')[1]); + const onSubmit = (e) => { e.preventDefault(); @@ -43,6 +48,7 @@ const MainInputContainer = () => { dispatch(createPost(formData)); dispatch(reloadAction('timLog')); + dispatch(reloadAction(pathname.split('/')[1])); inputRef.current.value = ''; setImage(null); diff --git a/src/containters/SearchContainer.jsx b/src/containters/SearchContainer.jsx index 0552ac7..62fb867 100644 --- a/src/containters/SearchContainer.jsx +++ b/src/containters/SearchContainer.jsx @@ -5,12 +5,11 @@ import _ from 'lodash'; import Search from '../components/search/Search'; import { useEffect } from 'react'; -const SearchContainer = (props) => { +const SearchContainer = () => { // const [searchState, setSearchState] = useState(); const [isOpenned, setIsOpenned] = useState(); const [searchValue, setSearchValue] = useState(); const [searchingData, setSearchingData] = useState(); - const dispatch = useDispatch(); const sendContent = async (Query) => { if (Query === 0) return; diff --git a/src/containters/TIMViewContainer.jsx b/src/containters/TIMViewContainer.jsx index c60c225..9e5a129 100644 --- a/src/containters/TIMViewContainer.jsx +++ b/src/containters/TIMViewContainer.jsx @@ -13,6 +13,8 @@ const TIMViewContainer = ({ match, location }) => { deletePostSuccess: post.deletePostSuccess, })); + const reloaded = useSelector(({ reload }) => reload); + const dispatch = useDispatch(); const { tagId, keywordId } = match.params; const { @@ -38,7 +40,15 @@ const TIMViewContainer = ({ match, location }) => { useEffect(() => { dispatch(getPostInKeyword(keywordId)); - }, [dispatch, keywordId, tagId]); + }, [dispatch, keywordId]); + + useEffect(() => { + if (reloaded) { + if (reloaded.tim === true) { + dispatch(getPostInKeyword(keywordId)); + } + } + }, [reloaded]); // console.log(match, location); diff --git a/src/containters/common/HeaderContainer.jsx b/src/containters/common/HeaderContainer.jsx index b51b89d..ec73fac 100644 --- a/src/containters/common/HeaderContainer.jsx +++ b/src/containters/common/HeaderContainer.jsx @@ -1,8 +1,7 @@ import React, { useEffect } from 'react'; import { useDispatch } from 'react-redux'; import { useSelector } from 'react-redux'; -import { useLocation } from 'react-router'; -import { useHistory } from 'react-router-dom/cjs/react-router-dom.min'; +import { useLocation, useHistory } from 'react-router'; import Header from '../../components/common/Header'; import { initAuth } from '../../modules/auth'; diff --git a/src/containters/postview/GridViewContainer.jsx b/src/containters/postview/GridViewContainer.jsx index 0b900db..ea49418 100644 --- a/src/containters/postview/GridViewContainer.jsx +++ b/src/containters/postview/GridViewContainer.jsx @@ -10,6 +10,7 @@ const GridViewContainer = () => { user: user.user, tags: tagkeyword.tags, })); + const reloaded = useSelector(({ reload }) => reload); const tagItems = {}; @@ -22,6 +23,14 @@ const GridViewContainer = () => { dispatch(check()); }, [dispatch]); + useEffect(() => { + if (reloaded) { + if (reloaded.tag === true) { + dispatch(getTag()); + } + } + }, [reloaded]); + return ; }; diff --git a/src/containters/status/TIMLogContainer.jsx b/src/containters/status/TIMLogContainer.jsx index 4ca8a48..250810f 100644 --- a/src/containters/status/TIMLogContainer.jsx +++ b/src/containters/status/TIMLogContainer.jsx @@ -37,6 +37,10 @@ const TIMLogContainer = ({ type }) => { useEffect(() => { if (reloaded) { if (reloaded.timLog === true) { + console.log('fsdfsdfsdfdsfds'); + console.log('fsdfsdfsdfdsfds'); + console.log('fsdfsdfsdfdsfds'); + console.log('fsdfsdfsdfdsfds'); LogContainerfetch(); } } diff --git a/src/modules/reload.js b/src/modules/reload.js index 437fcbb..81d4bb4 100644 --- a/src/modules/reload.js +++ b/src/modules/reload.js @@ -27,7 +27,7 @@ function* reRenderSaga({ payload }) { //모니터링 사가 export function* reloadSaga() { - yield takeLatest(RELOAD_START, reRenderSaga); + yield takeEvery(RELOAD_START, reRenderSaga); } //리듀서 From 8a11f5807902eb433d4cdf870713fc03b206623c Mon Sep 17 00:00:00 2001 From: Sangjun-man Date: Sat, 27 Nov 2021 14:20:47 +0900 Subject: [PATCH 3/4] =?UTF-8?q?Feat=20:=20=EC=8B=A4=EC=8B=9C=EA=B0=84=20?= =?UTF-8?q?=EC=97=85=EB=A1=9C=EB=93=9C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/TIMView/TIM.jsx | 34 +++++++++++++--------- src/components/TIMView/TIMView.jsx | 2 ++ src/components/postview/GridView.jsx | 10 +++++-- src/containters/MainInputContainer.jsx | 15 ++++++++-- src/containters/TIMViewContainer.jsx | 18 ++++-------- src/containters/common/HeaderContainer.jsx | 2 +- 6 files changed, 49 insertions(+), 32 deletions(-) diff --git a/src/components/TIMView/TIM.jsx b/src/components/TIMView/TIM.jsx index 1117074..8f8d5d1 100644 --- a/src/components/TIMView/TIM.jsx +++ b/src/components/TIMView/TIM.jsx @@ -3,18 +3,17 @@ import styled, { css } from 'styled-components'; import { MdEdit } from 'react-icons/md'; import { BsFillTrashFill, BsImages } from 'react-icons/bs'; -const TIM = ({ post, onDeletePost, onEditPost }) => { - const { - id, - content, - createAt, - image, - isFavorite, - tagName, - tagColor, - keywordName, - keywordColor, - } = post; +const TIM = ({ + post, + tagName, + tagColor, + keywordName, + keywordColor, + onDeletePost, + onEditPost, +}) => { + const { id, content, createAt, image, isFavorite } = post; + const slicedDate = createAt.toString().slice(0, 10); const [editMode, setEditMode] = useState(false); const initForm = { @@ -31,7 +30,7 @@ const TIM = ({ post, onDeletePost, onEditPost }) => { if (editMode === true) { let result = window.confirm('수정하시겠습니까?'); if (result) { - console.log(form); + console.log(post); const formData = new FormData(); formData.append('file', form.image); formData.append('content', form.content); @@ -40,6 +39,15 @@ const TIM = ({ post, onDeletePost, onEditPost }) => { formData.append('keyword', keywordName); formData.append('tag_color', tagColor); formData.append('keyword_color', keywordColor); + + for (let key of formData.keys()) { + console.log(key); + } + + /* value 확인하기 */ + for (let value of formData.values()) { + console.log(value); + } onEditPost(formData); } setEditMode(false); diff --git a/src/components/TIMView/TIMView.jsx b/src/components/TIMView/TIMView.jsx index c1402ca..159d744 100644 --- a/src/components/TIMView/TIMView.jsx +++ b/src/components/TIMView/TIMView.jsx @@ -54,7 +54,9 @@ const TIMView = ({ key={post.id} post={post} tagName={tagName} + tagColor={tagColor} keywordName={keywordName} + keywordColor={keywordColor} onDeletePost={onDeletePost} onEditPost={onEditPost} /> diff --git a/src/components/postview/GridView.jsx b/src/components/postview/GridView.jsx index 45d5156..2b5e1a9 100644 --- a/src/components/postview/GridView.jsx +++ b/src/components/postview/GridView.jsx @@ -4,6 +4,7 @@ import { IoIosArrowDown } from 'react-icons/io'; import { Link } from 'react-router-dom'; const GridView = ({ user, tags }) => { + console.log(tags); if (!tags) return
loading...
; return ( @@ -58,7 +59,8 @@ const GridItem = styled.li` border-radius: 20px; box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.2); background: ${({ tagColor, theme }) => { - return theme.component[tagColor][3]; + console.log(tagColor); + return tagColor !== 'undefined' ? theme.component[tagColor][3] : '#FAFCF9'; }}; & > header { display: flex; @@ -66,8 +68,10 @@ const GridItem = styled.li` justify-content: center; align-items: center; background-color: ${({ tagColor, theme }) => { - console.log(theme.component[tagColor][1]); - return theme.component[tagColor][1]; + console.log(theme.component[tagColor]); + return tagColor !== 'undefined' + ? theme.component[tagColor][1] + : '#FAFCF9'; }}; font-size: 28px; font-weight: bold; diff --git a/src/containters/MainInputContainer.jsx b/src/containters/MainInputContainer.jsx index 88f99ca..a056132 100644 --- a/src/containters/MainInputContainer.jsx +++ b/src/containters/MainInputContainer.jsx @@ -25,7 +25,7 @@ const MainInputContainer = () => { (color) => color !== 'gray' && color !== 'grey', ); - console.log(pathname.split('/')[1]); + // console.log(pathname.split('/')[1]); const onSubmit = (e) => { e.preventDefault(); @@ -46,6 +46,17 @@ const MainInputContainer = () => { formData.append('keyword', keyword); formData.append('keyword_color', keyword_color); + // console.log(formData); + /* key 확인하기 */ + for (let key of formData.keys()) { + console.log(key); + } + + /* value 확인하기 */ + for (let value of formData.values()) { + console.log(value); + } + dispatch(createPost(formData)); dispatch(reloadAction('timLog')); dispatch(reloadAction(pathname.split('/')[1])); @@ -64,7 +75,7 @@ const MainInputContainer = () => { } }; const onKeyUp = (e) => { - console.log(tag, keyword); + // console.log(tag, keyword); const { value } = e.target; if (value !== '') { diff --git a/src/containters/TIMViewContainer.jsx b/src/containters/TIMViewContainer.jsx index 9e5a129..ac22d5b 100644 --- a/src/containters/TIMViewContainer.jsx +++ b/src/containters/TIMViewContainer.jsx @@ -4,6 +4,7 @@ import { useDispatch, useSelector } from 'react-redux'; import { withRouter } from 'react-router'; import TIMView from '../components/TIMView/TIMView'; import { deletePost, editPost, getPostInKeyword } from '../modules/post'; +import { reloadAction } from '../modules/reload'; // 특정 키워드(keywordId) 안에 있는 tim 불러와야 함 const TIMViewContainer = ({ match, location }) => { @@ -30,11 +31,15 @@ const TIMViewContainer = ({ match, location }) => { let result = window.confirm('해당 TIM을 삭제하시겠습니까?'); if (result) { dispatch(deletePost(post_id)); + dispatch(reloadAction('tim')); + // 삭제하자마자 리렌더링 하게 하려면? } else return; }; const onEditPost = (formData) => { dispatch(editPost(formData)); + dispatch(reloadAction('tim')); + // 수정하자마자 리렌더링 하게 하려면? }; @@ -50,19 +55,6 @@ const TIMViewContainer = ({ match, location }) => { } }, [reloaded]); - // console.log(match, location); - - // console.log(user, postInKeyword); - console.log( - user, - postList, - tagName, - tagColor, - keywordName, - keywordColor, - onEditPost, - onDeletePost, - ); if (postList.length === 0) return <>loading; if (postList) return ( diff --git a/src/containters/common/HeaderContainer.jsx b/src/containters/common/HeaderContainer.jsx index ec73fac..a3d68c9 100644 --- a/src/containters/common/HeaderContainer.jsx +++ b/src/containters/common/HeaderContainer.jsx @@ -23,7 +23,7 @@ const HeaderContainer = () => { const userCheck = async () => { try { const a = await getUser(); - console.log(a); + // console.log(a); } catch (e) { dispatch(initAuth()); alert('로그인이 필요합니다'); From 5d3243dcac9aba180283d19b439ace577afba29c Mon Sep 17 00:00:00 2001 From: Sangjun-man Date: Sat, 27 Nov 2021 14:30:16 +0900 Subject: [PATCH 4/4] =?UTF-8?q?Fix=20:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EC=9D=B8=ED=92=8B=EC=B0=BD=20placeholder=20=ED=81=AC=EA=B8=B0?= =?UTF-8?q?=EC=A1=B0=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/styles/utilStyle.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/styles/utilStyle.js b/src/styles/utilStyle.js index fbc5628..4a4e90d 100644 --- a/src/styles/utilStyle.js +++ b/src/styles/utilStyle.js @@ -15,7 +15,7 @@ export const Input = styled.input` line-height: 1.25rem; ::placeholder { font-family: Roboto; - font-size: 1.3vw; + font-size: 1rem; font-style: normal; font-weight: 400; line-height: 16px;