diff --git a/src/app/collection/page.tsx b/src/app/collection/page.tsx index ca36286d..ba68de40 100644 --- a/src/app/collection/page.tsx +++ b/src/app/collection/page.tsx @@ -69,11 +69,11 @@ export default function CollectionPage() {
{data && data.map((category) => ( -
+
{ - handleCategoryClick(category.nameValue); + handleCategoryClick(category.engName); }} > {`${category.korNameValue} -
{codeToFolderIcon(category.codeValue, language)}
+
{codeToFolderIcon(category.code, language)}
-

{language === 'ko' ? category.korNameValue : category.nameValue}

+

{language === 'ko' ? category.korName : category.engName}

))}
diff --git a/src/app/list/[listId]/_components/ListDetailInner/index.tsx b/src/app/list/[listId]/_components/ListDetailInner/index.tsx index 5e227037..12bc6c50 100644 --- a/src/app/list/[listId]/_components/ListDetailInner/index.tsx +++ b/src/app/list/[listId]/_components/ListDetailInner/index.tsx @@ -33,7 +33,7 @@ function ListDetailInner({ data, listId }: ListDetailInnerProps) { listId: listId, ownerId: data?.ownerId, items: listData, - category: data?.category, + category: data?.categoryKorName, title: data?.title, description: data?.description, collaborators: data?.collaborators, diff --git a/src/app/list/[listId]/_components/ListDetailOuter/ListInformation.css.ts b/src/app/list/[listId]/_components/ListDetailOuter/ListInformation.css.ts index 37993f87..2e073a1f 100644 --- a/src/app/list/[listId]/_components/ListDetailOuter/ListInformation.css.ts +++ b/src/app/list/[listId]/_components/ListDetailOuter/ListInformation.css.ts @@ -34,6 +34,7 @@ export const categoryWrapper = style({ export const labelWrapper = style({ marginRight: '8px', + cursor: 'pointer', }); export const listTitle = style([ diff --git a/src/app/list/[listId]/_components/ListDetailOuter/ListInformation.tsx b/src/app/list/[listId]/_components/ListDetailOuter/ListInformation.tsx index 227a01d7..ceb15c70 100644 --- a/src/app/list/[listId]/_components/ListDetailOuter/ListInformation.tsx +++ b/src/app/list/[listId]/_components/ListDetailOuter/ListInformation.tsx @@ -1,4 +1,5 @@ 'use client'; +import { MouseEvent } from 'react'; import Image from 'next/image'; import { useQuery } from '@tanstack/react-query'; import { useParams, useRouter } from 'next/navigation'; @@ -77,6 +78,18 @@ function ListInformation() { return null; } + const handleCategorySearch = (categoryEngName: string) => { + router.push(`/search?category=${categoryEngName}`); + }; + + const handleLabelSearch = (e: MouseEvent) => { + const labelElement = e.currentTarget.querySelector('div'); + const labelText = labelElement?.textContent; + if (labelText) { + router.push(`/search?keyword=${labelText}`); + } + }; + return ( <> {isOn && ( @@ -105,12 +118,12 @@ function ListInformation() { <>
-
- +
handleCategorySearch(list?.categoryEngName)}> +
{list?.labels.map((item: LabelType) => { return ( -
+
); diff --git a/src/app/list/[listId]/edit/page.tsx b/src/app/list/[listId]/edit/page.tsx index 5681994f..5eba0bd4 100644 --- a/src/app/list/[listId]/edit/page.tsx +++ b/src/app/list/[listId]/edit/page.tsx @@ -118,7 +118,7 @@ export default function EditPage() { useEffect(() => { if (listDetailData) { methods.reset({ - category: categories?.find((c) => c.korNameValue === listDetailData.category)?.nameValue || 'culture', + category: categories?.find((c) => c.korName === listDetailData.categoryKorName)?.engName || 'culture', labels: listDetailData.labels.map((obj) => obj.name), collaboratorIds: listDetailData.collaborators.filter((c) => c.id !== user.id).map((c) => c.id), title: listDetailData.title, diff --git a/src/app/list/create/_components/CreateList.tsx b/src/app/list/create/_components/CreateList.tsx index 8c0a03fd..14311fff 100644 --- a/src/app/list/create/_components/CreateList.tsx +++ b/src/app/list/create/_components/CreateList.tsx @@ -81,7 +81,7 @@ function CreateList({ onNextClick, type }: CreateListProps) { const handleQueryParams = () => { if (isTemplateCreation) { setValue('title', searchParams?.get('title')); - const c = categories?.find((c) => c.korNameValue === searchParams?.get('category'))?.nameValue; + const c = categories?.find((c) => c.korName === searchParams?.get('category'))?.engName; setValue('category', c); } }; @@ -143,9 +143,9 @@ function CreateList({ onNextClick, type }: CreateListProps) { {/* 카테고리 */}
category.codeValue !== '0') || []} + list={categories?.filter((category: CategoryType) => category.code !== '0') || []} onClick={(item: CategoryType) => { - setValue('category', item.nameValue); + setValue('category', item.engName); }} defaultValue={category} /> diff --git a/src/app/list/create/_components/list/ButtonSelector.tsx b/src/app/list/create/_components/list/ButtonSelector.tsx index 27e206ce..617fa7fb 100644 --- a/src/app/list/create/_components/list/ButtonSelector.tsx +++ b/src/app/list/create/_components/list/ButtonSelector.tsx @@ -28,14 +28,14 @@ function ButtonSelector({ list, onClick, defaultValue }: ButtonSelectorProps) {
{list.map((item) => ( ))}
diff --git a/src/app/search/_components/CategoryArea.tsx b/src/app/search/_components/CategoryArea.tsx index f1a6a9bf..ce49b658 100644 --- a/src/app/search/_components/CategoryArea.tsx +++ b/src/app/search/_components/CategoryArea.tsx @@ -32,18 +32,16 @@ function CategoryArea({ onClick }: { onClick: MouseEventHandler }) { ? Array.from({ length: 6 }).map((_, index) => ) : data && data.map((category) => ( -
+
{category.korNameValue} -
- {language === 'ko' ? category.korNameValue : category.nameValue} -
- {categoryValue === category.nameValue && ( +
{language === 'ko' ? category.korName : category.engName}
+ {categoryValue === category.engName && (
diff --git a/src/app/start-listy/_components/ChoiceCategory.tsx b/src/app/start-listy/_components/ChoiceCategory.tsx index 2c235d48..f443983c 100644 --- a/src/app/start-listy/_components/ChoiceCategory.tsx +++ b/src/app/start-listy/_components/ChoiceCategory.tsx @@ -11,7 +11,7 @@ import { startListyLocale } from '@/app/start-listy/locale'; import { useLanguage } from '@/store/useLanguage'; interface CategoryProps { - handleChangeCategory: (category: Omit) => void; + handleChangeCategory: (category: Omit) => void; } export default function ChoiceCategory({ handleChangeCategory }: CategoryProps) { @@ -23,7 +23,7 @@ export default function ChoiceCategory({ handleChangeCategory }: CategoryProps) queryFn: getCategories, }); - const categories = data ? data?.filter((category) => category.korNameValue !== '전체') : []; + const categories = data ? data?.filter((category) => category.korName !== '전체') : []; const onClickChangeCategory = (e: MouseEvent) => { if (e.target === e.currentTarget) { @@ -31,19 +31,19 @@ export default function ChoiceCategory({ handleChangeCategory }: CategoryProps) } const targetId = (e.target as HTMLButtonElement).id; - const category = data?.find((category) => category.nameValue === targetId); + const category = data?.find((category) => category.engName === targetId); if (category) { handleChangeCategory({ - nameValue: category.nameValue, - korNameValue: category.korNameValue, + engName: category.engName, + korName: category.korName, }); - setValue('category', category.nameValue); + setValue('category', category.engName); } else { console.log(startListyLocale[language].notFountCategory); handleChangeCategory({ - nameValue: '', - korNameValue: '', + engName: '', + korName: '', }); } }; @@ -54,16 +54,16 @@ export default function ChoiceCategory({ handleChangeCategory }: CategoryProps)
{categories.map((category) => ( ))}
diff --git a/src/app/start-listy/_components/CreateListStep.tsx b/src/app/start-listy/_components/CreateListStep.tsx index 8119ff77..08c6dd52 100644 --- a/src/app/start-listy/_components/CreateListStep.tsx +++ b/src/app/start-listy/_components/CreateListStep.tsx @@ -30,8 +30,8 @@ export default function CreateListStep({ nickname }: CreateListStepProps) { const router = useRouter(); const [stepIndex, setStepIndex] = useState(0); const [selectedCategory, setSelectedCategory] = useState({ - nameValue: '', - korNameValue: '', + engName: '', + korName: '', }); const [isLoading, setIsLoading] = useState(false); @@ -69,10 +69,10 @@ export default function CreateListStep({ nickname }: CreateListStepProps) { } }; - const handleChangeCategory = (category: Omit) => { + const handleChangeCategory = (category: Omit) => { setSelectedCategory({ - nameValue: category.nameValue, - korNameValue: category.korNameValue, + engName: category.engName, + korName: category.korName, }); }; @@ -112,7 +112,7 @@ export default function CreateListStep({ nickname }: CreateListStepProps) {
- +

step2

@@ -134,8 +134,8 @@ export default function CreateListStep({ nickname }: CreateListStepProps) { diff --git a/src/app/start-listy/_components/RegisterItems.tsx b/src/app/start-listy/_components/RegisterItems.tsx index 35510748..cd764680 100644 --- a/src/app/start-listy/_components/RegisterItems.tsx +++ b/src/app/start-listy/_components/RegisterItems.tsx @@ -10,7 +10,7 @@ import { ListCreateType } from '@/lib/types/listType'; import { useLanguage } from '@/store/useLanguage'; interface ItemsStepProps { - selectedCategory: Omit; + selectedCategory: Omit; } export default function RegisterItems({ selectedCategory }: ItemsStepProps) { @@ -29,8 +29,8 @@ export default function RegisterItems({ selectedCategory }: ItemsStepProps) { {language === 'ko' ? '아이템을 적어주세요.' : 'items to be included in the list'}
-

{getValues('title')}

diff --git a/src/app/start-listy/_components/RegisterListTitle.tsx b/src/app/start-listy/_components/RegisterListTitle.tsx index 9a57255c..28a38478 100644 --- a/src/app/start-listy/_components/RegisterListTitle.tsx +++ b/src/app/start-listy/_components/RegisterListTitle.tsx @@ -11,7 +11,7 @@ import { startListyLocale } from '@/app/start-listy/locale'; import { useLanguage } from '@/store/useLanguage'; interface ListTitleStepProps { - selectedCategory: Omit; + selectedCategory: Omit; } export default function RegisterListTitle({ selectedCategory }: ListTitleStepProps) { @@ -48,8 +48,8 @@ export default function RegisterListTitle({ selectedCategory }: ListTitleStepPro

{errors.title?.message}

-

{watchForm}

diff --git a/src/app/user/[userId]/_components/Categories.tsx b/src/app/user/[userId]/_components/Categories.tsx index aeb77fcb..94b4777f 100644 --- a/src/app/user/[userId]/_components/Categories.tsx +++ b/src/app/user/[userId]/_components/Categories.tsx @@ -34,11 +34,11 @@ export default function Categories({ handleFetchListsOnCategory, selectedCategor ) : ( data?.map((category) => ( )) )} diff --git a/src/lib/types/categoriesType.ts b/src/lib/types/categoriesType.ts index ac15d366..5bcfbc5d 100644 --- a/src/lib/types/categoriesType.ts +++ b/src/lib/types/categoriesType.ts @@ -1,6 +1,6 @@ export interface CategoryType { - codeValue: string; - nameValue: string; - korNameValue: string; + code: string; // 기존 : codeValue + engName: string; // 기존 : nameValue + korName: string; // 기존 : korNameValue categoryImageUrl?: string; } diff --git a/src/lib/types/listType.ts b/src/lib/types/listType.ts index 6414cbb6..d5f3f713 100644 --- a/src/lib/types/listType.ts +++ b/src/lib/types/listType.ts @@ -95,7 +95,8 @@ export interface LabelType { export interface ListDetailType { id?: number; - category: string; + categoryKorName: string; // 기존 : category + categoryEngName: string; // 추가됨 labels: LabelType[]; title: string; description: string;