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

Merge develop into main #281

Merged
merged 45 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
689499a
chore: update sentry
eunbeann Feb 21, 2024
73d14d1
fix: change ErrorBoundary
eunbeann Feb 21, 2024
7dc1b77
feat: 센트리 살리기
eunbeann Feb 21, 2024
937e092
fix: 에러 타입 추가 및 수정
eunbeann Feb 23, 2024
adf5bae
style: asset 추가
Arooming Feb 29, 2024
9dfd9ed
feat: navigate 컴포넌트 퍼블리싱
Arooming Feb 29, 2024
64d7c47
style: 간격 수정
Arooming Mar 4, 2024
6d8fe01
feat: 레큐북 보여주는 컴포넌트를 공통 컴포넌트로 분리
Arooming Mar 4, 2024
d2b7359
feat: 즐겨찾기한 레큐북이 없는 경우 띄워줄 컴포넌트 생성
Arooming Mar 4, 2024
beca111
feat: 공통컴포넌트 활용하여 레큐북 보여주기
Arooming Mar 4, 2024
fcbc77d
chore: 주석 추가
Arooming Mar 4, 2024
4839f85
feat: 버튼 클릭 이벤트 추가
Arooming Mar 4, 2024
7828505
feat: 로그인 여부에 따른 분기처리
Arooming Mar 4, 2024
f70005c
feat: 에러 리셋
eunbeann Mar 5, 2024
125b415
Merge pull request #258 from Team-Lecue/Home/#256-depending-on-login
Arooming Mar 5, 2024
5e85e9e
refactor: 리뷰 반영
Arooming Mar 5, 2024
7553639
Merge pull request #257 from Team-Lecue/Home/#254-home-publishing
Arooming Mar 5, 2024
0175ef1
feat: 즐겨찾기 컴포넌트 > 레큐북에 즐겨찾기 아이콘 추가
Arooming Mar 5, 2024
a028b96
feat: 즐겨찾기 아이콘 클릭 시, 해당 레큐북 사라지게 구현
Arooming Mar 5, 2024
ece2ce8
refactor: stopPropagation 외의 이벤트 버블링 방지 코드로 수정
Arooming Mar 6, 2024
e081a84
Merge pull request #260 from Team-Lecue/Home/#255-add-bookmark
Arooming Mar 10, 2024
6065c06
chore: 안 쓰는 파일 삭제
Arooming Mar 15, 2024
6a31d26
feat: 즐겨찾기한 레큐북 불러오는 api 연결
Arooming Mar 15, 2024
76e8207
chore: NoBookmarkList 컴포넌트를 리턴하는 조건 수정
Arooming Mar 15, 2024
0542994
feat: isLoading, data 리턴 명 수정
Arooming Mar 15, 2024
ded7236
feat: 홈 화면에서 즐겨찾기 api 호출
Arooming Mar 15, 2024
652c34b
chore: 필요없는 코드 삭제
Arooming Mar 15, 2024
5c8d5af
feat: 즐겨찾기 삭제 api 구현
Arooming Mar 15, 2024
825cd4d
feat: 즐겨찾기 아이콘 클릭 시 삭제 api 호출
Arooming Mar 15, 2024
a591b1c
chore: return 데이터 수정
Arooming Mar 15, 2024
9ccb96c
feat: 로그인 분기처리 삭제, state로 token 넘겨줌
Arooming Mar 15, 2024
68d48f7
feat: 인기, 즐겨찾기 레큐북 api 호출 위치 변경
Arooming Mar 15, 2024
c76c0e8
Merge branch 'develop' of https://github.com/Team-Lecue/Lecue-Client …
eunbeann Mar 18, 2024
030d937
remove: remove react-error-boundary
eunbeann Mar 18, 2024
3144d6f
remove: delete unuse reset
eunbeann Mar 18, 2024
d1a3cd2
refactor: refetch로 location.reload 대체
Arooming Mar 18, 2024
bfb939f
refactor: 시멘틱 태그로 수정
Arooming Mar 18, 2024
85b7e41
remove: 불필요한 파일 삭제
Arooming Mar 18, 2024
a9c51e9
chore: 폴더 구조 변경
Arooming Mar 18, 2024
12be7bd
Merge pull request #269 from Team-Lecue/Home/#259-add-api
Arooming Mar 18, 2024
601d2e7
Merge pull request #277 from Team-Lecue/SP1/Home
Arooming Mar 18, 2024
4ccb041
chore: delete console
eunbeann Mar 19, 2024
7eb9c75
Merge pull request #273 from Team-Lecue/Common/#272-Sentry
eunbeann Mar 20, 2024
23216c5
Merge pull request #280 from Team-Lecue/SP1/Common
eunbeann Mar 20, 2024
17c2643
hotfix: solve import error
eunbeann Mar 20, 2024
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
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@emotion/styled": "^11.11.0",
"@sentry/browser": "^7.93.0",
"@sentry/react": "^7.93.0",
"@sentry/vite-plugin": "^2.10.2",
"@sentry/vite-plugin": "^2.14.1",
"axios": "^1.6.5",
"eslint-plugin-react": "^7.33.2",
"grapheme-splitter": "^1.0.4",
Expand All @@ -27,7 +27,6 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-draggable": "^4.4.6",
"react-error-boundary": "^4.0.12",
"react-query": "^3.39.3",
"react-router-dom": "^6.21.1",
"vite-plugin-svgr": "^4.2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/Home/api/getLecueBook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
12 changes: 9 additions & 3 deletions src/Home/components/LecueBookList/LecueBookList.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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.button`
position: absolute;
top: 0;
left: 0.1rem;
`;

export const BookImage = styled.img`
width: 9.8rem;
height: 9.8rem;
Expand Down
54 changes: 39 additions & 15 deletions src/Home/components/LecueBookList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// import { useNavigate } from 'react-router-dom';

import { useNavigate } from 'react-router-dom';
import { useNavigate } from 'react-router';

import { IcHomeFavorite } from '../../../assets';
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';

interface BookProps {
Expand All @@ -12,29 +14,51 @@ interface BookProps {
favoriteName: string;
}

function LecueBookList() {
const { data } = useGetLecueBook();
interface LecueBookListProps {
title: string;
}

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}`);
};

const handleClickFavoriteIcon = (bookId: number) => {
deleteMutation.mutate(bookId);
};

return (
<S.LecueBookListWrapper>
<S.Title>인기 레큐북 구경하기</S.Title>
<S.LecueBookList>
{data &&
data.data.map((book: BookProps) => (
<S.LecueBook
key={book.bookId}
onClick={() => handleClickLecueBook(book.bookUuid)}
>
<S.BookImage src={book.favoriteImage} alt="레큐북-이미지" />
<S.Title>{title}</S.Title>
{data && data.length !== 0 ? (
<S.LecueBookList>
{data.map((book: BookProps) => (
<S.LecueBook key={book.bookId} id={`${book.bookId}`}>
{isBookmark && (
<S.IconWrapper
onClick={() => handleClickFavoriteIcon(book.bookId)}
>
<IcHomeFavorite />
</S.IconWrapper>
)}

<S.BookImage
src={book.favoriteImage}
alt="레큐북-이미지"
onClick={() => handleClickLecueBook(book.bookUuid)}
/>
<S.BookTitle>{book.favoriteName}</S.BookTitle>
</S.LecueBook>
))}
</S.LecueBookList>
</S.LecueBookList>
) : (
<NoBookmarkList />
)}
</S.LecueBookListWrapper>
);
}
Expand Down
28 changes: 13 additions & 15 deletions src/Home/components/NavigateLecueBook/NavigateLecueBook.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}
`;
42 changes: 17 additions & 25 deletions src/Home/components/NavigateLecueBook/index.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
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 = () => {
const token = localStorage.getItem('token');

navigate('/mypage', { state: token });
};

const handleClickNavBtn = () => {
if (localStorage.getItem('token')) {
idx === 0 ? navigate('/target') : navigate('/mypage');
navigate('/target');
} else {
setModalOn(true);
}
Expand All @@ -22,29 +27,16 @@ function NavigateLecueBook() {
<S.MainWrapper>
<S.IconWrapper>
<ImgLogoLecue />
<a
href="https://rileybyeon.notion.site/TEAM-LECUE-b7801fe345544442938d3e54980032e4?pvs=4"
target="_blank"
rel="noreferrer"
>
<IcNotice />
</a>

<IcProfile onClick={handleClickIcProfile} />
</S.IconWrapper>

<S.ButtonWrapper>
{NAVIGATE_CATEGORY.map((category, idx) => {
return (
<S.Button
type="button"
key={category}
variant={idx === 0}
onClick={() => handleClickNavBtn(idx)}
>
{category}
</S.Button>
);
})}
</S.ButtonWrapper>
{/* 임시로 넣은 것! 추후 새로운 그래픽으로 수정 */}
<S.DummyGraphic></S.DummyGraphic>

<S.Button type="button" onClick={handleClickNavBtn}>
레큐북 만들기
</S.Button>

{modalOn && (
<CommonModal
Expand Down
33 changes: 33 additions & 0 deletions src/Home/components/NoBookmarkList/NoBookmarkList.style.ts
Original file line number Diff line number Diff line change
@@ -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};
`;
28 changes: 28 additions & 0 deletions src/Home/components/NoBookmarkList/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { useNavigate } from 'react-router';

import * as S from './NoBookmarkList.style';

const NoBookmarkList = () => {
const navigate = useNavigate();

const handleClickNavigateBtn = () => {
navigate('/mypage');
};

return (
<S.ListWrapper>
<S.DescriptionWrapper>
<S.Description>아직 즐겨찾기한 레큐북이 없어요.</S.Description>
<S.Description>
자주 보고 싶은 레큐북을 즐겨찾기 해보세요.
</S.Description>
</S.DescriptionWrapper>

<S.NavigateBtn type="button" onClick={handleClickNavigateBtn}>
레큐북 보러가기
</S.NavigateBtn>
</S.ListWrapper>
);
};

export default NoBookmarkList;
Empty file removed src/Home/hooks/.gitkeep
Empty file.
4 changes: 2 additions & 2 deletions src/Home/hooks/useGetLecueBook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
9 changes: 6 additions & 3 deletions src/Home/page/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,21 @@ import useGetLecueBook from '../hooks/useGetLecueBook';
import * as S from './Home.style';

function Home({ handleStep }: StepProps) {
const { isLoading } = useGetLecueBook();
const token = localStorage.getItem('token');
const { isLoading: isLoadingLecueBook } = useGetLecueBook();

useEffect(() => {
handleStep(1);
}, []);

return isLoading ? (
return isLoadingLecueBook ? (
<LoadingPage />
) : (
<S.Wrapper>
<NavigateLecueBook />
<LecueBookList />

{token && <LecueBookList title="즐겨찾기한 레큐북" />}
<LecueBookList title="인기 레큐북 구경하기" />
</S.Wrapper>
);
}
Expand Down
Loading
Loading