From 3c7a794c5a93cb2207503c09c449b1e09db12011 Mon Sep 17 00:00:00 2001 From: hyewon <130418741+ehye1@users.noreply.github.com> Date: Sat, 26 Sep 2026 16:55:12 +0900 Subject: [PATCH 1/2] =?UTF-8?q?refactor(web):=20=ED=83=9C=EA=B7=B8=20?= =?UTF-8?q?=EB=9D=BC=EB=B2=A8=20=EB=B2=88=EC=97=AD=20=EA=B3=B5=EC=9A=A9=20?= =?UTF-8?q?=ED=9B=85=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20=ED=99=88=20?= =?UTF-8?q?=EC=B9=B4=EB=93=9C=EC=97=90=20=EC=A0=81=EC=9A=A9=20(#293)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 기본 태그는 tagId 기준으로 번역하고 사용자 태그는 서버 이름을 사용하는 useTagLabel 훅을 추가했습니다 - 홈 카드에서 직접 처리하던 태그 번역 로직을 공용 훅으로 교체했습니다 Co-Authored-By: Claude Opus 5.5 --- .../home/_containers/HomeTodoContainer.tsx | 11 +++------ apps/timo-web/hooks/todo/use-tag-label.ts | 24 +++++++++++++++++++ 2 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 apps/timo-web/hooks/todo/use-tag-label.ts diff --git a/apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/home/_containers/HomeTodoContainer.tsx b/apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/home/_containers/HomeTodoContainer.tsx index efa73bef..b3859ad2 100644 --- a/apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/home/_containers/HomeTodoContainer.tsx +++ b/apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/home/_containers/HomeTodoContainer.tsx @@ -19,12 +19,12 @@ import { HomeCalendarEventCard } from "@/components/calendar/HomeCalendarEventCa import { AnimatedToast } from "@/components/toast/AnimatedToast"; import { StopCompleteModalContainer } from "@/containers/timer/StopCompleteModalContainer"; import { DetailTodoModalContainer } from "@/containers/todo-modal/detail/DetailTodoModalContainer"; +import { useTagLabel } from "@/hooks/todo/use-tag-label"; import { DndSortableListProvider } from "@/providers/dnd/DndSortableListProvider"; import { useMyProfileQuery } from "@/queries/auth/use-my-profile-query"; import { useCalendarEventsQuery } from "@/queries/calendar/use-calendar-events-query"; import { formatDateKey } from "@/utils/date/date"; import { convertDurationToMinutes } from "@/utils/duration/convert-duration-to-minutes"; -import { getDefaultTagLabelKey } from "@/utils/todo/tag-label"; interface PendingCompleteTodo { token: number; @@ -33,7 +33,7 @@ interface PendingCompleteTodo { } export const HomeTodoContainer = () => { - const tCommon = useTranslations("Common"); + const getTagLabel = useTagLabel(); const tToast = useTranslations("Toast"); const { isWeekView, referenceDate } = useHomeViewMode(); @@ -167,13 +167,8 @@ export const HomeTodoContainer = () => { const isPlayHighlighted = !activeTimer || Boolean(isActiveTodo); - const todoTagLabelKey = todo.tag - ? getDefaultTagLabelKey(todo.tag.tagId) - : undefined; const todoTagName = todo.tag - ? todoTagLabelKey - ? tCommon(`tag.${todoTagLabelKey}`) - : todo.tag.name + ? getTagLabel(todo.tag) : undefined; return ( diff --git a/apps/timo-web/hooks/todo/use-tag-label.ts b/apps/timo-web/hooks/todo/use-tag-label.ts new file mode 100644 index 00000000..c5a0281f --- /dev/null +++ b/apps/timo-web/hooks/todo/use-tag-label.ts @@ -0,0 +1,24 @@ +"use client"; + +import { useTranslations } from "next-intl"; + +import { getDefaultTagLabelKey } from "@/utils/todo/tag-label"; + +interface TagLabelSource { + tagId: number; + name: string; +} + +/** + * 기본 태그는 tagId 기준으로 next-intl 번역을 사용하고, + * 사용자 태그는 서버 이름을 그대로 사용한다. + */ +export const useTagLabel = () => { + const tCommon = useTranslations("Common"); + + return (tag: TagLabelSource) => { + const labelKey = getDefaultTagLabelKey(tag.tagId); + + return labelKey ? tCommon(`tag.${labelKey}`) : tag.name; + }; +}; From edd67a3b18586ebf52cd532ce44628c1dcfa2718 Mon Sep 17 00:00:00 2001 From: hyewon <130418741+ehye1@users.noreply.github.com> Date: Sat, 26 Sep 2026 16:55:14 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix(web):=20=EC=98=A4=EB=8A=98=20=EC=B9=B4?= =?UTF-8?q?=EB=93=9C=EC=99=80=20=ED=86=B5=EA=B3=84=EC=9D=98=20=EA=B8=B0?= =?UTF-8?q?=EB=B3=B8=20=ED=83=9C=EA=B7=B8=20=EC=9D=B4=EB=A6=84=20=EB=8B=A4?= =?UTF-8?q?=EA=B5=AD=EC=96=B4=20=EC=B2=98=EB=A6=AC=20=EB=88=84=EB=9D=BD=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#293)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 오늘 카드와 통계 일별 상세에서 서버 태그 이름 대신 번역된 태그 이름을 표시하도록 수정했습니다 - 오늘 카드의 태그 기본 문구를 하드코딩된 한국어 대신 번역 키로 표시하도록 수정했습니다 Co-Authored-By: Claude Opus 5.5 --- .../(with-time-sidebar)/today/_components/TodayTodoCard.tsx | 4 +++- .../today/_containers/TodayTodoListContainer.tsx | 4 +++- .../(main)/statistics/_containers/StatisticsContainer.tsx | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/today/_components/TodayTodoCard.tsx b/apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/today/_components/TodayTodoCard.tsx index 3b486a6a..f9037377 100644 --- a/apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/today/_components/TodayTodoCard.tsx +++ b/apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/today/_components/TodayTodoCard.tsx @@ -10,6 +10,7 @@ import { type PriorityLevel, } from "@repo/timo-design-system/ui"; import { cn } from "@repo/timo-design-system/utils"; +import { useTranslations } from "next-intl"; import type { KeyboardEvent, ReactNode } from "react"; @@ -78,6 +79,7 @@ export const TodayTodoCard = ({ onMouseEnter, onMouseLeave, }: TodayTodoCardProps) => { + const t = useTranslations("Home.createModal"); const style = CARD_STYLE[isDimmed ? "done" : "active"]; const handleCardKeyDown = (e: KeyboardEvent) => { @@ -180,7 +182,7 @@ export const TodayTodoCard = ({ timeLabel={toolbar.time} timeOptions={[]} priority={toolbar.priority} - tagLabel={toolbar.tag ?? "태그"} + tagLabel={toolbar.tag ?? t("tagLabel")} tags={[]} selectedTag={toolbar.tag} hasSubTask={toolbar.hasSubtask} diff --git a/apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/today/_containers/TodayTodoListContainer.tsx b/apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/today/_containers/TodayTodoListContainer.tsx index c878be44..e41198a1 100644 --- a/apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/today/_containers/TodayTodoListContainer.tsx +++ b/apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/today/_containers/TodayTodoListContainer.tsx @@ -14,6 +14,7 @@ import { TodayCalendarEventCard } from "@/components/calendar/TodayCalendarEvent import { AnimatedToast } from "@/components/toast/AnimatedToast"; import { StopCompleteModalContainer } from "@/containers/timer/StopCompleteModalContainer"; import { DetailTodoModalContainer } from "@/containers/todo-modal/detail/DetailTodoModalContainer"; +import { useTagLabel } from "@/hooks/todo/use-tag-label"; import { useMyProfileQuery } from "@/queries/auth/use-my-profile-query"; import { useCalendarEventsQuery } from "@/queries/calendar/use-calendar-events-query"; import { formatShortDateLabel, parseDateKey } from "@/utils/date/date"; @@ -33,6 +34,7 @@ const renderTodoIcon = (icon: string | undefined) => { export const TodayTodoListContainer = () => { const tToast = useTranslations("Toast"); + const getTagLabel = useTagLabel(); const { data } = useTodayQuery(); const { data: profile } = useMyProfileQuery(); const { data: calendarEventsData } = useCalendarEventsQuery({ @@ -140,7 +142,7 @@ export const TodayTodoListContainer = () => { dateValue: parseDateKey(todo.date) ?? new Date(), time: convertDurationToTimeText(durationSeconds), priority: todo.priority, - tag: todo.tag?.name, + tag: todo.tag ? getTagLabel(todo.tag) : undefined, hasSubtask: todo.hasSubtask, hasRepeat: todo.isRepeated, }} diff --git a/apps/timo-web/app/[locale]/(main)/statistics/_containers/StatisticsContainer.tsx b/apps/timo-web/app/[locale]/(main)/statistics/_containers/StatisticsContainer.tsx index 361ba886..3f93fee6 100644 --- a/apps/timo-web/app/[locale]/(main)/statistics/_containers/StatisticsContainer.tsx +++ b/apps/timo-web/app/[locale]/(main)/statistics/_containers/StatisticsContainer.tsx @@ -14,10 +14,12 @@ import { useStatisticsSummaryQuery, } from "@/app/[locale]/(main)/statistics/_queries/use-statistics-query"; import { formatStatisticsSidePanelDate } from "@/app/[locale]/(main)/statistics/_utils/format-statistics-date"; +import { useTagLabel } from "@/hooks/todo/use-tag-label"; import { formatDateKey } from "@/utils/date/date"; export const StatisticsContainer = () => { const locale = useLocale(); + const getTagLabel = useTagLabel(); const [currentMonth, setCurrentMonth] = useState(() => new Date()); const [selectedDate, setSelectedDate] = useState(() => new Date()); const [sidePanelVariant, setSidePanelVariant] = @@ -47,7 +49,7 @@ export const StatisticsContainer = () => { title: todo.title, actualTimeMinutes: todo.actualTimeMinutes, estimatedTimeMinutes: todo.estimatedTimeMinutes ?? 0, - tagName: todo.tag?.name ?? "", + tagName: todo.tag ? getTagLabel(todo.tag) : "", })) ?? [], };