From b88687699b7352fdbe89fc546439b85769fa7676 Mon Sep 17 00:00:00 2001 From: yumin-kim4757 Date: Thu, 16 Jul 2026 15:22:08 +0900 Subject: [PATCH] =?UTF-8?q?fix(web):=20=ED=83=9C=EA=B7=B8=20=EA=B8=B0?= =?UTF-8?q?=EB=B3=B8=EA=B0=92=20=ED=8C=90=EB=B3=84=20=EA=B8=B0=EC=A4=80=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#252)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../settings/_hooks/account/use-settings-profile.ts | 9 ++++----- apps/timo-web/hooks/todo-modal/common/use-tag-field.tsx | 4 ++-- apps/timo-web/schemas/tag/tag-schema.ts | 1 - apps/timo-web/utils/todo/tag-label.ts | 3 +++ 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/apps/timo-web/app/[locale]/(main)/settings/_hooks/account/use-settings-profile.ts b/apps/timo-web/app/[locale]/(main)/settings/_hooks/account/use-settings-profile.ts index 8ba2db38..c07f649f 100644 --- a/apps/timo-web/app/[locale]/(main)/settings/_hooks/account/use-settings-profile.ts +++ b/apps/timo-web/app/[locale]/(main)/settings/_hooks/account/use-settings-profile.ts @@ -20,7 +20,7 @@ import { MAX_CUSTOM_TAG_COUNT, tagCreateDataSchema, } from "@/schemas/tag/tag-schema"; -import { getDefaultTagLabelKey } from "@/utils/todo/tag-label"; +import { getDefaultTagLabelKey, isDefaultTagId } from "@/utils/todo/tag-label"; const LANGUAGE_REQUEST_MAP: Record< SettingsLanguage, @@ -58,14 +58,13 @@ export const useSettingsProfile = () => { const { mutate: logoutMutate, isPending: isLoggingOut } = useLogoutMutation(); const tagItems = (tagsQuery.data?.tags ?? []).map((tag) => { - const labelKey = tag.isDefault - ? getDefaultTagLabelKey(tag.tagId) - : undefined; + const isDefault = isDefaultTagId(tag.tagId); + const labelKey = isDefault ? getDefaultTagLabelKey(tag.tagId) : undefined; return { id: tag.tagId, label: labelKey ? tCommon(`tag.${labelKey}`) : tag.name, - isDefault: tag.isDefault, + isDefault, }; }); diff --git a/apps/timo-web/hooks/todo-modal/common/use-tag-field.tsx b/apps/timo-web/hooks/todo-modal/common/use-tag-field.tsx index e2cdb099..8039c8c0 100644 --- a/apps/timo-web/hooks/todo-modal/common/use-tag-field.tsx +++ b/apps/timo-web/hooks/todo-modal/common/use-tag-field.tsx @@ -12,7 +12,7 @@ import { MAX_CUSTOM_TAG_COUNT, tagCreateDataSchema, } from "@/schemas/tag/tag-schema"; -import { getDefaultTagLabelKey } from "@/utils/todo/tag-label"; +import { getDefaultTagLabelKey, isDefaultTagId } from "@/utils/todo/tag-label"; export interface UseTagFieldParams { control: Control; @@ -63,7 +63,7 @@ export const useTagField = ({ (option) => option.id === field.value, ); const customTagCount = (tagsQuery.data?.tags ?? []).filter( - (tag) => !tag.isDefault, + (tag) => !isDefaultTagId(tag.tagId), ).length; const handleSelectTag = (label: string) => { diff --git a/apps/timo-web/schemas/tag/tag-schema.ts b/apps/timo-web/schemas/tag/tag-schema.ts index 60d0787b..f3bf477b 100644 --- a/apps/timo-web/schemas/tag/tag-schema.ts +++ b/apps/timo-web/schemas/tag/tag-schema.ts @@ -5,7 +5,6 @@ export const MAX_CUSTOM_TAG_COUNT = 4; export const tagSchema = z.object({ tagId: z.number(), name: z.string(), - isDefault: z.boolean(), }); export const tagListDataSchema = z.object({ diff --git a/apps/timo-web/utils/todo/tag-label.ts b/apps/timo-web/utils/todo/tag-label.ts index 7454d662..f0cc3bd2 100644 --- a/apps/timo-web/utils/todo/tag-label.ts +++ b/apps/timo-web/utils/todo/tag-label.ts @@ -20,3 +20,6 @@ const DEFAULT_TAG_ID_TO_LABEL_KEY: Record = { export const getDefaultTagLabelKey = (tagId: number): TagLabelKey | undefined => DEFAULT_TAG_ID_TO_LABEL_KEY[tagId]; + +export const isDefaultTagId = (tagId: number): boolean => + getDefaultTagLabelKey(tagId) !== undefined;