From adf5bae9c7e5b5206804db4ffd6c5c10298339e7 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Thu, 29 Feb 2024 19:50:17 +0900 Subject: [PATCH 01/28] =?UTF-8?q?style:=20asset=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/icon/ic_alert_o.svg | 12 ++++++++++++ src/assets/icon/ic_alert_x.svg | 11 +++++++++++ src/assets/icon/ic_home_favorite.svg | 23 ++++++++++++++++++++++ src/assets/icon/ic_profile.svg | 29 ++++++++++++++++++++++++++++ src/assets/index.ts | 8 ++++++++ 5 files changed, 83 insertions(+) create mode 100644 src/assets/icon/ic_alert_o.svg create mode 100644 src/assets/icon/ic_alert_x.svg create mode 100644 src/assets/icon/ic_home_favorite.svg create mode 100644 src/assets/icon/ic_profile.svg diff --git a/src/assets/icon/ic_alert_o.svg b/src/assets/icon/ic_alert_o.svg new file mode 100644 index 00000000..a8163791 --- /dev/null +++ b/src/assets/icon/ic_alert_o.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/assets/icon/ic_alert_x.svg b/src/assets/icon/ic_alert_x.svg new file mode 100644 index 00000000..6d3e3628 --- /dev/null +++ b/src/assets/icon/ic_alert_x.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/assets/icon/ic_home_favorite.svg b/src/assets/icon/ic_home_favorite.svg new file mode 100644 index 00000000..d8b3cc7c --- /dev/null +++ b/src/assets/icon/ic_home_favorite.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/assets/icon/ic_profile.svg b/src/assets/icon/ic_profile.svg new file mode 100644 index 00000000..0b5f53f7 --- /dev/null +++ b/src/assets/icon/ic_profile.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/assets/index.ts b/src/assets/index.ts index 48d600dd..5d5b41fe 100644 --- a/src/assets/index.ts +++ b/src/assets/index.ts @@ -6,6 +6,8 @@ import BtnFloatingStickerOrange from './button/btn_floating_sticker_orange.svg?r import BtnFloatingWrite from './button/btn_floating_write.svg?react'; import BtnFloatingWriteOrange from './button/btn_floating_write_orange.svg?react'; import BtnKakaologin from './button/btn_kakaologin.svg?react'; +import IcAlertO from './icon/ic_alert_o.svg?react'; +import IcAlertX from './icon/ic_alert_x.svg?react'; import IcArrowLeftBlack from './icon/ic_arrow_left_black.svg?react'; import IcArrowLeftWhite from './icon/ic_arrow_left_white.svg?react'; import IcCamera from './icon/ic_camera.svg?react'; @@ -15,7 +17,9 @@ import IcCheck from './icon/ic_check.svg?react'; import IcCrown from './icon/ic_crown.svg?react'; import IcDate from './icon/ic_date.svg?react'; import IcHome from './icon/ic_home.svg?react'; +import IcHomeFavorite from './icon/ic_home_favorite.svg?react'; import IcNotice from './icon/ic_notice.svg?react'; +import IcProfile from './icon/ic_profile.svg?react'; import IcSharing from './icon/ic_sharing.svg?react'; import IcWaste from './icon/ic_waste.svg?react'; import IcX from './icon/ic_x.svg?react'; @@ -56,6 +60,8 @@ export { BtnFloatingWrite, BtnFloatingWriteOrange, BtnKakaologin, + IcAlertO, + IcAlertX, IcArrowLeftBlack, IcArrowLeftWhite, IcCamera, @@ -65,7 +71,9 @@ export { IcCrown, IcDate, IcHome, + IcHomeFavorite, IcNotice, + IcProfile, IcSharing, IcWaste, IcX, From 9dfd9edc7c9cb5af1ec556cfadb554fe51d00de5 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Thu, 29 Feb 2024 19:51:08 +0900 Subject: [PATCH 02/28] =?UTF-8?q?feat:=20navigate=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=ED=8D=BC=EB=B8=94=EB=A6=AC=EC=8B=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NavigateLecueBook.style.ts | 28 ++++++------ .../components/NavigateLecueBook/index.tsx | 44 ++++++++----------- 2 files changed, 32 insertions(+), 40 deletions(-) diff --git a/src/Home/components/NavigateLecueBook/NavigateLecueBook.style.ts b/src/Home/components/NavigateLecueBook/NavigateLecueBook.style.ts index 3af55d88..03fbf33a 100644 --- a/src/Home/components/NavigateLecueBook/NavigateLecueBook.style.ts +++ b/src/Home/components/NavigateLecueBook/NavigateLecueBook.style.ts @@ -8,32 +8,30 @@ export const MainWrapper = styled.div` export const IconWrapper = styled.section` display: flex; - gap: 15.7rem; - justify-content: space-between; + + /* 바뀔 수 있을 것 같으니 디자인 나오면 다시 확인해보기 ! */ + gap: 16rem; align-items: baseline; width: 100%; - padding: 6rem 1.6rem 5rem; + margin: 4rem 1.8rem 3.5rem 1.6rem; `; -export const ButtonWrapper = styled.section` - display: flex; - gap: 1rem; - flex-direction: column; +export const DummyGraphic = styled.div` + width: 37.5rem; + height: 20rem; - padding: 0 9.5rem 4.9rem 0; + background-color: ${({ theme }) => theme.colors.LG}; `; -export const Button = styled.button<{ variant?: boolean }>` - width: 28rem; - height: 6.4rem; +export const Button = styled.button` + padding: 2.1rem 9.4rem 2.2rem 8.8rem; + margin: 2rem 0 4rem; border: 0.1rem solid ${({ theme }) => theme.colors.BG}; border-radius: 0 0.2rem 0.2rem 0; border-left: none; - background-color: ${({ theme, variant }) => - variant ? theme.colors.white : theme.colors.BG}; - color: ${({ theme, variant }) => - variant ? theme.colors.BG : theme.colors.white}; + background-color: ${({ theme }) => theme.colors.BG}; + color: ${({ theme }) => theme.colors.white}; ${({ theme }) => theme.fonts.Title1_SB_16} `; diff --git a/src/Home/components/NavigateLecueBook/index.tsx b/src/Home/components/NavigateLecueBook/index.tsx index 29b9e660..916ec8c0 100644 --- a/src/Home/components/NavigateLecueBook/index.tsx +++ b/src/Home/components/NavigateLecueBook/index.tsx @@ -1,18 +1,25 @@ import { useState } from 'react'; import { useNavigate } from 'react-router-dom'; -import { IcNotice, ImgLogoLecue } from '../../../assets'; +import { IcProfile, ImgLogoLecue } from '../../../assets'; import CommonModal from '../../../components/common/Modal/CommonModal'; import * as S from './NavigateLecueBook.style'; function NavigateLecueBook() { - const NAVIGATE_CATEGORY = ['레큐북 만들기', '내 기록 보기']; const navigate = useNavigate(); const [modalOn, setModalOn] = useState(false); - const handleClickNavBtn = (idx: number) => { + const handleClickIcProfile = () => { if (localStorage.getItem('token')) { - idx === 0 ? navigate('/target') : navigate('/mypage'); + navigate('/mypage'); + } else { + setModalOn(true); + } + }; + + const handleClickNavBtn = () => { + if (localStorage.getItem('token')) { + navigate('/target'); } else { setModalOn(true); } @@ -22,29 +29,16 @@ function NavigateLecueBook() { - - - + + - - {NAVIGATE_CATEGORY.map((category, idx) => { - return ( - handleClickNavBtn(idx)} - > - {category} - - ); - })} - + {/* 임시로 넣은 것! 추후 새로운 그래픽으로 수정 */} + + + + 레큐북 만들기 + {modalOn && ( Date: Mon, 4 Mar 2024 18:50:32 +0900 Subject: [PATCH 03/28] =?UTF-8?q?style:=20=EA=B0=84=EA=B2=A9=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/components/LecueBookList/LecueBookList.style.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Home/components/LecueBookList/LecueBookList.style.ts b/src/Home/components/LecueBookList/LecueBookList.style.ts index 411e6889..c6d876a6 100644 --- a/src/Home/components/LecueBookList/LecueBookList.style.ts +++ b/src/Home/components/LecueBookList/LecueBookList.style.ts @@ -25,11 +25,11 @@ export const Title = styled.header` export const LecueBookList = styled.section` display: grid; - gap: 2.2rem; + gap: 2em 2.4rem; grid-template-columns: repeat(3, 1fr); width: 100%; - padding: 3rem 1.6rem 2.2rem; + padding: 3rem 1.6rem; `; export const LecueBook = styled.li` From 6d8fe012e5736c08caec0c2060587c7c2144da4b Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Mon, 4 Mar 2024 18:51:02 +0900 Subject: [PATCH 04/28] =?UTF-8?q?feat:=20=EB=A0=88=ED=81=90=EB=B6=81=20?= =?UTF-8?q?=EB=B3=B4=EC=97=AC=EC=A3=BC=EB=8A=94=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=EB=A5=BC=20=EA=B3=B5=ED=86=B5=20=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=EB=A1=9C=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/components/LecueBookList/index.tsx | 44 ++++++++++++--------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/src/Home/components/LecueBookList/index.tsx b/src/Home/components/LecueBookList/index.tsx index 0bad82f7..a0b77b8e 100644 --- a/src/Home/components/LecueBookList/index.tsx +++ b/src/Home/components/LecueBookList/index.tsx @@ -1,8 +1,6 @@ -// import { useNavigate } from 'react-router-dom'; +import { useNavigate } from 'react-router'; -import { useNavigate } from 'react-router-dom'; - -import useGetLecueBook from '../../hooks/useGetLecueBook'; +import NoBookmarkList from '../NoBookmarkList'; import * as S from './LecueBookList.style'; interface BookProps { @@ -12,8 +10,12 @@ interface BookProps { favoriteName: string; } -function LecueBookList() { - const { data } = useGetLecueBook(); +interface LecueBookListProps { + title: string; + data?: [BookProps]; +} + +function LecueBookList({ title, data }: LecueBookListProps) { const navigate = useNavigate(); const handleClickLecueBook = (uuid: string) => { @@ -22,19 +24,23 @@ function LecueBookList() { return ( - 인기 레큐북 구경하기 - - {data && - data.data.map((book: BookProps) => ( - handleClickLecueBook(book.bookUuid)} - > - - {book.favoriteName} - - ))} - + {title} + {data ? ( + + {data && + data.map((book: BookProps) => ( + handleClickLecueBook(book.bookUuid)} + > + + {book.favoriteName} + + ))} + + ) : ( + + )} ); } From d2b73599f6183e4c3a835e5f4013ee94c1fbe351 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Mon, 4 Mar 2024 18:51:22 +0900 Subject: [PATCH 05/28] =?UTF-8?q?feat:=20=EC=A6=90=EA=B2=A8=EC=B0=BE?= =?UTF-8?q?=EA=B8=B0=ED=95=9C=20=EB=A0=88=ED=81=90=EB=B6=81=EC=9D=B4=20?= =?UTF-8?q?=EC=97=86=EB=8A=94=20=EA=B2=BD=EC=9A=B0=20=EB=9D=84=EC=9B=8C?= =?UTF-8?q?=EC=A4=84=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NoBookmarkList/NoBookmarkList.style.ts | 33 +++++++++++++++++++ src/Home/components/NoBookmarkList/index.tsx | 18 ++++++++++ 2 files changed, 51 insertions(+) create mode 100644 src/Home/components/NoBookmarkList/NoBookmarkList.style.ts create mode 100644 src/Home/components/NoBookmarkList/index.tsx diff --git a/src/Home/components/NoBookmarkList/NoBookmarkList.style.ts b/src/Home/components/NoBookmarkList/NoBookmarkList.style.ts new file mode 100644 index 00000000..eb7865c0 --- /dev/null +++ b/src/Home/components/NoBookmarkList/NoBookmarkList.style.ts @@ -0,0 +1,33 @@ +import styled from '@emotion/styled'; + +export const ListWrapper = styled.section` + display: flex; + gap: 2rem; + justify-content: center; + align-items: center; + flex-direction: column; + + padding: 3rem 0; +`; + +export const DescriptionWrapper = styled.article` + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; +`; + +export const Description = styled.p` + color: ${({ theme }) => theme.colors.BG}; + ${({ theme }) => theme.fonts.Body2_M_14}; +`; + +export const NavigateBtn = styled.button` + padding: 0.8rem 2.8rem; + + border: 0.1rem solid ${({ theme }) => theme.colors.BG}; + border-radius: 0.6rem; + background-color: ${({ theme }) => theme.colors.white}; + color: ${({ theme }) => theme.colors.BG}; + ${({ theme }) => theme.fonts.Body4_SB_14}; +`; diff --git a/src/Home/components/NoBookmarkList/index.tsx b/src/Home/components/NoBookmarkList/index.tsx new file mode 100644 index 00000000..3b65623c --- /dev/null +++ b/src/Home/components/NoBookmarkList/index.tsx @@ -0,0 +1,18 @@ +import * as S from './NoBookmarkList.style'; + +const NoBookmarkList = () => { + return ( + + + 아직 즐겨찾기한 레큐북이 없어요. + + 자주 보고 싶은 레큐북을 즐겨찾기 해보세요. + + + + 레큐북 보러가기 + + ); +}; + +export default NoBookmarkList; From beca111ad8ba2d13885f5f390b7acd452122e792 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Mon, 4 Mar 2024 18:51:38 +0900 Subject: [PATCH 06/28] =?UTF-8?q?feat:=20=EA=B3=B5=ED=86=B5=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=20=ED=99=9C=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EC=97=AC=20=EB=A0=88=ED=81=90=EB=B6=81=20=EB=B3=B4=EC=97=AC?= =?UTF-8?q?=EC=A3=BC=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/page/index.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Home/page/index.tsx b/src/Home/page/index.tsx index 1c4c3db5..97f15783 100644 --- a/src/Home/page/index.tsx +++ b/src/Home/page/index.tsx @@ -8,7 +8,7 @@ import useGetLecueBook from '../hooks/useGetLecueBook'; import * as S from './Home.style'; function Home({ handleStep }: StepProps) { - const { isLoading } = useGetLecueBook(); + const { isLoading, data } = useGetLecueBook(); useEffect(() => { handleStep(1); @@ -19,7 +19,8 @@ function Home({ handleStep }: StepProps) { ) : ( - + + ); } From fcbc77de76206398648c507123d5224b3d65a868 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Mon, 4 Mar 2024 19:54:30 +0900 Subject: [PATCH 07/28] =?UTF-8?q?chore:=20=EC=A3=BC=EC=84=9D=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/page/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Home/page/index.tsx b/src/Home/page/index.tsx index 97f15783..2c54b96b 100644 --- a/src/Home/page/index.tsx +++ b/src/Home/page/index.tsx @@ -19,6 +19,7 @@ function Home({ handleStep }: StepProps) { ) : ( + {/* 서버 api 나오면 즐겨찾기 data props로 넘겨주는 부분 추가할 예정 */} From 4839f854af4f4a124a4935f4743ba2be7008a117 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Mon, 4 Mar 2024 20:05:20 +0900 Subject: [PATCH 08/28] =?UTF-8?q?feat:=20=EB=B2=84=ED=8A=BC=20=ED=81=B4?= =?UTF-8?q?=EB=A6=AD=20=EC=9D=B4=EB=B2=A4=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/components/NoBookmarkList/index.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Home/components/NoBookmarkList/index.tsx b/src/Home/components/NoBookmarkList/index.tsx index 3b65623c..c2c43909 100644 --- a/src/Home/components/NoBookmarkList/index.tsx +++ b/src/Home/components/NoBookmarkList/index.tsx @@ -1,6 +1,14 @@ +import { useNavigate } from 'react-router'; + import * as S from './NoBookmarkList.style'; const NoBookmarkList = () => { + const navigate = useNavigate(); + + const handleClickNavigateBtn = () => { + navigate('/mypage'); + }; + return ( @@ -10,7 +18,9 @@ const NoBookmarkList = () => { - 레큐북 보러가기 + + 레큐북 보러가기 + ); }; From 782850586f83fd152a479f21bbd6a58016cc617f Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Mon, 4 Mar 2024 20:23:50 +0900 Subject: [PATCH 09/28] =?UTF-8?q?feat:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EC=97=AC=EB=B6=80=EC=97=90=20=EB=94=B0=EB=A5=B8=20=EB=B6=84?= =?UTF-8?q?=EA=B8=B0=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/page/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Home/page/index.tsx b/src/Home/page/index.tsx index 2c54b96b..d4cd29bf 100644 --- a/src/Home/page/index.tsx +++ b/src/Home/page/index.tsx @@ -8,6 +8,7 @@ import useGetLecueBook from '../hooks/useGetLecueBook'; import * as S from './Home.style'; function Home({ handleStep }: StepProps) { + const token = localStorage.getItem('token'); const { isLoading, data } = useGetLecueBook(); useEffect(() => { @@ -20,7 +21,7 @@ function Home({ handleStep }: StepProps) { {/* 서버 api 나오면 즐겨찾기 data props로 넘겨주는 부분 추가할 예정 */} - + {token && } ); From 5e85e9eb9d70b0f290898fb5f01854febcbc1d97 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Tue, 5 Mar 2024 16:12:47 +0900 Subject: [PATCH 10/28] =?UTF-8?q?refactor:=20=EB=A6=AC=EB=B7=B0=20?= =?UTF-8?q?=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/components/LecueBookList/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Home/components/LecueBookList/index.tsx b/src/Home/components/LecueBookList/index.tsx index a0b77b8e..63a346b0 100644 --- a/src/Home/components/LecueBookList/index.tsx +++ b/src/Home/components/LecueBookList/index.tsx @@ -12,7 +12,7 @@ interface BookProps { interface LecueBookListProps { title: string; - data?: [BookProps]; + data?: BookProps[]; } function LecueBookList({ title, data }: LecueBookListProps) { From 0175ef1aa3c2039abeb3dcacf8820c7934045779 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Tue, 5 Mar 2024 17:18:23 +0900 Subject: [PATCH 11/28] =?UTF-8?q?feat:=20=EC=A6=90=EA=B2=A8=EC=B0=BE?= =?UTF-8?q?=EA=B8=B0=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20>=20?= =?UTF-8?q?=EB=A0=88=ED=81=90=EB=B6=81=EC=97=90=20=EC=A6=90=EA=B2=A8?= =?UTF-8?q?=EC=B0=BE=EA=B8=B0=20=EC=95=84=EC=9D=B4=EC=BD=98=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/components/LecueBookList/LecueBookList.style.ts | 8 +++++++- src/Home/components/LecueBookList/index.tsx | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Home/components/LecueBookList/LecueBookList.style.ts b/src/Home/components/LecueBookList/LecueBookList.style.ts index c6d876a6..4bf72bfe 100644 --- a/src/Home/components/LecueBookList/LecueBookList.style.ts +++ b/src/Home/components/LecueBookList/LecueBookList.style.ts @@ -38,13 +38,19 @@ export const LecueBook = styled.li` justify-content: center; align-items: center; flex-direction: column; + position: relative; width: 100%; - height: 14rem; cursor: pointer; `; +export const IconWrapper = styled.div` + position: absolute; + top: 0; + left: 0.1rem; +`; + export const BookImage = styled.img` width: 9.8rem; height: 9.8rem; diff --git a/src/Home/components/LecueBookList/index.tsx b/src/Home/components/LecueBookList/index.tsx index 63a346b0..5dc07c4a 100644 --- a/src/Home/components/LecueBookList/index.tsx +++ b/src/Home/components/LecueBookList/index.tsx @@ -1,5 +1,6 @@ import { useNavigate } from 'react-router'; +import { IcHomeFavorite } from '../../../assets'; import NoBookmarkList from '../NoBookmarkList'; import * as S from './LecueBookList.style'; @@ -17,6 +18,7 @@ interface LecueBookListProps { function LecueBookList({ title, data }: LecueBookListProps) { const navigate = useNavigate(); + const isBookmark = title.includes('즐겨찾기'); const handleClickLecueBook = (uuid: string) => { navigate(`/lecue-book/${uuid}`); @@ -33,6 +35,11 @@ function LecueBookList({ title, data }: LecueBookListProps) { key={book.bookId} onClick={() => handleClickLecueBook(book.bookUuid)} > + {isBookmark && ( + + + + )} {book.favoriteName} From a028b966903ebac99fee539334ef22f313ee14c6 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Tue, 5 Mar 2024 17:49:56 +0900 Subject: [PATCH 12/28] =?UTF-8?q?feat:=20=EC=A6=90=EA=B2=A8=EC=B0=BE?= =?UTF-8?q?=EA=B8=B0=20=EC=95=84=EC=9D=B4=EC=BD=98=20=ED=81=B4=EB=A6=AD=20?= =?UTF-8?q?=EC=8B=9C,=20=ED=95=B4=EB=8B=B9=20=EB=A0=88=ED=81=90=EB=B6=81?= =?UTF-8?q?=20=EC=82=AC=EB=9D=BC=EC=A7=80=EA=B2=8C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/components/LecueBookList/index.tsx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Home/components/LecueBookList/index.tsx b/src/Home/components/LecueBookList/index.tsx index 5dc07c4a..e0011cfc 100644 --- a/src/Home/components/LecueBookList/index.tsx +++ b/src/Home/components/LecueBookList/index.tsx @@ -24,6 +24,15 @@ function LecueBookList({ title, data }: LecueBookListProps) { navigate(`/lecue-book/${uuid}`); }; + const handleClickFavoriteIcon = (bookId: number) => { + // api가 나오면 서버 통신 코드로 변경할 예정! (현재는 임시로 구현해둠) + const clickedBookMark = document.getElementById(`${bookId}`); + + if (clickedBookMark) { + clickedBookMark.style.display = 'none'; + } + }; + return ( {title} @@ -33,10 +42,16 @@ function LecueBookList({ title, data }: LecueBookListProps) { data.map((book: BookProps) => ( handleClickLecueBook(book.bookUuid)} > {isBookmark && ( - + { + e.stopPropagation(); + handleClickFavoriteIcon(book.bookId); + }} + > )} From ece2ce88fc80a69061e6af060cf3608be03574d2 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Thu, 7 Mar 2024 01:08:28 +0900 Subject: [PATCH 13/28] =?UTF-8?q?refactor:=20stopPropagation=20=EC=99=B8?= =?UTF-8?q?=EC=9D=98=20=EC=9D=B4=EB=B2=A4=ED=8A=B8=20=EB=B2=84=EB=B8=94?= =?UTF-8?q?=EB=A7=81=20=EB=B0=A9=EC=A7=80=20=EC=BD=94=EB=93=9C=EB=A1=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/components/LecueBookList/index.tsx | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/Home/components/LecueBookList/index.tsx b/src/Home/components/LecueBookList/index.tsx index e0011cfc..26703cde 100644 --- a/src/Home/components/LecueBookList/index.tsx +++ b/src/Home/components/LecueBookList/index.tsx @@ -40,22 +40,20 @@ function LecueBookList({ title, data }: LecueBookListProps) { {data && data.map((book: BookProps) => ( - handleClickLecueBook(book.bookUuid)} - > + {isBookmark && ( { - e.stopPropagation(); - handleClickFavoriteIcon(book.bookId); - }} + onClick={() => handleClickFavoriteIcon(book.bookId)} > )} - + + handleClickLecueBook(book.bookUuid)} + /> {book.favoriteName} ))} From 6065c063be7b6d5c61f6d437ddf49c9814e6a129 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Fri, 15 Mar 2024 13:53:05 +0900 Subject: [PATCH 14/28] =?UTF-8?q?chore:=20=EC=95=88=20=EC=93=B0=EB=8A=94?= =?UTF-8?q?=20=ED=8C=8C=EC=9D=BC=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/hooks/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/Home/hooks/.gitkeep diff --git a/src/Home/hooks/.gitkeep b/src/Home/hooks/.gitkeep deleted file mode 100644 index e69de29b..00000000 From 6a31d263003323e2a00104a69922fd03540f1112 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Fri, 15 Mar 2024 13:53:32 +0900 Subject: [PATCH 15/28] =?UTF-8?q?feat:=20=EC=A6=90=EA=B2=A8=EC=B0=BE?= =?UTF-8?q?=EA=B8=B0=ED=95=9C=20=EB=A0=88=ED=81=90=EB=B6=81=20=EB=B6=88?= =?UTF-8?q?=EB=9F=AC=EC=98=A4=EB=8A=94=20api=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/api/getFavorite.ts | 16 ++++++++++++++++ src/Home/hooks/useGetFavorite.ts | 19 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 src/Home/api/getFavorite.ts create mode 100644 src/Home/hooks/useGetFavorite.ts diff --git a/src/Home/api/getFavorite.ts b/src/Home/api/getFavorite.ts new file mode 100644 index 00000000..3122b033 --- /dev/null +++ b/src/Home/api/getFavorite.ts @@ -0,0 +1,16 @@ +import { api } from '../../libs/api'; + +const getFavorite = async () => { + const token = localStorage.getItem('token'); + const { data } = await api.get('/api/favorite', { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${token}`, + }, + }); + return data; + + console.log(data); +}; + +export default getFavorite; diff --git a/src/Home/hooks/useGetFavorite.ts b/src/Home/hooks/useGetFavorite.ts new file mode 100644 index 00000000..fc48f529 --- /dev/null +++ b/src/Home/hooks/useGetFavorite.ts @@ -0,0 +1,19 @@ +import { useQuery } from 'react-query'; +import { useNavigate } from 'react-router-dom'; + +import getFavorite from '../api/getFavorite'; + +const useGetFavorite = () => { + const navigate = useNavigate(); + + const { isLoading: isLoadingFavorite, data: favorite } = useQuery({ + queryKey: ['get-favorite'], + queryFn: () => getFavorite(), + onError: () => navigate('/error'), + refetchOnWindowFocus: false, + }); + + return { isLoading: isLoadingFavorite, data: favorite }; +}; + +export default useGetFavorite; From 76e8207d69f945e2d3527b5bde126fd0ec3ee3a4 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Fri, 15 Mar 2024 13:54:24 +0900 Subject: [PATCH 16/28] =?UTF-8?q?chore:=20NoBookmarkList=20=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=EB=A5=BC=20=EB=A6=AC=ED=84=B4?= =?UTF-8?q?=ED=95=98=EB=8A=94=20=EC=A1=B0=EA=B1=B4=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/components/LecueBookList/index.tsx | 37 ++++++++++----------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/src/Home/components/LecueBookList/index.tsx b/src/Home/components/LecueBookList/index.tsx index 26703cde..c77f161d 100644 --- a/src/Home/components/LecueBookList/index.tsx +++ b/src/Home/components/LecueBookList/index.tsx @@ -36,27 +36,26 @@ function LecueBookList({ title, data }: LecueBookListProps) { return ( {title} - {data ? ( + {data && data.length !== 0 ? ( - {data && - data.map((book: BookProps) => ( - - {isBookmark && ( - handleClickFavoriteIcon(book.bookId)} - > - - - )} + {data.map((book: BookProps) => ( + + {isBookmark && ( + handleClickFavoriteIcon(book.bookId)} + > + + + )} - handleClickLecueBook(book.bookUuid)} - /> - {book.favoriteName} - - ))} + handleClickLecueBook(book.bookUuid)} + /> + {book.favoriteName} + + ))} ) : ( From 0542994f8387cdd5d3721ceea60746f7d4f0f2bd Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Fri, 15 Mar 2024 13:54:47 +0900 Subject: [PATCH 17/28] =?UTF-8?q?feat:=20isLoading,=20data=20=EB=A6=AC?= =?UTF-8?q?=ED=84=B4=20=EB=AA=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/hooks/useGetLecueBook.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Home/hooks/useGetLecueBook.ts b/src/Home/hooks/useGetLecueBook.ts index 0fa4627e..a43b43ea 100644 --- a/src/Home/hooks/useGetLecueBook.ts +++ b/src/Home/hooks/useGetLecueBook.ts @@ -6,14 +6,14 @@ import getLecueBook from '../api/getLecueBook'; const useGetLecueBook = () => { const navigate = useNavigate(); - const { isLoading, data } = useQuery({ + const { isLoading: isLoadingLecueBook, data: lecueBook } = useQuery({ queryKey: ['get-lecue-book'], queryFn: () => getLecueBook(), onError: () => navigate('/error'), refetchOnWindowFocus: false, }); - return { isLoading, data }; + return { isLoading: isLoadingLecueBook, data: lecueBook }; }; export default useGetLecueBook; From ded72362254fddae365baed9788cad1dd61cb3cc Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Fri, 15 Mar 2024 13:55:04 +0900 Subject: [PATCH 18/28] =?UTF-8?q?feat:=20=ED=99=88=20=ED=99=94=EB=A9=B4?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=A6=90=EA=B2=A8=EC=B0=BE=EA=B8=B0=20api?= =?UTF-8?q?=20=ED=98=B8=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/page/index.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Home/page/index.tsx b/src/Home/page/index.tsx index d4cd29bf..c13a276b 100644 --- a/src/Home/page/index.tsx +++ b/src/Home/page/index.tsx @@ -4,25 +4,29 @@ import LoadingPage from '../../components/common/LoadingPage'; import { StepProps } from '../../Splash/page/SplashPage'; import LecueBookList from '../components/LecueBookList'; import NavigateLecueBook from '../components/NavigateLecueBook'; +import useGetFavorite from '../hooks/useGetFavorite'; import useGetLecueBook from '../hooks/useGetLecueBook'; import * as S from './Home.style'; function Home({ handleStep }: StepProps) { const token = localStorage.getItem('token'); - const { isLoading, data } = useGetLecueBook(); + const { isLoading: isLoadingLecueBook, data: lecueBook } = useGetLecueBook(); + const { isLoading: isLoadingFavorite, data: favorite } = useGetFavorite(); useEffect(() => { handleStep(1); }, []); - return isLoading ? ( + return isLoadingLecueBook || isLoadingFavorite ? ( ) : ( - {/* 서버 api 나오면 즐겨찾기 data props로 넘겨주는 부분 추가할 예정 */} - {token && } - + + {token && ( + + )} + ); } From 652c34b78f9a884276616d342a504fa80e83178f Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Fri, 15 Mar 2024 14:06:19 +0900 Subject: [PATCH 19/28] =?UTF-8?q?chore:=20=ED=95=84=EC=9A=94=EC=97=86?= =?UTF-8?q?=EB=8A=94=20=EC=BD=94=EB=93=9C=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/api/getFavorite.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Home/api/getFavorite.ts b/src/Home/api/getFavorite.ts index 3122b033..b76b6091 100644 --- a/src/Home/api/getFavorite.ts +++ b/src/Home/api/getFavorite.ts @@ -9,8 +9,6 @@ const getFavorite = async () => { }, }); return data; - - console.log(data); }; export default getFavorite; From 5c8d5afe80d9a0a38eea332feaefd19bc01392b4 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Fri, 15 Mar 2024 14:08:07 +0900 Subject: [PATCH 20/28] =?UTF-8?q?feat:=20=EC=A6=90=EA=B2=A8=EC=B0=BE?= =?UTF-8?q?=EA=B8=B0=20=EC=82=AD=EC=A0=9C=20api=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/api/deleteFavorite.ts | 16 ++++++++++++++++ src/Home/hooks/useDeleteFavorite.ts | 18 ++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 src/Home/api/deleteFavorite.ts create mode 100644 src/Home/hooks/useDeleteFavorite.ts diff --git a/src/Home/api/deleteFavorite.ts b/src/Home/api/deleteFavorite.ts new file mode 100644 index 00000000..d47d7c76 --- /dev/null +++ b/src/Home/api/deleteFavorite.ts @@ -0,0 +1,16 @@ +import { api } from '../../libs/api'; + +const deleteFavorite = async (bookId: number) => { + const token = localStorage.getItem('token'); + const { data } = await api.delete('/api/favorite', { + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${token}`, + }, + data: { bookId: bookId }, + }); + + return data; +}; + +export default deleteFavorite; diff --git a/src/Home/hooks/useDeleteFavorite.ts b/src/Home/hooks/useDeleteFavorite.ts new file mode 100644 index 00000000..1c0dfabd --- /dev/null +++ b/src/Home/hooks/useDeleteFavorite.ts @@ -0,0 +1,18 @@ +import { useMutation } from 'react-query'; +import { useNavigate } from 'react-router-dom'; + +import deleteFavorite from '../api/deleteFavorite'; + +const useDeleteFavorite = () => { + const navigate = useNavigate(); + const mutation = useMutation({ + mutationFn: (bookId: number) => { + return deleteFavorite(bookId); + }, + onError: () => navigate('/error'), + onSuccess: () => location.reload(), + }); + return mutation; +}; + +export default useDeleteFavorite; From 825cd4d8a7638bee0b9834faaa7e988e30a29c1f Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Fri, 15 Mar 2024 14:08:28 +0900 Subject: [PATCH 21/28] =?UTF-8?q?feat:=20=EC=A6=90=EA=B2=A8=EC=B0=BE?= =?UTF-8?q?=EA=B8=B0=20=EC=95=84=EC=9D=B4=EC=BD=98=20=ED=81=B4=EB=A6=AD=20?= =?UTF-8?q?=EC=8B=9C=20=EC=82=AD=EC=A0=9C=20api=20=ED=98=B8=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/components/LecueBookList/index.tsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Home/components/LecueBookList/index.tsx b/src/Home/components/LecueBookList/index.tsx index c77f161d..bbe839f7 100644 --- a/src/Home/components/LecueBookList/index.tsx +++ b/src/Home/components/LecueBookList/index.tsx @@ -1,6 +1,7 @@ import { useNavigate } from 'react-router'; import { IcHomeFavorite } from '../../../assets'; +import useDeleteFavorite from '../../hooks/useDeleteFavorite'; import NoBookmarkList from '../NoBookmarkList'; import * as S from './LecueBookList.style'; @@ -18,6 +19,7 @@ interface LecueBookListProps { function LecueBookList({ title, data }: LecueBookListProps) { const navigate = useNavigate(); + const deleteMutation = useDeleteFavorite(); const isBookmark = title.includes('즐겨찾기'); const handleClickLecueBook = (uuid: string) => { @@ -25,12 +27,7 @@ function LecueBookList({ title, data }: LecueBookListProps) { }; const handleClickFavoriteIcon = (bookId: number) => { - // api가 나오면 서버 통신 코드로 변경할 예정! (현재는 임시로 구현해둠) - const clickedBookMark = document.getElementById(`${bookId}`); - - if (clickedBookMark) { - clickedBookMark.style.display = 'none'; - } + deleteMutation.mutate(bookId); }; return ( From a591b1c59578abcb49333e0f2aeac7c37a622e37 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Fri, 15 Mar 2024 14:50:22 +0900 Subject: [PATCH 22/28] =?UTF-8?q?chore:=20return=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/api/getFavorite.ts | 2 +- src/Home/api/getLecueBook.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Home/api/getFavorite.ts b/src/Home/api/getFavorite.ts index b76b6091..7c7122d7 100644 --- a/src/Home/api/getFavorite.ts +++ b/src/Home/api/getFavorite.ts @@ -8,7 +8,7 @@ const getFavorite = async () => { Authorization: `Bearer ${token}`, }, }); - return data; + return data.data; }; export default getFavorite; diff --git a/src/Home/api/getLecueBook.ts b/src/Home/api/getLecueBook.ts index 336d2a2b..28a38c07 100644 --- a/src/Home/api/getLecueBook.ts +++ b/src/Home/api/getLecueBook.ts @@ -2,7 +2,7 @@ import { api } from '../../libs/api'; const getLecueBook = async () => { const { data } = await api.get('/api/common/home'); - return data; + return data.data; }; export default getLecueBook; From 9ccb96cd16abedc67fd7c055bcb6f24a2fa7bd48 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Fri, 15 Mar 2024 14:50:50 +0900 Subject: [PATCH 23/28] =?UTF-8?q?feat:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EB=B6=84=EA=B8=B0=EC=B2=98=EB=A6=AC=20=EC=82=AD=EC=A0=9C,=20st?= =?UTF-8?q?ate=EB=A1=9C=20token=20=EB=84=98=EA=B2=A8=EC=A4=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/components/NavigateLecueBook/index.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Home/components/NavigateLecueBook/index.tsx b/src/Home/components/NavigateLecueBook/index.tsx index 916ec8c0..6215939f 100644 --- a/src/Home/components/NavigateLecueBook/index.tsx +++ b/src/Home/components/NavigateLecueBook/index.tsx @@ -10,11 +10,9 @@ function NavigateLecueBook() { const [modalOn, setModalOn] = useState(false); const handleClickIcProfile = () => { - if (localStorage.getItem('token')) { - navigate('/mypage'); - } else { - setModalOn(true); - } + const token = localStorage.getItem('token'); + + navigate('/mypage', { state: token }); }; const handleClickNavBtn = () => { From 68d48f791e6c75bb2da6a7a4c903285f2c56f1ef Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Fri, 15 Mar 2024 14:51:17 +0900 Subject: [PATCH 24/28] =?UTF-8?q?feat:=20=EC=9D=B8=EA=B8=B0,=20=EC=A6=90?= =?UTF-8?q?=EA=B2=A8=EC=B0=BE=EA=B8=B0=20=EB=A0=88=ED=81=90=EB=B6=81=20api?= =?UTF-8?q?=20=ED=98=B8=EC=B6=9C=20=EC=9C=84=EC=B9=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/components/LecueBookList/index.tsx | 6 ++++-- src/Home/page/index.tsx | 12 ++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/Home/components/LecueBookList/index.tsx b/src/Home/components/LecueBookList/index.tsx index bbe839f7..014cc93e 100644 --- a/src/Home/components/LecueBookList/index.tsx +++ b/src/Home/components/LecueBookList/index.tsx @@ -2,6 +2,8 @@ import { useNavigate } from 'react-router'; import { IcHomeFavorite } from '../../../assets'; import useDeleteFavorite from '../../hooks/useDeleteFavorite'; +import useGetFavorite from '../../hooks/useGetFavorite'; +import useGetLecueBook from '../../hooks/useGetLecueBook'; import NoBookmarkList from '../NoBookmarkList'; import * as S from './LecueBookList.style'; @@ -14,13 +16,13 @@ interface BookProps { interface LecueBookListProps { title: string; - data?: BookProps[]; } -function LecueBookList({ title, data }: LecueBookListProps) { +function LecueBookList({ title }: LecueBookListProps) { const navigate = useNavigate(); const deleteMutation = useDeleteFavorite(); const isBookmark = title.includes('즐겨찾기'); + const { data } = isBookmark ? useGetFavorite() : useGetLecueBook(); const handleClickLecueBook = (uuid: string) => { navigate(`/lecue-book/${uuid}`); diff --git a/src/Home/page/index.tsx b/src/Home/page/index.tsx index c13a276b..9d640380 100644 --- a/src/Home/page/index.tsx +++ b/src/Home/page/index.tsx @@ -4,29 +4,25 @@ import LoadingPage from '../../components/common/LoadingPage'; import { StepProps } from '../../Splash/page/SplashPage'; import LecueBookList from '../components/LecueBookList'; import NavigateLecueBook from '../components/NavigateLecueBook'; -import useGetFavorite from '../hooks/useGetFavorite'; import useGetLecueBook from '../hooks/useGetLecueBook'; import * as S from './Home.style'; function Home({ handleStep }: StepProps) { const token = localStorage.getItem('token'); - const { isLoading: isLoadingLecueBook, data: lecueBook } = useGetLecueBook(); - const { isLoading: isLoadingFavorite, data: favorite } = useGetFavorite(); + const { isLoading: isLoadingLecueBook } = useGetLecueBook(); useEffect(() => { handleStep(1); }, []); - return isLoadingLecueBook || isLoadingFavorite ? ( + return isLoadingLecueBook ? ( ) : ( - {token && ( - - )} - + {token && } + ); } From d1a3cd237d335e82bde8bd4e2c30f41d2867b5ce Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Tue, 19 Mar 2024 03:57:07 +0900 Subject: [PATCH 25/28] =?UTF-8?q?refactor:=20refetch=EB=A1=9C=20location.r?= =?UTF-8?q?eload=20=EB=8C=80=EC=B2=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/hooks/useDeleteFavorite.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Home/hooks/useDeleteFavorite.ts b/src/Home/hooks/useDeleteFavorite.ts index 1c0dfabd..81a364e1 100644 --- a/src/Home/hooks/useDeleteFavorite.ts +++ b/src/Home/hooks/useDeleteFavorite.ts @@ -1,16 +1,19 @@ -import { useMutation } from 'react-query'; +import { useMutation, useQueryClient } from 'react-query'; import { useNavigate } from 'react-router-dom'; import deleteFavorite from '../api/deleteFavorite'; const useDeleteFavorite = () => { const navigate = useNavigate(); + const queryClient = useQueryClient(); const mutation = useMutation({ mutationFn: (bookId: number) => { return deleteFavorite(bookId); }, onError: () => navigate('/error'), - onSuccess: () => location.reload(), + onSuccess: () => { + queryClient.refetchQueries(['get-favorite'], { exact: true }); + }, }); return mutation; }; From bfb939f1e9d37aac96e786a48262001b70006e58 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Tue, 19 Mar 2024 03:58:32 +0900 Subject: [PATCH 26/28] =?UTF-8?q?refactor:=20=EC=8B=9C=EB=A9=98=ED=8B=B1?= =?UTF-8?q?=20=ED=83=9C=EA=B7=B8=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/components/LecueBookList/LecueBookList.style.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Home/components/LecueBookList/LecueBookList.style.ts b/src/Home/components/LecueBookList/LecueBookList.style.ts index 4bf72bfe..d1079d34 100644 --- a/src/Home/components/LecueBookList/LecueBookList.style.ts +++ b/src/Home/components/LecueBookList/LecueBookList.style.ts @@ -45,7 +45,7 @@ export const LecueBook = styled.li` cursor: pointer; `; -export const IconWrapper = styled.div` +export const IconWrapper = styled.button` position: absolute; top: 0; left: 0.1rem; From 85b7e418aa1dcd527200295d09d80a3add64ebba Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Tue, 19 Mar 2024 04:03:23 +0900 Subject: [PATCH 27/28] =?UTF-8?q?remove:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=ED=8C=8C=EC=9D=BC=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libs/hooks/.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/libs/hooks/.keep diff --git a/src/libs/hooks/.keep b/src/libs/hooks/.keep deleted file mode 100644 index e69de29b..00000000 From a9c51e9060ec8865a21dacb374a1de9db99c94f8 Mon Sep 17 00:00:00 2001 From: seoAreum <1971236@hansung.ac.kr> Date: Tue, 19 Mar 2024 04:03:33 +0900 Subject: [PATCH 28/28] =?UTF-8?q?chore:=20=ED=8F=B4=EB=8D=94=20=EA=B5=AC?= =?UTF-8?q?=EC=A1=B0=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home/components/LecueBookList/index.tsx | 4 ++-- src/{Home => libs}/api/deleteFavorite.ts | 0 src/{Home => libs}/api/getFavorite.ts | 0 src/{Home => libs}/hooks/useDeleteFavorite.ts | 0 src/{Home => libs}/hooks/useGetFavorite.ts | 0 5 files changed, 2 insertions(+), 2 deletions(-) rename src/{Home => libs}/api/deleteFavorite.ts (100%) rename src/{Home => libs}/api/getFavorite.ts (100%) rename src/{Home => libs}/hooks/useDeleteFavorite.ts (100%) rename src/{Home => libs}/hooks/useGetFavorite.ts (100%) diff --git a/src/Home/components/LecueBookList/index.tsx b/src/Home/components/LecueBookList/index.tsx index 014cc93e..4eda671e 100644 --- a/src/Home/components/LecueBookList/index.tsx +++ b/src/Home/components/LecueBookList/index.tsx @@ -1,8 +1,8 @@ import { useNavigate } from 'react-router'; import { IcHomeFavorite } from '../../../assets'; -import useDeleteFavorite from '../../hooks/useDeleteFavorite'; -import useGetFavorite from '../../hooks/useGetFavorite'; +import useDeleteFavorite from '../../../libs/hooks/useDeleteFavorite'; +import useGetFavorite from '../../../libs/hooks/useGetFavorite'; import useGetLecueBook from '../../hooks/useGetLecueBook'; import NoBookmarkList from '../NoBookmarkList'; import * as S from './LecueBookList.style'; diff --git a/src/Home/api/deleteFavorite.ts b/src/libs/api/deleteFavorite.ts similarity index 100% rename from src/Home/api/deleteFavorite.ts rename to src/libs/api/deleteFavorite.ts diff --git a/src/Home/api/getFavorite.ts b/src/libs/api/getFavorite.ts similarity index 100% rename from src/Home/api/getFavorite.ts rename to src/libs/api/getFavorite.ts diff --git a/src/Home/hooks/useDeleteFavorite.ts b/src/libs/hooks/useDeleteFavorite.ts similarity index 100% rename from src/Home/hooks/useDeleteFavorite.ts rename to src/libs/hooks/useDeleteFavorite.ts diff --git a/src/Home/hooks/useGetFavorite.ts b/src/libs/hooks/useGetFavorite.ts similarity index 100% rename from src/Home/hooks/useGetFavorite.ts rename to src/libs/hooks/useGetFavorite.ts