Skip to content

Commit

Permalink
Merge pull request #225 from MeeTeamNumdle/feature/#220_fix_2nd_user_…
Browse files Browse the repository at this point in the history
…test_bug

fix: 프로필 편집 페이지 UT 2차 이슈 해결
  • Loading branch information
kimsuyeon0916 authored Jun 24, 2024
2 parents 4b018d0 + faa3f2c commit fc707c8
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 17 deletions.
7 changes: 7 additions & 0 deletions global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from 'react';

declare module 'react' {
interface ImgHTMLAttributes<T> extends HTMLAttributes<T> {
fetchpriority?: 'high' | 'low' | 'auto';
}
}
Binary file added src/assets/Congratulation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/assets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ import DropdownArrowUp from './DropdownArrowUp.svg';
import FloatingBackground from './FloatingBackground.svg';
import Alert from './Alert.svg';
import MeeteamLogoLarge from './MeeteamLogoLarge.svg';
import Congratulation from './Congratulation.svg';
import Congratulation from './Congratulation.png';
import NaverIcon from './NaverIcon.png';
import Clip from './Clip.svg';
import Valid from './Valid.svg';
Expand Down
2 changes: 1 addition & 1 deletion src/components/carousel/ImageCarousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const ImageCarousel = ({ images }: { images: Image[] }) => {
<S.ImageCarouselContainer className='embla__container'>
{images.map(({ fileName, url }, index) => (
<S.ImageWrapper className='embla__slide' key={index}>
<S.Image src={url} alt={fileName} />
<S.Image src={url} alt={fileName} fetchpriority={index === 0 ? 'high' : 'low'} />
</S.ImageWrapper>
))}
</S.ImageCarouselContainer>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/account/complete/Complete#Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const Complete#Page = () => {
<header className='account__header'>
<h1>밋팀에서 팀을 만날 수 있어요!</h1>
</header>
<img src={Congratulation} alt='회원가입을 축하합니다!' />
<img src={Congratulation} alt='회원가입을 축하합니다!' fetchpriority='high' />
<div>
<PrimaryBtn title='확인' type='button' handleClick={() => handleClick()} />
</div>
Expand Down
8 changes: 6 additions & 2 deletions src/pages/portfolio/edit/PortfolioEditPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const PortfolioEditPage = () => {
keepErrors: true,
},
});
const { isSubmitting } = formState;
const { isSubmitting, isSubmitSuccessful } = formState;

const createPortfolioInSuccess = (newPortfolioId: string) => {
navigate(`/portfolio/${newPortfolioId}`);
Expand Down Expand Up @@ -516,7 +516,11 @@ const PortfolioEditPage = () => {

<S.PortfolioEditButtonBox>
<DefaultBtn type='button' title='취소' handleClick={() => navigate(-1)} />
<PrimaryBtn type='submit' title='등록' disabled={isSubmitting} />
<PrimaryBtn
type='submit'
title='등록'
disabled={isSubmitting || isSubmitSuccessful}
/>
</S.PortfolioEditButtonBox>
</S.PortfolioEditColumn>
</S.PortfolioEditLayout>
Expand Down
12 changes: 3 additions & 9 deletions src/pages/profile/details/ProfileDetailsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect } from 'react';
import React from 'react';
import S from '../Profile.styled';
import {
DefaultBtn,
Expand All @@ -9,7 +9,7 @@ import {
} from '../../../components';
import { useReadProfile } from '../../../hooks';
import { useParams, useNavigate } from 'react-router';
import { useRecoilState } from 'recoil';
import { useRecoilValue } from 'recoil';
import { userState } from '../../../atom';
import { BlackEmail, BlackPhone } from '../../../assets';

Expand All @@ -22,17 +22,11 @@ const MESSAGE = {
};

const ProfileDetailsPage = () => {
const [userInfo, setUserState] = useRecoilState(userState);
const userInfo = useRecoilValue(userState);

const { userId } = useParams() as { userId: string };
const { data: user, isSuccess } = useReadProfile(userId);

useEffect(() => {
if (isSuccess) {
userInfo?.userId === userId && setUserState({ ...user, userId }); // 본인인지 아닌지 확인 로직 필요
}
}, [isSuccess]);

const navigate = useNavigate();

const isDefaultEmailPublic = user?.universityEmail?.isDefault
Expand Down
8 changes: 5 additions & 3 deletions src/pages/profile/edit/ProfileEditPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const ProfileEditPage = () => {
keepErrors: true,
},
});
const { isSubmitting } = formState;
const { isSubmitting, isSubmitSuccessful } = formState;

// 닉네임
const nickname = useDebounce(watch('nickname') as string);
Expand Down Expand Up @@ -659,9 +659,11 @@ const ProfileEditPage = () => {
handleClick={() => navigate(`/profile/${userId}`)}
/>
<PrimaryBtn
type='button'
type='submit'
title='저장'
disabled={getFieldState('nickname').invalid || duplicated || isSubmitting}
disabled={
getFieldState('nickname').invalid || duplicated || isSubmitting || isSubmitSuccessful
}
/>
</S.ProfileButtonBox>
</S.ProfileLayout>
Expand Down

0 comments on commit fc707c8

Please # to comment.