From e4f0bed6f9b975ed094892581429782725374c91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=EC=98=88=EC=A7=84?= Date: Sun, 22 Dec 2024 22:28:12 +0900 Subject: [PATCH] feat: add translation values --- public/locales/ko/common.json | 6 ++++++ .../IdealPartnerProfile/IdealPartnerProfile.tsx | 15 +++++++++------ src/entities/profile/lib/getDrinkingText.ts | 4 +++- .../ui/MyProfile/components/TasteInfoGrid.tsx | 4 ++-- .../profile/ui/ProfileCard/ProfileCard.tsx | 3 +-- src/shared/ui/Profile/Profile.module.css | 4 ++++ 6 files changed, 25 insertions(+), 11 deletions(-) diff --git a/public/locales/ko/common.json b/public/locales/ko/common.json index b237a2a..c60c858 100644 --- a/public/locales/ko/common.json +++ b/public/locales/ko/common.json @@ -19,11 +19,17 @@ "DRINKING_ONE_TWO_TIMES_A_WEEK":"주 1-2회 가볍게는 괜찮아요", "DRINKING_ONE_TWO_TIMES_A_MONTH": "달 1-2회 정도 괜찮아요", "DRINKING_NEVER":"되도록 안하면 좋겠어요", + "DRINKING_DRINKER": "O", + "DRINKING_NON_DRINKER": "X", "DRINKING_ETC": "기타", "JOB_STUDENT": "학생(대학원생)", "JOB_EMPLOYEE": "직장인", "JOB_FREELANCER": "자영업자, 프리랜서", "JOB_ETC": "기타", + "LOCATION_IMPORTANT": "중요해요", + "LOCATION_NOT_IMPORTANT": "상관 없어요", + "HOBBY_IMPORTANT": "중요해요", + "HOBBY_NOT_IMPORTANT": "상관 없어요", "CITY_SEOUL": "서울", "CITY_GYEONGGI": "경기", "CITY_INCHEON": "인천", diff --git a/src/entities/ideal_partner/ui/IdealPartnerProfile/IdealPartnerProfile.tsx b/src/entities/ideal_partner/ui/IdealPartnerProfile/IdealPartnerProfile.tsx index dded5fd..602f651 100644 --- a/src/entities/ideal_partner/ui/IdealPartnerProfile/IdealPartnerProfile.tsx +++ b/src/entities/ideal_partner/ui/IdealPartnerProfile/IdealPartnerProfile.tsx @@ -6,8 +6,11 @@ import { getSmokingText } from '../../../profile/lib/getSmokingText'; import { getDrinkingText } from '../../../profile/lib/getDrinkingText'; import { getReligionText } from '../../../profile/lib/getReligionText'; import { useProfileEditContext } from 'src/features/EditInfo/ProfileEditContext'; +import { useTranslation } from 'react-i18next'; export const IdealPartnerProfile = ({ profile }: { profile: IdealPartner }) => { + const { t } = useTranslation(); + const value = useProfileEditContext(); const onClickEdit = value.canEdit ? value.onEdit : undefined; @@ -17,19 +20,19 @@ export const IdealPartnerProfile = ({ profile }: { profile: IdealPartner }) => { return (
- {(showBlankValue || profile.ageRange) && ( + {
onClickEdit?.('IDEAL_AGE')} /> - {profile.ageRange?.min}-{profile.ageRange?.max} + {profile.ageRange ? `${profile.ageRange?.min}-${profile.ageRange?.max}` : '나이는 딱히 상관 없어요'}
- )} + } {(showBlankValue || profile.heightRange) && (
onClickEdit?.('IDEAL_HEIGHT_STYLE')} /> - {profile.heightRange?.min}cm-{profile.heightRange?.max}cm + {profile.heightRange?.min}cm - {profile.heightRange?.max}cm
)} @@ -49,11 +52,11 @@ export const IdealPartnerProfile = ({ profile }: { profile: IdealPartner }) => { )}
onClickEdit?.('IDEAL_LOCATION')} /> - {profile.locations} + {t(`LOCATION_${profile.locations}`)}
onClickEdit?.('IDEAL_HOBBY')} /> -
{profile.hobbies}
+
{t(`HOBBY_${profile.hobbies}`)}
{(showBlankValue || profile.religion) && (
diff --git a/src/entities/profile/lib/getDrinkingText.ts b/src/entities/profile/lib/getDrinkingText.ts index d2b7d9b..a168a5b 100644 --- a/src/entities/profile/lib/getDrinkingText.ts +++ b/src/entities/profile/lib/getDrinkingText.ts @@ -2,5 +2,7 @@ import { t } from 'i18next'; import { IdealPartnerDrinking, UserInfoDrinking } from 'src/types'; export const getDrinkingText = (drinking: UserInfoDrinking | IdealPartnerDrinking) => { - return t(`DRINKING_${drinking.drinkingCategory}`); + return drinking.drinkingCategory === 'DRINKER' + ? drinking.drinkingAmount || 'O' + : t(`DRINKING_${drinking.drinkingCategory}`); }; diff --git a/src/entities/profile/ui/MyProfile/components/TasteInfoGrid.tsx b/src/entities/profile/ui/MyProfile/components/TasteInfoGrid.tsx index b096bbf..def0564 100644 --- a/src/entities/profile/ui/MyProfile/components/TasteInfoGrid.tsx +++ b/src/entities/profile/ui/MyProfile/components/TasteInfoGrid.tsx @@ -26,13 +26,13 @@ export const TasteInfoGrid = ({ profile, onClickEdit }: { profile: MyProfile; on
{(showBlankValue || profile.smoking) && (
- onClickEdit?.('PROFILE_SMOKE_ALCOHOL')} /> + onClickEdit?.('PROFILE_SMOKE_ALCOHOL')} /> {getSmokingText(profile.smoking, 'INFO')}
)} {(showBlankValue || profile.drinking) && (
- onClickEdit?.('PROFILE_SMOKE_ALCOHOL')} /> + onClickEdit?.('PROFILE_SMOKE_ALCOHOL')} /> {getDrinkingText(profile.drinking)}
)} diff --git a/src/entities/profile/ui/ProfileCard/ProfileCard.tsx b/src/entities/profile/ui/ProfileCard/ProfileCard.tsx index c93c80a..ed9411b 100644 --- a/src/entities/profile/ui/ProfileCard/ProfileCard.tsx +++ b/src/entities/profile/ui/ProfileCard/ProfileCard.tsx @@ -8,7 +8,6 @@ import { getReligionText } from 'src/entities/profile/lib/getReligionText'; import { Chip } from 'src/shared/ui/Chip/Chip'; import { getJobText } from 'src/entities/profile/lib/getJobText'; import { Avatar } from 'src/shared/ui/Avatar/Avatar'; -import { getLocationText } from 'src/entities/profile/lib/getLocationText'; import { convertDtoToLocation } from 'src/entities/profile/model/convertProfileToDto'; import { getDrinkingText } from 'src/entities/profile/lib/getDrinkingText'; @@ -40,7 +39,7 @@ export const ProfileCard = ({ profile, headerRightSlot }: Props) => {
{calculateAge(new Date(profile.birthDate))}세 {t(profile.gender)} - {location ? getLocationText(location) : ''} + {location && getLocationText(location)}
diff --git a/src/shared/ui/Profile/Profile.module.css b/src/shared/ui/Profile/Profile.module.css index f3c55fa..504f5df 100644 --- a/src/shared/ui/Profile/Profile.module.css +++ b/src/shared/ui/Profile/Profile.module.css @@ -14,6 +14,10 @@ display: grid; gap: 8px; width: 100%; + + & > span { + line-height: 24px; + } } .CellHeader {