Skip to content

Commit

Permalink
fix: 검색 관련 api 변화 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
yeolyi committed Mar 16, 2024
1 parent 3728a4b commit d06dcdc
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 13 deletions.
21 changes: 16 additions & 5 deletions app/[locale]/search/ResearchSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ import { searchResearch } from '@/apis/search';
import { ResearchType } from '@/types/search';

import { getPath } from '@/utils/page';
import { researchCenters, researchLabs, topConferenceList } from '@/utils/segmentNode';
import {
researchCenters,
researchGroups,
researchLabs,
topConferenceList,
} from '@/utils/segmentNode';

import BasicRow from './helper/BasicRow';
import Section from './helper/Section';
Expand Down Expand Up @@ -35,24 +40,30 @@ export default async function ResearchSection({ keyword }: { keyword: string })
const toNode = (postType: ResearchType) => {
switch (postType) {
case 'CONFERENCE':
return topConferenceList; // TODO: 맞는지 확인 필요
return topConferenceList;
case 'LAB':
return researchLabs;
case 'RESEARCH':
case 'RESEARCH_CENTER':
return researchCenters;
case 'RESEARCH_GROUP':
return researchGroups;
}
};

const labPath = getPath(researchLabs);
const centerPath = getPath(researchCenters);
const groupPath = getPath(researchGroups);
const conferencePath = getPath(topConferenceList);

const toURL = (postType: ResearchType, id: number, name: string) => {
switch (postType) {
case 'CONFERENCE':
return ''; // TODO
return conferencePath;
case 'LAB':
return `${labPath}/${id}`;
case 'RESEARCH':
case 'RESEARCH_CENTER':
return `${centerPath}?selected=${name}`;
case 'RESEARCH_GROUP':
return `${groupPath}?selected=${name}`;
}
};
14 changes: 8 additions & 6 deletions app/[locale]/search/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ export default async function SearchPage({
searchParams: { keyword: string };
}) {
return (
<div className="relative bg-neutral-900">
// TODO: page layout 사용한 방식으로 변경
// 현재는 SubNav의 차이 때문에 코드 복붙
<div className="flex grow flex-col bg-neutral-900">
<Header />
{/* TODO: 임시로 넣은 currentPage={main} 대책 세우기*/}
<PageTitle title={'통합 검색'} titleType="big" margin="mb-11" currentPage={main} />

<div className={'relative bg-white pb-[150px] pl-[100px] pr-[360px] pt-[44px]'}>
{/* TODO: 임시로 넣은 main 교체 */}
<PageTitle title={'통합 검색'} currentPage={main} titleType={'big'} margin={'mb-11'} />
<div className="relative grow bg-white p-[1.75rem_1.25rem_4rem_1.25rem] sm:p-[2.75rem_360px_150px_100px]">
<SearchBox tags={SEARCH_TAGS} key={keyword} />
<div className="flex w-[52.5rem] grow flex-col gap-20">
<div className="flex grow flex-col gap-20">
<Suspense>
<AboutSection keyword={keyword} />
<CommunitySection keyword={keyword} />
Expand All @@ -36,6 +37,7 @@ export default async function SearchPage({
<AcademicSection keyword={keyword} />
</Suspense>
</div>
{/* <SubNavbar currentTab={currentPage} /> */}
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion components/common/RangeBolded.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function RangeBolded({
boldEndIndex: number;
}) {
return (
<p className="line-clamp-1 text-md font-normal text-neutral-500">
<p className="truncate text-md font-normal text-neutral-500">
{partialDescription.slice(0, boldStartIndex)}
<span className="font-bold text-neutral-950">
{partialDescription.slice(boldStartIndex, boldEndIndex)}
Expand Down
2 changes: 1 addition & 1 deletion types/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export type MemberSearchResult = {

// 연구 탭

export type ResearchType = 'RESEARCH' | 'LAB' | 'CONFERENCE';
export type ResearchType = 'RESEARCH_GROUP' | 'RESEARCH_CENTER' | 'LAB' | 'CONFERENCE';

export type ResearchSearchResult = {
total: number;
Expand Down

0 comments on commit d06dcdc

Please sign in to comment.