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

FE-32 검색 페이지 무한 스크롤 오류 수정 #175

Merged
merged 38 commits into from
Aug 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
0317c14
merge main
imsoohyeok Jul 26, 2024
77fdc41
build 오류 해결
imsoohyeok Jul 26, 2024
e56c7f1
build 오류 해결 중
imsoohyeok Jul 26, 2024
d1bd166
Merge branch 'epic/FE-32--search-page' into merge/FE-32
imsoohyeok Jul 26, 2024
51273ae
Merge branch 'main' into merge/FE-32
imsoohyeok Jul 30, 2024
357ac7e
.http 파일 삭제
imsoohyeok Jul 30, 2024
1c5cc44
Merge branch 'merge/FE-32' of https://github.com/epigram5-9/epigram i…
imsoohyeok Jul 30, 2024
fd04f95
merge epic/FE-32--search-page
imsoohyeok Jul 30, 2024
9295f96
merge main
imsoohyeok Jul 30, 2024
8222d99
Merge branch 'epic/FE-32--search-page' into merge/FE-32
imsoohyeok Jul 30, 2024
399878b
FE-32 🔀검색 페이지 메인 머지 (#107)
imsoohyeok Jul 30, 2024
c762ee5
FE-27 :twisted_rightwards_arrows: 마이페이지 머지 요청 (#100)
JeonYumin94 Jul 30, 2024
08ab0ad
FE-51 🔨 공용 api 수정 및 최신화 (#119)
newjinlee Jul 30, 2024
15a500b
FE-20 🔀 랜딩페이지 main merge (#123)
newjinlee Jul 30, 2024
111eabf
FE-13 🔀 메인페이지 main merge (#125)
newjinlee Jul 30, 2024
52b7c9e
FE-54🔀 상세페이지 main merge (#120)
jisurk Jul 31, 2024
1a62014
FE-27 :twisted_rightwards_arrows: 마이페이지 내 에피그램 목록 main 머지 요청 (#128)
JeonYumin94 Jul 31, 2024
fc471cd
FE-54🔀상세페이지 url수정 (#132)
jisurk Jul 31, 2024
c74c7dd
FE-46 ✨공용 컴포넌트 헤더 뒤로가기 함수 추가 (#135) (#136)
imsoohyeok Jul 31, 2024
e15168f
merge main
imsoohyeok Jul 31, 2024
f16b7e8
FE-29 :twisted_rightwards_arrows: 로그인, 간편 로그인 수정 사항 반영 요청 (#140)
jangmoonwon Aug 1, 2024
edf1bda
Merge branch 'main' into refactor/FE-32
imsoohyeok Aug 1, 2024
0accbb8
FE-27 :twisted_rightwards_arrows: 마이페이지 main 머지 요청 (#147)
JeonYumin94 Aug 1, 2024
cd46341
FE-32 refactor: 저자 검색 오류 수정
imsoohyeok Aug 1, 2024
b293624
FE-32 refactor: 특정 검색어만 검색되는 오류 수정
imsoohyeok Aug 1, 2024
319569a
FE-20 🐛 소개 페이지 main merge (#151)
newjinlee Aug 2, 2024
77afe7a
FE-13 🐛 메인 페이지 테스트 기반 오류 수정 (#156)
newjinlee Aug 2, 2024
0b84743
FE-66 :twisted_rightwards_arrows: 회원가입 페이지 수정사항 반영 요청 (#162)
jangmoonwon Aug 2, 2024
b780b6c
Merge branch 'main' into refactor/FE-32
imsoohyeok Aug 2, 2024
36be319
FE-83 ✨ 피드 페이지 구현 (#164) (#165)
newjinlee Aug 3, 2024
281a04e
무한 스크롤 오류 해결
imsoohyeok Aug 3, 2024
46ed436
주석 제거
imsoohyeok Aug 3, 2024
5daa784
Merge branch 'main' into refactor/FE-32
imsoohyeok Aug 3, 2024
3399dfc
merge main
imsoohyeok Aug 3, 2024
8298a9c
Merge branch 'merge/FE-32' of https://github.com/epigram5-9/epigram i…
imsoohyeok Aug 3, 2024
f30243a
Merge branch 'epic/FE-32--search-page' into refactor/FE-32
imsoohyeok Aug 3, 2024
0347d27
Merge branch 'merge/FE-32' into refactor/FE-32
imsoohyeok Aug 3, 2024
860560f
문제가 되는 파일 삭제
imsoohyeok Aug 3, 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
7 changes: 0 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function Header({ isLogo, icon, insteadOfLogo, isButton, isProfileIcon, isShareI

return (
<nav className='bg-white h-13 px-6 py-4 md:px-28 md:py-5 lg:px-30 lg:py-6'>
<div className='container flex justify-between items-center'>
<div className='container max-w-screen-xl mx-auto flex justify-between items-center'>
<div className='flex items-center space-x-4'>
{icon === 'back' && (
<button className='w-5 h-5 lg:w-9 lg:h-9' type='button' onClick={handleBack} aria-label='뒤로가기 버튼'>
Expand Down
19 changes: 8 additions & 11 deletions src/components/search/SearchResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,16 @@ function SearchResults({ results, query, isLoading }: SearchResultsProps) {
}, [results, query]);

const filteredResults = useMemo(
() => sortedResults.filter((item) => item.content.includes(query) || item.author.includes(query) || item.tags.some((tag) => tag.name.includes(query))),
() =>
sortedResults.filter(
(item) =>
item.content.toLowerCase().includes(query.toLowerCase()) ||
item.author.toLowerCase().includes(query.toLowerCase()) ||
item.tags.some((tag) => tag.name.toLowerCase().includes(query.toLowerCase())),
),
[sortedResults, query],
);

if (isLoading) {
return (
<div className='flex flex-col py-4 px-6 lg:p-6 gap-2 lg:gap-[16px]'>
<div className='flex flex-col gap-1 md:gap-2 lg:gap-6'>
<span className='text-black-600 font-iropkeBatang iropke-lg lg:iropke-xl'>검색 결과를 불러오는 중 입니다...</span>
</div>
</div>
);
}

if (!results || filteredResults.length === 0) {
return (
<div className='flex flex-col py-4 px-6 lg:p-6 gap-2 lg:gap-[16px]'>
Expand Down Expand Up @@ -94,6 +90,7 @@ function SearchResults({ results, query, isLoading }: SearchResultsProps) {
</div>
</Link>
))}
{isLoading && <div className='flex justify-center py-4'>로딩 중...</div>}
</div>
);
}
Expand Down
27 changes: 19 additions & 8 deletions src/hooks/useGetEpigramsHooks.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
import { useQuery } from '@tanstack/react-query';
import getEpigrams from '@/apis/getEpigrams';
import { useInfiniteQuery, QueryFunctionContext, QueryKey } from '@tanstack/react-query';
import { GetEpigramsResponseType } from '@/schema/epigrams';
import getEpigrams from '@/apis/getEpigrams';

type EpigramsQueryKey = [string, string];

const fetchEpigrams = async ({ pageParam = 0, queryKey }: QueryFunctionContext<EpigramsQueryKey>): Promise<GetEpigramsResponseType> => {
const [, keyword] = queryKey;
const cursor = typeof pageParam === 'number' ? pageParam : undefined;
const response = await getEpigrams({ keyword, limit: 10, cursor });
return response;
};

const useEpigrams = (query: string, page: number, limit: number = 10) =>
useQuery<GetEpigramsResponseType, Error>({
queryKey: ['epigrams', query, page, limit],
queryFn: () => getEpigrams({ keyword: query, limit, cursor: page * limit }),
enabled: !!query,
staleTime: 5 * 60 * 1000, // 데이터 신선도 설정
const useEpigrams = (currentSearch: string) =>
useInfiniteQuery<GetEpigramsResponseType, Error>({
queryKey: ['epigrams', currentSearch] as unknown as QueryKey,
queryFn: fetchEpigrams as unknown as ({ pageParam, queryKey }: QueryFunctionContext<QueryKey>) => Promise<GetEpigramsResponseType>,
getNextPageParam: (lastPage) => lastPage.nextCursor,
initialPageParam: 0,
enabled: !!currentSearch,
staleTime: 5 * 60 * 1000,
});

export default useEpigrams;
40 changes: 0 additions & 40 deletions src/pageLayout/MypageLayout/EmotionMonthlyLogs.tsx

This file was deleted.

78 changes: 0 additions & 78 deletions src/pageLayout/MypageLayout/MyContent.tsx

This file was deleted.

42 changes: 0 additions & 42 deletions src/pageLayout/MypageLayout/MyPageLayout.tsx

This file was deleted.

Loading
Loading