-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(PlaceDetailCard): 여행기 사진 없을 경우 noImage이 아닌 아무것도 안나오도록 수정 * test(PlaceDetailCard): 이미지 없는 경우 테스트의 args 수정 * feat(getDaysAndNights): 여행일자 텍스트 생성 util 함수 구현 * refactor(TravelogueDetailPage,TravelPlanDetailPage): 여행 일자 계산 util 함수 사용 * feat(useInitialTripTitle): 여행기,여행계획 제목 초기값 생성 커스텀 훅 구현 * feat(TravelogueRegisterPage,useTravelPlanForm): 여행기,여행계획 변환시 제목 default값 제공 * feat(usePreviousPage): 뒤로가기를 관리하는 훅 구현 - 그 전페이지가 my 페이지이고 현재 페이지가 login 페이지면 뒤로 가기 누를시 메인 페이지로 이동하도록 구현 * chore(useInitialTripTitle): Trip을 Travel로 수정 * feat(TravelogueRegisterPage): 제목 input에 placeholder 추가 * fix(useInitialTravelTitle): 전환시에만 default title을 반환하도록 수정 * fix(interceptor): 리다이렉트 중이 아닐 때 alert,리다리렉트하도록 수정 - 인가 인증이 필요한 페이지에서 로그아웃 후 다시 인가 인증이 필요한 페이지로 이동시 로그인 하라는 alert창이 2번 뜨는 이슈가 있었는데, 리다이렉트 중에는 alert 및 리다이렉트를 하지 않도록 하여 수정함 * feat(queryKey): search 쿼리키에 searchType 추가 * feat(useInfiniteSearchTravelogue): 여행기 검색 param에 searchType 추가 * style(Tab): 텍스트 세로 가운데 정렬 및 theme 사용 리팩토링 * refactor(TravelogueList): 검색 결과 부분을 컴포넌트로 분리 * feat(SearchPage): 검색 타입 Tab 추가 * feat(getInitialTravelTitle): 제목 초기값에서 사용자 닉네임 삭제 - 사용자 닉네임을 삭제하면서 훅이 아니게되어 함수이름을 useInitialTravelTitle에서 getInitialTravelTitle로 수정하고 util 폴더로 이동 시켰습니다. * refactor(usePreviousPage): type에서 interface로 수정 * refactor(usePreviousPage): 필요없는 state 삭제 및 그 전 페이지만 저장하도록 수정 - 그전 페이지만 알면되므로 객체로 저장할 필요가 없고, 그전 페이지를 state로 관리할 필요가 없기에 수정했습니다.
- Loading branch information
Showing
19 changed files
with
263 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
frontend/src/components/pages/search/TravelogueList/TravelogueList.styled.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { css } from "@emotion/react"; | ||
import styled from "@emotion/styled"; | ||
|
||
import { SPACING } from "@styles/tokens"; | ||
|
||
export const Layout = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
margin-top: ${SPACING.xxxl}; | ||
min-height: calc(100vh - 16rem); | ||
`; | ||
|
||
export const searchResultTextStyle = css` | ||
display: -webkit-box; | ||
overflow: hidden; | ||
width: 100%; | ||
max-width: 100%; | ||
line-height: 1.5; | ||
white-space: normal; | ||
word-break: break-word; | ||
overflow-wrap: break-word; | ||
text-overflow: ellipsis; | ||
`; | ||
|
||
export const SearchFallbackWrapper = styled.div` | ||
flex: 1; | ||
position: relative; | ||
`; | ||
|
||
export const MainPageTraveloguesList = styled.ul` | ||
display: flex; | ||
flex-direction: column; | ||
gap: ${SPACING.m}; | ||
`; |
93 changes: 93 additions & 0 deletions
93
frontend/src/components/pages/search/TravelogueList/TravelogueList.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import { css } from "@emotion/react"; | ||
|
||
import type { SearchType } from "@type/domain/travelogue"; | ||
|
||
import useInfiniteSearchTravelogues from "@queries/useInfiniteSearchTravelogues"; | ||
|
||
import { SearchFallback, Text } from "@components/common"; | ||
import TravelogueCard from "@components/pages/main/TravelogueCard/TravelogueCard"; | ||
import TravelogueCardSkeleton from "@components/pages/main/TravelogueCard/skeleton/TravelogueCardSkeleton"; | ||
|
||
import useIntersectionObserver from "@hooks/useIntersectionObserver"; | ||
|
||
import { ERROR_MESSAGE_MAP } from "@constants/errorMessage"; | ||
|
||
import * as S from "./TravelogueList.styled"; | ||
|
||
const SKELETON_COUNT = 5; | ||
|
||
interface TravelogueListProps { | ||
keyword: string; | ||
searchType: SearchType; | ||
} | ||
|
||
const TravelogueList = ({ keyword, searchType }: TravelogueListProps) => { | ||
const { travelogues, status, fetchNextPage, isPaused, error } = useInfiniteSearchTravelogues( | ||
keyword, | ||
searchType, | ||
); | ||
const { lastElementRef } = useIntersectionObserver(fetchNextPage); | ||
|
||
if (travelogues.length === 0 && status === "success") { | ||
return ( | ||
<S.Layout> | ||
{keyword && ( | ||
<Text css={S.searchResultTextStyle} textType="title">{`"${keyword}" 검색 결과`}</Text> | ||
)} | ||
<S.SearchFallbackWrapper> | ||
<SearchFallback title="휑" text="검색 결과가 없어요." /> | ||
</S.SearchFallbackWrapper> | ||
</S.Layout> | ||
); | ||
} | ||
|
||
if (status === "error") { | ||
error && alert(error.message); | ||
|
||
return <SearchFallback title="휑" text="검색 결과가 없어요." />; | ||
} | ||
|
||
if (isPaused) alert(ERROR_MESSAGE_MAP.network); | ||
|
||
return ( | ||
<S.Layout> | ||
<S.MainPageTraveloguesList> | ||
{keyword && ( | ||
<Text css={S.searchResultTextStyle} textType="title">{`"${keyword}" 검색 결과`}</Text> | ||
)} | ||
|
||
{status === "pending" && ( | ||
<S.MainPageTraveloguesList> | ||
{Array.from({ length: SKELETON_COUNT }, (_, index) => ( | ||
<TravelogueCardSkeleton key={index} /> | ||
))} | ||
</S.MainPageTraveloguesList> | ||
)} | ||
{travelogues.map( | ||
({ id, title, thumbnail, authorProfileUrl, likeCount, tags, authorNickname }) => ( | ||
<TravelogueCard | ||
key={id} | ||
travelogueOverview={{ | ||
id, | ||
title, | ||
thumbnail, | ||
authorProfileUrl, | ||
likeCount, | ||
tags, | ||
authorNickname, | ||
}} | ||
/> | ||
), | ||
)} | ||
<div | ||
ref={lastElementRef} | ||
css={css` | ||
height: 1px; | ||
`} | ||
/> | ||
</S.MainPageTraveloguesList> | ||
</S.Layout> | ||
); | ||
}; | ||
|
||
export default TravelogueList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.