-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: PageHeader.scss 수정 * feat: useGetUser hook 구현 * feat: ProfileUser useGetUser 사용 * feat: user.ts Fetch interface 구현 * feat: profileImage Link 경로 수정 * feat: Feed 내 Profile 경로 props 추가 * feat: types/index.ts 수정 * feat: ProfileMainPage 수정 * feat: Router index 수정 * fix: ProfileUser 컴포넌트 수정 * fix: shared/consts/types/index.ts 수정 잘못된 태스크 분리로 인해 잘못 삭제한 export ProfileFeed 복구 * feat: ProfileMainPage useEffect 삭제 * feat: ProfileUser 수정 * feat: ProfileUser 컴포넌트 icon 추가 * feat: ProfileUserImage 컴포넌트 구현 * feat: ProfileUser에서 ProfileUserImage 컴포넌트 분리 적용 * refactor: ProfileMainPage 분기처리 리팩토링 * feat: shared/ProfileImage 컴포넌트 구현 * feat: shared/Profile ProfileImage컴포넌트 적용 및 isLink prop 추가 * feat: Feed 컴포넌트 isLink prop 추가 * feat: FeedMainList 내부 Feed 컴포넌트에 isLink prop 설정 * feat: ProfileFeedList 내부 Feed 컴포넌트에 isLink prop 설정 * feat: ProfileUserImage 내 NoProfileIcon SVG 추가 * feat: useGetUser enalbed 삭제 자신의 PK값은 iOS에서 가져오고, 상대 user의 경우에는 Link로 이동하면서 props로 받기에 필요 없음 * feat: ProfileMainPage 내 ProfileFeedList 제거 api 구현 후 연결 예정 Closes #PW-346
- Loading branch information
1 parent
c4c73ef
commit e5b3403
Showing
21 changed files
with
295 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
import { ProfileFeedList } from '@/widgets/profile-feed-list'; | ||
import { ProfileHeader } from '@/widgets/profile-header'; | ||
import { useParams } from 'react-router-dom'; | ||
|
||
import { ProfileUser } from '@/widgets/profile-user'; | ||
|
||
/** | ||
* @todo userPK값 가져와서 판별하도록 구현 | ||
* @todo ProfileFeed Api 구현 후, ProfileFeedList 컴포넌트 연결 | ||
*/ | ||
|
||
export const ProfileMainPage = () => { | ||
const { userId } = useParams<{ userId: string }>(); | ||
const formattedUserId = Number(userId); | ||
|
||
const owner = formattedUserId === 1 ? true : false; | ||
|
||
return ( | ||
<main> | ||
<ProfileHeader name='2weeksone' /> | ||
<ProfileUser /> | ||
<ProfileFeedList /> | ||
<ProfileUser userId={formattedUserId} isOwner={owner} /> | ||
</main> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export type * from './feed'; | ||
export type { Comment } from './comment'; | ||
export type { Like } from './like'; | ||
export type { User, RelationshipStatus } from './user'; | ||
export type * from './user'; | ||
export type { ProfileFeed } from './profileFeed'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export const QUERY_KEYS = Object.freeze({ | ||
feeds: 'feeds', | ||
users: 'users', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
.page-header { | ||
width: 320px; | ||
width: 100%; | ||
height: 44px; | ||
display: flex; | ||
align-items: center; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.profile-image { | ||
width: 32px; | ||
height: 32px; | ||
|
||
border-radius: 50%; | ||
overflow: hidden; | ||
} | ||
|
||
.no-proile-background { | ||
position: relative; | ||
width: 32px; | ||
height: 32px; | ||
border-radius: 50%; | ||
overflow: hidden; | ||
|
||
background: $gray3; | ||
|
||
svg { | ||
z-index: 1; | ||
position: absolute; | ||
bottom: 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Icon } from '..'; | ||
import './ProfileImage.scss'; | ||
|
||
interface ProfileImageProps { | ||
profileImage: string; | ||
name: string; | ||
} | ||
|
||
const ProfileImage = ({ profileImage, name }: ProfileImageProps) => { | ||
return profileImage ? ( | ||
<img | ||
className='profile-image' | ||
src={profileImage} | ||
alt={`${name} profile image`} | ||
/> | ||
) : ( | ||
<div className='no-proile-background'> | ||
<Icon name='no-profile' width='32' height='32' /> | ||
</div> | ||
); | ||
}; | ||
export default ProfileImage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { useGetUser } from './useGetUser'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
import { axiosInstance } from '@/shared/axios'; | ||
import { FetchUser } from '@/shared/consts'; | ||
import { QUERY_KEYS } from '@/shared/react-query'; | ||
|
||
async function fetchUser(userId: number): Promise<FetchUser> { | ||
const { data } = await axiosInstance.get(`/users/${userId}`); | ||
return data; | ||
} | ||
|
||
export const useGetUser = (userId: number) => { | ||
const { | ||
data, | ||
isLoading, | ||
isError, | ||
refetch: refetchUser, | ||
} = useQuery({ | ||
queryKey: [QUERY_KEYS.users, userId], | ||
queryFn: () => fetchUser(userId), | ||
}); | ||
|
||
return { | ||
data, | ||
isLoading, | ||
isError, | ||
refetchUser, | ||
}; | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.