diff --git a/.env b/.env index 3210e2c6..57cbb8ba 100644 --- a/.env +++ b/.env @@ -3,4 +3,4 @@ NEXT_PUBLIC_IDP_BASE_URL=https://idp.gistory.me/ NEXT_PUBLIC_IDP_CLIENT_ID=ziggle2023 NEXT_PUBLIC_IDP_REDIRECT_URI=http://localhost:3000/api/login NEXTAUTH_URL=http://localhost:3000 -NEXT_VAPOR_API_URL=https://api.stg.groups.gistory.me/ \ No newline at end of file +NEXT_PUBLIC_GROUPS_API_URL=https://stg.groups.gistory.me/ \ No newline at end of file diff --git a/src/api/group/search-groups-with-name.ts b/src/api/group/search-groups-with-name.ts new file mode 100644 index 00000000..b5b4750d --- /dev/null +++ b/src/api/group/search-groups-with-name.ts @@ -0,0 +1,16 @@ +import { Locale } from '@/app/i18next/settings'; + +import { ziggleApi } from '..'; + +export interface GroupInfo { + uuid: string; + name: string; + verified: boolean; + profileImageUrl: string | null; +} + +export const searchGroupWithName = async (groupName: string, lang: Locale) => { + return await ziggleApi + .get<{ list: GroupInfo[] }>(`/group/search?query=${encodeURIComponent(groupName)}&lang=${lang}`) + .then(({ data: { list } }) => list); +}; diff --git a/src/app/[lng]/(with-page-layout)/(without-sidebar-layout)/search/SearchResults.tsx b/src/app/[lng]/(with-page-layout)/(without-sidebar-layout)/search/SearchResults.tsx index a1377580..1b315a87 100644 --- a/src/app/[lng]/(with-page-layout)/(without-sidebar-layout)/search/SearchResults.tsx +++ b/src/app/[lng]/(with-page-layout)/(without-sidebar-layout)/search/SearchResults.tsx @@ -1,12 +1,19 @@ +import Image from 'next/image'; +import Link from 'next/link'; import { ComponentProps, Suspense } from 'react'; +import { searchGroupWithName } from '@/api/group/search-groups-with-name'; import LogEvents from '@/api/log/log-events'; import { getAllNotices } from '@/api/notice/notice-server'; import Analytics from '@/app/components/shared/Analytics'; import LoadingCatAnimation from '@/app/components/shared/LoadingCatAnimation'; import Pagination from '@/app/components/shared/Pagination'; +import HighlightedText from '@/app/components/shared/Zabo/HighlightedText'; import ResultZabo from '@/app/components/shared/Zabo/ResultZabo/ResultZabo'; import { createTranslation, PropsWithLng } from '@/app/i18next'; +import RightArrowIcon from '@/assets/icons/arrow-right.svg'; +import VerifiedBadge from '@/assets/icons/badge-check.svg'; +import DefaultProfile from '@/assets/icons/default-profile.svg'; import SearchNoResult from '@/assets/icons/search-no-result.svg'; const Results = async ({ @@ -17,33 +24,77 @@ const Results = async ({ }: ComponentProps) => { const pageAsNumber = Number.parseInt(page as string); const { t } = await createTranslation(lng); - const data = await getAllNotices({ + const notices = await getAllNotices({ ...props, lang: lng, offset: pageAsNumber * props.limit, }).catch(() => ({ list: [], total: 0 })); + const groups = props.search + ? await searchGroupWithName(props.search, lng).catch(() => []) + : []; + return ( <> - {data?.list.length !== 0 && ( -
-
- - {data.list.map((notice) => ( - +
+ {groups.length !== 0 && + groups.map(({ uuid, name, verified, profileImageUrl }) => ( + - - +
+
+
+ {profileImageUrl ? ( + {`group + ) : ( + + )} +
+
+
+ {t('zabo.group.group')} +
+
+ + {name} + + {verified && ( + <> + +
+ {t('zabo.group.verifiedDescription')} +
+ + )} +
+
+ +
+
+ ))} -
- )} - {props.search && data.list.length === 0 && ( + {notices.list.map((notice) => ( + + + + ))} +
+ {props.search && notices.list.length === 0 && (
diff --git a/src/app/i18next/locales/en/translation.json b/src/app/i18next/locales/en/translation.json index 5245367c..89f4db17 100644 --- a/src/app/i18next/locales/en/translation.json +++ b/src/app/i18next/locales/en/translation.json @@ -156,6 +156,10 @@ "alreadyWroteEnglishNotice": "You've already written an English notice!", "writeAdditionalNotice": "Write Additional Notice", "writeAdditionalNoticeDescription": "Create an additional notice when you need to make a correction to an existing notice, or when you want to change a deadline." + }, + "group": { + "group": "Group", + "verifiedDescription": "Official account verified by ziggle team" } }, "emptyNotices": "No content. =ㅅ=", diff --git a/src/app/i18next/locales/ko/translation.json b/src/app/i18next/locales/ko/translation.json index a4ce40d9..10f81765 100644 --- a/src/app/i18next/locales/ko/translation.json +++ b/src/app/i18next/locales/ko/translation.json @@ -148,6 +148,11 @@ "alreadyWroteEnglishNotice": "영어 공지를 작성하셨습니다!", "writeAdditionalNotice": "추가 공지 작성하기", "writeAdditionalNoticeDescription": "기존 공지사항에서 정정해야 할 부분이 있거나, 마감 시간을 변경하고 싶을 때 추가 공지를 작성해보세요." + }, + + "group": { + "group": "그룹", + "verifiedDescription": "지글팀이 확인한 공식 계정" } }, "emptyNotices": "글이 없습니다. =ㅅ=", diff --git a/src/assets/icons/badge-check.svg b/src/assets/icons/badge-check.svg new file mode 100644 index 00000000..9abf5929 --- /dev/null +++ b/src/assets/icons/badge-check.svg @@ -0,0 +1,3 @@ + + +