-
Notifications
You must be signed in to change notification settings - Fork 5
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
[Feature] - 데모데이 피드백 반영(리버) #444
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
2c7830b
feat(PlaceDetailCard): 여행기 사진 없을 경우 noImage이 아닌 아무것도 안나오도록 수정
0jenn0 b74deda
test(PlaceDetailCard): 이미지 없는 경우 테스트의 args 수정
0jenn0 7139021
feat(getDaysAndNights): 여행일자 텍스트 생성 util 함수 구현
0jenn0 45fbdb4
refactor(TravelogueDetailPage,TravelPlanDetailPage): 여행 일자 계산 util 함수 사용
0jenn0 767d056
feat(useInitialTripTitle): 여행기,여행계획 제목 초기값 생성 커스텀 훅 구현
0jenn0 d6eaf39
feat(TravelogueRegisterPage,useTravelPlanForm): 여행기,여행계획 변환시 제목 defau…
0jenn0 39d8f45
feat(usePreviousPage): 뒤로가기를 관리하는 훅 구현
0jenn0 cdda624
chore(useInitialTripTitle): Trip을 Travel로 수정
0jenn0 62d5aa7
feat(TravelogueRegisterPage): 제목 input에 placeholder 추가
0jenn0 62be1b9
fix(useInitialTravelTitle): 전환시에만 default title을 반환하도록 수정
0jenn0 a73e181
fix(interceptor): 리다이렉트 중이 아닐 때 alert,리다리렉트하도록 수정
0jenn0 58ac69d
feat(queryKey): search 쿼리키에 searchType 추가
0jenn0 6fafcd6
feat(useInfiniteSearchTravelogue): 여행기 검색 param에 searchType 추가
0jenn0 49e292d
style(Tab): 텍스트 세로 가운데 정렬 및 theme 사용 리팩토링
0jenn0 0010fd3
refactor(TravelogueList): 검색 결과 부분을 컴포넌트로 분리
0jenn0 c666cab
feat(SearchPage): 검색 타입 Tab 추가
0jenn0 eb6278c
feat(getInitialTravelTitle): 제목 초기값에서 사용자 닉네임 삭제
0jenn0 ef79495
refactor(usePreviousPage): type에서 interface로 수정
0jenn0 55dbc7f
refactor(usePreviousPage): 필요없는 state 삭제 및 그 전 페이지만 저장하도록 수정
0jenn0 59c9621
Merge branch 'develop/fe' into feature/fe/#422
0jenn0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ import { ROUTE_PATHS_MAP } from "@constants/route"; | |
|
||
import { extractLastPath } from "@utils/extractId"; | ||
import getDateRange from "@utils/getDateRange"; | ||
import getDaysAndNights from "@utils/getDaysAndNights"; | ||
import { isUUID } from "@utils/uuid"; | ||
|
||
import theme from "@styles/theme"; | ||
|
@@ -35,10 +36,7 @@ const TravelPlanDetailPage = () => { | |
|
||
const navigate = useNavigate(); | ||
|
||
const daysAndNights = | ||
data?.days.length && data?.days.length > 1 | ||
? `${data?.days.length - 1}박 ${data?.days.length}일` | ||
: "당일치기"; | ||
const daysAndNights = getDaysAndNights(data?.days); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. util로 분리한 거 좋네요 |
||
|
||
const { mutate: mutateDeleteTravelPlan, isPending: isDeletingPending } = useDeleteTravelPlan(); | ||
|
||
|
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 |
---|---|---|
|
@@ -31,6 +31,7 @@ import { ERROR_MESSAGE_MAP } from "@constants/errorMessage"; | |
import { ROUTE_PATHS_MAP } from "@constants/route"; | ||
|
||
import { extractID } from "@utils/extractId"; | ||
import getDaysAndNights from "@utils/getDaysAndNights"; | ||
|
||
import theme from "@styles/theme"; | ||
import { SEMANTIC_COLORS } from "@styles/tokens"; | ||
|
@@ -49,10 +50,7 @@ const TravelogueDetailPage = () => { | |
|
||
const navigate = useNavigate(); | ||
|
||
const daysAndNights = | ||
data?.days.length && data?.days.length > 1 | ||
? `${data?.days.length - 1}박 ${data?.days.length}일` | ||
: "당일치기"; | ||
const daysAndNights = getDaysAndNights(data?.days); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 반복되는 로직 분리해주셔서 감사합니다 :) |
||
|
||
const { onTransformTravelDetail } = useTravelTransformDetailContext(); | ||
const { | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이전 페이지가 마이페이지고 현재 페이지가 로그인 페이지라면 goBack을 통해 뒤로가기 버튼을 눌러도 마이 페이지로 가는 것이 아닌 루트 페이지로 이동하는 방식이군여 좋습니다 ! !