From d733523ab2449ec0385922304c92d9c210239dfd Mon Sep 17 00:00:00 2001 From: ParkJumyung Date: Wed, 13 Nov 2024 20:09:03 +0900 Subject: [PATCH 1/9] =?UTF-8?q?=E2=9C=A8=20add=20search-groups-with-name?= =?UTF-8?q?=20api=20connection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/group/search-groups-with-name.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/api/group/search-groups-with-name.ts 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..ac32525c --- /dev/null +++ b/src/api/group/search-groups-with-name.ts @@ -0,0 +1,14 @@ +import { ziggleApi } from '..'; + +export interface GroupInfo { + uuid: string; + name: string; + verified: boolean; + profileImageUrl: object; +} + +export const serachGroupsWithName = async (groupName: string) => { + return await ziggleApi + .get(`/groups/search?name=${groupName}`) + .then(({ data }) => data); +}; From 796408e9f3d5b7b7e8942f123d7f271696cdb7e7 Mon Sep 17 00:00:00 2001 From: ParkJumyung Date: Wed, 13 Nov 2024 20:23:07 +0900 Subject: [PATCH 2/9] =?UTF-8?q?=E2=9C=A8=20add=20language=20to=20serach-gr?= =?UTF-8?q?oups-with-name=20api=20connection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/group/search-groups-with-name.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/api/group/search-groups-with-name.ts b/src/api/group/search-groups-with-name.ts index ac32525c..2b199f00 100644 --- a/src/api/group/search-groups-with-name.ts +++ b/src/api/group/search-groups-with-name.ts @@ -1,3 +1,5 @@ +import { Locale } from '@/app/i18next/settings'; + import { ziggleApi } from '..'; export interface GroupInfo { @@ -7,8 +9,8 @@ export interface GroupInfo { profileImageUrl: object; } -export const serachGroupsWithName = async (groupName: string) => { +export const serachGroupsWithName = async (groupName: string, lang: Locale) => { return await ziggleApi - .get(`/groups/search?name=${groupName}`) + .get(`/groups/search?name=${groupName}&lang=${lang}`) .then(({ data }) => data); }; From a1d5bfb6e29881fe892cd1d0d6b6d1d1f67d7ed3 Mon Sep 17 00:00:00 2001 From: ParkJumyung Date: Wed, 13 Nov 2024 21:37:13 +0900 Subject: [PATCH 3/9] =?UTF-8?q?=E2=9C=A8=20implement=20group=20search=20re?= =?UTF-8?q?sult=20component?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 2 +- .../search/SearchResults.tsx | 90 +++++++++++++++---- src/assets/icons/badge-check.svg | 3 + 3 files changed, 75 insertions(+), 20 deletions(-) create mode 100644 src/assets/icons/badge-check.svg 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/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 541d0d4a..0b6feaa2 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,20 @@ +import Image from 'next/image'; +import Link from 'next/link'; import { ComponentProps, Suspense } from 'react'; +import { GroupInfo } from '@/api/group/group'; +import { serachGroupsWithName } from '@/api/group/search-groups-with-name'; import { getAllNotices } from '@/api/notice/notice-server'; +import { createTranslation, PropsWithLng } from '@/app/i18next'; import Analytics from '@/app/components/shared/Analytics'; +import DefaultProfile from '@/assets/icons/default-profile.svg'; +import HighlightedText from '@/app/components/shared/Zabo/HighlightedText'; import LoadingCatAnimation from '@/app/components/shared/LoadingCatAnimation'; import Pagination from '@/app/components/shared/Pagination'; import ResultZabo from '@/app/components/shared/Zabo/ResultZabo/ResultZabo'; -import { createTranslation, PropsWithLng } from '@/app/i18next'; +import RightArrowIcon from '@/assets/icons/arrow-right.svg'; import SearchNoResult from '@/assets/icons/search-no-result.svg'; +import VerifiedBadge from '@/assets/icons/badge-check.svg'; const Results = async ({ lng, @@ -16,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 serachGroupsWithName(props.search, lng).catch(() => []) + : []; + return ( <> - {data?.list.length !== 0 && ( -
-
- - {data.list.map((notice) => ( - +
+ {groups.length !== 0 && + groups.map(({ uuid, name, verified, profileImageUrl }) => ( + - - +
+
+
+ {profileImageUrl ? ( + {`group + ) : ( + + )} +
+
+
+ Group +
+
+ + {name} + + {verified && ( + <> + +
+ Official account verifed by ziggle team +
+ + )} +
+
+ +
+
+ ))} -
- )} - {props.search && data.list.length === 0 && ( + {notices.list.map((notice) => ( + + + + ))} +
+ {props.search && notices.list.length === 0 && (
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 @@ + + + From 2953ff12500ef58515901a36d54482d1e4456cbc Mon Sep 17 00:00:00 2001 From: ParkJumyung Date: Wed, 13 Nov 2024 21:43:28 +0900 Subject: [PATCH 4/9] =?UTF-8?q?=F0=9F=8C=90=20internationalize?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/group/search-groups-with-name.ts | 11 ++++++++++- .../search/SearchResults.tsx | 13 ++++++------- src/app/i18next/locales/en/translation.json | 4 ++++ src/app/i18next/locales/ko/translation.json | 5 +++++ 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/api/group/search-groups-with-name.ts b/src/api/group/search-groups-with-name.ts index 2b199f00..911a1491 100644 --- a/src/api/group/search-groups-with-name.ts +++ b/src/api/group/search-groups-with-name.ts @@ -6,10 +6,19 @@ export interface GroupInfo { uuid: string; name: string; verified: boolean; - profileImageUrl: object; + profileImageUrl: string | null; } export const serachGroupsWithName = async (groupName: string, lang: Locale) => { + return [ + { + uuid: '1cff6b40-5db2-45de-bb59-0825267052b3', + name: 'realziggle', + verified: true, + profileImageUrl: null, + }, + ]; + return await ziggleApi .get(`/groups/search?name=${groupName}&lang=${lang}`) .then(({ data }) => data); 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 0b6feaa2..258e4ada 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 @@ -2,19 +2,18 @@ import Image from 'next/image'; import Link from 'next/link'; import { ComponentProps, Suspense } from 'react'; -import { GroupInfo } from '@/api/group/group'; import { serachGroupsWithName } from '@/api/group/search-groups-with-name'; import { getAllNotices } from '@/api/notice/notice-server'; -import { createTranslation, PropsWithLng } from '@/app/i18next'; import Analytics from '@/app/components/shared/Analytics'; -import DefaultProfile from '@/assets/icons/default-profile.svg'; -import HighlightedText from '@/app/components/shared/Zabo/HighlightedText'; 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 SearchNoResult from '@/assets/icons/search-no-result.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 ({ lng, @@ -60,7 +59,7 @@ const Results = async ({
- Group + {t('zabo.group.group')}
@@ -70,7 +69,7 @@ const Results = async ({ <>
- Official account verifed by ziggle team + {t('zabo.group.verifiedDescription')}
)} diff --git a/src/app/i18next/locales/en/translation.json b/src/app/i18next/locales/en/translation.json index 4222e3a2..16630238 100644 --- a/src/app/i18next/locales/en/translation.json +++ b/src/app/i18next/locales/en/translation.json @@ -143,6 +143,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 eddc5206..a4520f26 100644 --- a/src/app/i18next/locales/ko/translation.json +++ b/src/app/i18next/locales/ko/translation.json @@ -134,6 +134,11 @@ "alreadyWroteEnglishNotice": "영어 공지를 작성하셨습니다!", "writeAdditionalNotice": "추가 공지 작성하기", "writeAdditionalNoticeDescription": "기존 공지사항에서 정정해야 할 부분이 있거나, 마감 시간을 변경하고 싶을 때 추가 공지를 작성해보세요." + }, + + "group": { + "group": "그룹", + "verifiedDescription": "지글팀이 확인한 공식 계정" } }, "emptyNotices": "글이 없습니다. =ㅅ=", From cc7fe890dc989620005d43c9d502c7f2e88097a3 Mon Sep 17 00:00:00 2001 From: ParkJumyung Date: Wed, 13 Nov 2024 22:05:30 +0900 Subject: [PATCH 5/9] =?UTF-8?q?=F0=9F=93=B1=20work=20on=20mobile=20respons?= =?UTF-8?q?ive=20design?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../(without-sidebar-layout)/search/SearchResults.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 258e4ada..ed7a705c 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 @@ -54,28 +54,28 @@ const Results = async ({ className="aspect-square md:h-24 md:w-24" /> ) : ( - + )}
{t('zabo.group.group')}
-
+
{name} {verified && ( <> - -
+ +
{t('zabo.group.verifiedDescription')}
)}
- +
From c593325437dab2f604e24b31db5fa6394058923e Mon Sep 17 00:00:00 2001 From: ParkJumyung Date: Wed, 13 Nov 2024 23:03:57 +0900 Subject: [PATCH 6/9] =?UTF-8?q?=E2=9A=B0=EF=B8=8F=20remove=20mock=20respon?= =?UTF-8?q?se?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/group/search-groups-with-name.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/api/group/search-groups-with-name.ts b/src/api/group/search-groups-with-name.ts index 911a1491..090dbc23 100644 --- a/src/api/group/search-groups-with-name.ts +++ b/src/api/group/search-groups-with-name.ts @@ -10,15 +10,6 @@ export interface GroupInfo { } export const serachGroupsWithName = async (groupName: string, lang: Locale) => { - return [ - { - uuid: '1cff6b40-5db2-45de-bb59-0825267052b3', - name: 'realziggle', - verified: true, - profileImageUrl: null, - }, - ]; - return await ziggleApi .get(`/groups/search?name=${groupName}&lang=${lang}`) .then(({ data }) => data); From c3f020e11ecf3f45c4122dcf4dc8e8e9ac4b2863 Mon Sep 17 00:00:00 2001 From: Hongje Choi Date: Mon, 20 Jan 2025 13:36:27 +0900 Subject: [PATCH 7/9] fix: group search api --- src/api/group/search-groups-with-name.ts | 6 +++--- .../(without-sidebar-layout)/search/SearchResults.tsx | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/api/group/search-groups-with-name.ts b/src/api/group/search-groups-with-name.ts index 090dbc23..2fa9ef78 100644 --- a/src/api/group/search-groups-with-name.ts +++ b/src/api/group/search-groups-with-name.ts @@ -9,8 +9,8 @@ export interface GroupInfo { profileImageUrl: string | null; } -export const serachGroupsWithName = async (groupName: string, lang: Locale) => { +export const searchGroupWithName = async (groupName: string, lang: Locale) => { return await ziggleApi - .get(`/groups/search?name=${groupName}&lang=${lang}`) - .then(({ data }) => data); + .get<{ list: GroupInfo[] }>(`/group/search?query=${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 ed7a705c..81cc1fb2 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 @@ -2,7 +2,7 @@ import Image from 'next/image'; import Link from 'next/link'; import { ComponentProps, Suspense } from 'react'; -import { serachGroupsWithName } from '@/api/group/search-groups-with-name'; +import { searchGroupWithName } from '@/api/group/search-groups-with-name'; import { getAllNotices } from '@/api/notice/notice-server'; import Analytics from '@/app/components/shared/Analytics'; import LoadingCatAnimation from '@/app/components/shared/LoadingCatAnimation'; @@ -30,7 +30,7 @@ const Results = async ({ }).catch(() => ({ list: [], total: 0 })); const groups = props.search - ? await serachGroupsWithName(props.search, lng).catch(() => []) + ? await searchGroupWithName(props.search, lng).catch(() => []) : []; return ( From ca3441ca2c27877b678229a412240d9d45f63842 Mon Sep 17 00:00:00 2001 From: Hongje Choi Date: Mon, 20 Jan 2025 14:03:24 +0900 Subject: [PATCH 8/9] Update src/api/group/search-groups-with-name.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- src/api/group/search-groups-with-name.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/group/search-groups-with-name.ts b/src/api/group/search-groups-with-name.ts index 2fa9ef78..b5b4750d 100644 --- a/src/api/group/search-groups-with-name.ts +++ b/src/api/group/search-groups-with-name.ts @@ -11,6 +11,6 @@ export interface GroupInfo { export const searchGroupWithName = async (groupName: string, lang: Locale) => { return await ziggleApi - .get<{ list: GroupInfo[] }>(`/group/search?query=${groupName}&lang=${lang}`) + .get<{ list: GroupInfo[] }>(`/group/search?query=${encodeURIComponent(groupName)}&lang=${lang}`) .then(({ data: { list } }) => list); }; From d40bbc2346ba8c5bcaa72c8c7631d01ed2bfacd1 Mon Sep 17 00:00:00 2001 From: Jumyung Park Date: Sun, 19 Jan 2025 23:26:59 -0800 Subject: [PATCH 9/9] =?UTF-8?q?=F0=9F=92=84=20fix=20darkmode=20text=20colo?= =?UTF-8?q?r=20to=20be=20visible?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../(without-sidebar-layout)/search/SearchResults.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 c223d55c..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 @@ -59,7 +59,7 @@ const Results = async ({ )}
-
+
{t('zabo.group.group')}