-
Notifications
You must be signed in to change notification settings - Fork 2
fix: SP2 마이 페이지 및 매칭 조건 수정 페이지 수정 #408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
66993a1
fe01663
405f34c
e6bcb7f
a370579
c6b80cf
0f6430a
7e44e3e
a4f5031
a78de0a
f55a98b
1ddffb3
612642e
97a61f5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,65 @@ | ||||||||||||||||||||||||||||||||||
| import Button from '@components/button/button/button'; | ||||||||||||||||||||||||||||||||||
| import type { ChipColor } from '@components/card/match-card/types/card'; | ||||||||||||||||||||||||||||||||||
| import Chip from '@components/chip/chip'; | ||||||||||||||||||||||||||||||||||
| import Divider from '@components/divider/divider'; | ||||||||||||||||||||||||||||||||||
| import { ROUTES } from '@routes/routes-config'; | ||||||||||||||||||||||||||||||||||
| import { useNavigate } from 'react-router-dom'; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| interface ProfileCardProps { | ||||||||||||||||||||||||||||||||||
| nickname: string; | ||||||||||||||||||||||||||||||||||
| imgUrl: string; | ||||||||||||||||||||||||||||||||||
| team: string; | ||||||||||||||||||||||||||||||||||
| style: string; | ||||||||||||||||||||||||||||||||||
| matchCnt?: number; | ||||||||||||||||||||||||||||||||||
| avgSeason?: number; | ||||||||||||||||||||||||||||||||||
| onEditProfile?: () => void; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| const ProfileCard = ({ nickname, imgUrl, team, style, matchCnt, avgSeason }: ProfileCardProps) => { | ||||||||||||||||||||||||||||||||||
| const navigate = useNavigate(); | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||
| <div className="w-full flex-col gap-[1.2rem] rounded-[12px] bg-gray-950 p-[2rem]"> | ||||||||||||||||||||||||||||||||||
| <div className="flex-row-between"> | ||||||||||||||||||||||||||||||||||
| <div className="flex gap-[0.8rem]"> | ||||||||||||||||||||||||||||||||||
| <img | ||||||||||||||||||||||||||||||||||
| src={imgUrl} | ||||||||||||||||||||||||||||||||||
| alt={`${nickname} 프로필 이미지`} | ||||||||||||||||||||||||||||||||||
| className="h-[6rem] w-[6rem] rounded-[60px]" | ||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||
| <div className="flex-col gap-[0.4rem]"> | ||||||||||||||||||||||||||||||||||
| <p className="subhead_18_sb text-gray-white">{nickname}</p> | ||||||||||||||||||||||||||||||||||
| <div className="flex gap-[0.4rem]"> | ||||||||||||||||||||||||||||||||||
| <Chip label={team} bgColor={team as ChipColor} textColor={team as ChipColor} /> | ||||||||||||||||||||||||||||||||||
| <Chip label={style} bgColor={style as ChipColor} textColor={style as ChipColor} /> | ||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||
| <div> | ||||||||||||||||||||||||||||||||||
| <Button | ||||||||||||||||||||||||||||||||||
| size="S" | ||||||||||||||||||||||||||||||||||
| label="프로필 수정" | ||||||||||||||||||||||||||||||||||
| className="cap_14_sb rounded-[8px]" | ||||||||||||||||||||||||||||||||||
| onClick={() => navigate(ROUTES.PROFILE_EDIT)} | ||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| <div className="w-full flex-row-evenly rounded-[8px] bg-gray-700 px-[1.2rem] py-[0.8rem]"> | ||||||||||||||||||||||||||||||||||
| <div className="flex-col-between gap-[0.2rem]"> | ||||||||||||||||||||||||||||||||||
| <p className="cap_14_sb text-gray-400">함께한 매칭</p> | ||||||||||||||||||||||||||||||||||
| <p className="head_20_sb text-gray-white">{matchCnt}</p> | ||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||
| <div className="h-[3.3rem]"> | ||||||||||||||||||||||||||||||||||
| <Divider direction="vertical" thickness={0.1} color="bg-gray-600" /> | ||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||
| <div className="flex-col-between gap-[0.2rem]"> | ||||||||||||||||||||||||||||||||||
| <p className="cap_14_sb text-gray-400">시즌 평균 직관</p> | ||||||||||||||||||||||||||||||||||
| <p className="head_20_sb text-gray-white">{avgSeason}</p> | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+51
to
+58
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. optional props
🛡️ 권장 수정: 기본값 제공-<p className="head_20_sb text-gray-white">{matchCnt}</p>
+<p className="head_20_sb text-gray-white">{matchCnt ?? 0}</p>-<p className="head_20_sb text-gray-white">{avgSeason}</p>
+<p className="head_20_sb text-gray-white">{avgSeason ?? 0}</p>📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| export default ProfileCard; | ||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,12 @@ | ||
| import { userMutations } from '@apis/user/user-mutations'; | ||
| import { userQueries } from '@apis/user/user-queries'; | ||
| import Button from '@components/button/button/button'; | ||
| import Card from '@components/card/match-card/card'; | ||
| import type { ChipColor } from '@components/chip/chip-list'; | ||
| import Divider from '@components/divider/divider'; | ||
| import Footer from '@components/footer/footer'; | ||
| import { FEEDBACK_LINK, REQUEST_LINK } from '@pages/profile/constants/link'; | ||
| import { ROUTES } from '@routes/routes-config'; | ||
| import { useMutation, useQuery } from '@tanstack/react-query'; | ||
| import { useNavigate } from 'react-router-dom'; | ||
| import ProfileCard from './components/profile-card'; | ||
|
|
||
| const Profile = () => { | ||
| const navigate = useNavigate(); | ||
|
|
@@ -20,25 +18,16 @@ const Profile = () => { | |
|
|
||
| return ( | ||
| <div className="h-full flex-col-between"> | ||
| <div className="w-full flex-col-center gap-[1.6rem] px-[1.6rem] pt-[1.6rem] pb-[5.6rem]"> | ||
| <Card | ||
| className="!shadow-none" | ||
| type="user" | ||
| <div className="w-full flex-col-center gap-[3.2rem] px-[1.6rem] pt-[1.6rem] pb-[5.6rem]"> | ||
| <ProfileCard | ||
| nickname={data.nickname ?? ''} | ||
| imgUrl={[data.imgUrl ?? '']} | ||
| team={data.team ?? ''} | ||
| style={data.style ?? ''} | ||
| age={data.age ?? ''} | ||
| gender={data.gender ?? ''} | ||
| introduction={data.introduction ?? ''} | ||
| chips={[(data.team ?? '') as ChipColor, (data.style ?? '') as ChipColor]} | ||
| imgUrl={data.imgUrl ?? ''} | ||
| matchCnt={data.matchCnt ?? 0} | ||
| avgSeason={data.avgSeason ?? 0} | ||
| onEditProfile={() => navigate(ROUTES.PROFILE_EDIT)} | ||
| /> | ||
|
Comment on lines
+22
to
30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
두 가지 방법 중 하나를 선택하세요:
♻️ 권장 수정 방안 (옵션 1: ProfileCard에서 prop 사용)profile-card.tsx 수정: -const ProfileCard = ({ nickname, imgUrl, team, style, matchCnt, avgSeason }: ProfileCardProps) => {
- const navigate = useNavigate();
+const ProfileCard = ({ nickname, imgUrl, team, style, matchCnt, avgSeason, onEditProfile }: ProfileCardProps) => {- onClick={() => navigate(ROUTES.PROFILE_EDIT)}
+ onClick={onEditProfile}🤖 Prompt for AI Agents |
||
| <Button | ||
| size="L" | ||
| label="프로필 · 매칭 조건 수정" | ||
| onClick={() => navigate(ROUTES.PROFILE_EDIT)} | ||
| /> | ||
| <Divider thickness={0.4} color="bg-gray-200" /> | ||
| <section className="w-full flex-col items-start"> | ||
| <a | ||
| href={REQUEST_LINK} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as ChipColor타입 캐스팅이 런타임 오류를 야기할 수 있습니다.team과style값을ChipColor로 강제 캐스팅하고 있지만, API에서 반환되는 값이chipVariants에 정의된 유효한 색상 키와 일치하지 않을 수 있습니다. 이 경우 스타일이 적용되지 않거나 예기치 않은 렌더링이 발생할 수 있습니다.관련 코드 참조:
src/shared/components/card/match-card/types/card.ts의ChipColor타입 정의♻️ 권장 수정: 타입 안전한 매핑 함수 사용
🤖 Prompt for AI Agents