-
Notifications
You must be signed in to change notification settings - Fork 1
[Task] Feed 탭 , 프로필 피드 #511
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
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
eb4e870
feat : /feed mock api 설정
wade3420 97073da
feat : feed tab ui
wade3420 60c0c80
feat : startedAt과 sinceDay 도 서버정보를 쓴다
wade3420 314bf64
chore : 수미리뷰 반영
wade3420 bc3eb15
feat : feed api 변경사항 적용
wade3420 c5bb6ef
feat : feedItem 클릭시 상세페이지로 라우팅
wade3420 70a10d4
feat : 수미 코드리뷰 수정
wade3420 7d60835
fix : remark 타입 옵셔널 변경
wade3420 24d4b4e
Merge pull request #485 from depromeet/feat/feed-tap
wade3420 edf293f
Merge branch 'develop' of https://github.com/depromeet/10mm-client-we…
wade3420 d03e812
fix : app bar 에 use client 설정
wade3420 952bb38
feat : feed schema 타입 설정
wade3420 653b8ef
feat : ProfileTab.tsx 컴포넌트 분리
wade3420 b16b13d
feat : ProfileFeedItemSkeleton 추가
wade3420 60bba15
fix : build error fix
wade3420 a25b571
feat : feed 기능 이벤트 로깅
wade3420 e6e98dd
feat : seo에 keywords 추가
wade3420 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,35 @@ | ||
import getQueryKey from '@/apis/getQueryKey'; | ||
import apiInstance from '@/apis/instance.api'; | ||
import { type FeedBaseType, type FeedItemType } from '@/apis/schema/feed'; | ||
import { useQuery, type UseQueryOptions } from '@tanstack/react-query'; | ||
|
||
type GetFeedMeResponse = Array<FeedItemType>; | ||
|
||
type GetFeedByMemberIdResponse = Array<FeedBaseType>; | ||
|
||
export const FEED_API = { | ||
getFeedMe: async (): Promise<GetFeedMeResponse> => { | ||
const { data } = await apiInstance.get('/feed/me'); | ||
return data; | ||
}, | ||
getFeed: async (memberId: number): Promise<GetFeedByMemberIdResponse> => { | ||
const { data } = await apiInstance.get(`/feed/${memberId}`); | ||
return data; | ||
}, | ||
}; | ||
|
||
export const useFeedMe = (options?: UseQueryOptions<GetFeedMeResponse>) => { | ||
return useQuery<GetFeedMeResponse>({ | ||
...options, | ||
queryKey: getQueryKey('feedMe'), | ||
queryFn: FEED_API.getFeedMe, | ||
}); | ||
}; | ||
|
||
export const useFeedByMemberId = (memberId: number, options?: UseQueryOptions<GetFeedByMemberIdResponse>) => { | ||
return useQuery<GetFeedByMemberIdResponse>({ | ||
...options, | ||
queryKey: getQueryKey('feed', { memberId }), | ||
queryFn: () => FEED_API.getFeed(memberId), | ||
}); | ||
}; |
This file contains hidden or 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 hidden or 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,12 +1,17 @@ | ||
import { type MissionType } from '@/apis/schema/mission'; | ||
import { type RecordType } from '@/apis/schema/record'; | ||
export interface FeedItemType extends FeedBaseType { | ||
remark?: string; | ||
nickname: string; | ||
profileImage?: string; | ||
memberId: number; | ||
} | ||
|
||
/** | ||
* @description | ||
* @param mission - 미션 | ||
* @param records - 미션 기록 | ||
*/ | ||
export interface FeedType { | ||
mission: MissionType; | ||
records: RecordType[]; | ||
export interface FeedBaseType { | ||
missionId: number; | ||
recordId: number; | ||
name: string; | ||
recordImageUrl: string; | ||
duration: number; | ||
sinceDay: number; | ||
startedAt: string; | ||
finishedAt: string; | ||
} |
This file contains hidden or 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,155 @@ | ||
'use client'; | ||
|
||
import Link from 'next/link'; | ||
import { type FeedItemType } from '@/apis/schema/feed'; | ||
import HistoryThumbnail from '@/app/record/[id]/detail/HistoryThumbnail'; | ||
import Thumbnail from '@/components/Thumbnail/Thumbnail'; | ||
import { EVENT_LOG_CATEGORY, EVENT_LOG_NAME } from '@/constants/eventLog'; | ||
import { ROUTER } from '@/constants/router'; | ||
import { eventLogger } from '@/utils'; | ||
import { css } from '@styled-system/css'; | ||
import dayjs from 'dayjs'; | ||
|
||
function FeedItem({ | ||
sinceDay, | ||
remark, | ||
nickname, | ||
memberId, | ||
name, | ||
profileImage, | ||
recordImageUrl, | ||
duration, | ||
startedAt, | ||
recordId, | ||
}: FeedItemType) { | ||
const handleClickFeedItem = () => { | ||
eventLogger.logEvent(EVENT_LOG_CATEGORY.FEED, EVENT_LOG_NAME.FEED.CLICK_FEED); | ||
}; | ||
|
||
const handleClickFollowProfile = () => { | ||
eventLogger.logEvent(EVENT_LOG_CATEGORY.FEED, EVENT_LOG_NAME.FEED.CLICK_PROFILE); | ||
}; | ||
return ( | ||
<li> | ||
<Link href={ROUTER.PROFILE.DETAIL(memberId)} onClick={handleClickFollowProfile}> | ||
<div className={profileWrapperCss}> | ||
<Thumbnail size={'h24'} variant={'filled'} url={profileImage} /> | ||
<p>{nickname}</p> | ||
</div> | ||
</Link> | ||
<Link href={ROUTER.RECORD.DETAIL.FOLLOW(recordId.toString())} onClick={handleClickFeedItem}> | ||
<HistoryThumbnail imageUrl={recordImageUrl} missionDuration={duration} /> | ||
<div className={textWrapperCss}> | ||
<p className={missionNameCss}>{name}</p> | ||
{remark && <p className={remarkCss}>{remark}</p>} | ||
<p className={captionCss}> | ||
{sinceDay}일차 <div className={dotCss} /> {dayjs(startedAt).format('YYYY년 MM월 DD일')} | ||
</p> | ||
</div> | ||
</Link> | ||
</li> | ||
); | ||
} | ||
|
||
export default FeedItem; | ||
|
||
export const FeedSkeletonItem = () => { | ||
return ( | ||
<li> | ||
<div className={profileWrapperCss}> | ||
<Thumbnail size={'h24'} variant={'filled'} url={null} /> | ||
<div | ||
className={css( | ||
{ ...skeletonTextCss }, | ||
{ | ||
width: '80px', | ||
height: '20px', | ||
}, | ||
)} | ||
/> | ||
</div> | ||
<div className={profile} /> | ||
<div className={textWrapperCss}> | ||
<div | ||
className={css( | ||
{ ...skeletonTextCss }, | ||
{ | ||
width: '80px', | ||
height: '17px', | ||
}, | ||
)} | ||
/> | ||
<div | ||
className={css( | ||
{ ...skeletonTextCss }, | ||
{ | ||
width: '130px', | ||
height: '20px', | ||
}, | ||
)} | ||
/> | ||
</div> | ||
</li> | ||
); | ||
}; | ||
|
||
const profile = css({ | ||
animation: 'skeleton', | ||
backgroundColor: 'bg.surface4', | ||
width: '100%', | ||
aspectRatio: '1 / 1', | ||
position: 'relative', | ||
borderRadius: '22px', | ||
overflow: 'hidden', | ||
maxWidth: 'calc(475px - 32px)', | ||
maxHeight: 'calc(475px - 32px)', | ||
}); | ||
|
||
const skeletonTextCss = { | ||
animation: 'skeleton', | ||
backgroundColor: 'bg.surface4', | ||
borderRadius: '12px', | ||
}; | ||
|
||
const textWrapperCss = css({ | ||
display: 'flex', | ||
gap: '8px', | ||
flexDirection: 'column', | ||
|
||
padding: '20px 4px', | ||
}); | ||
|
||
const missionNameCss = css({ | ||
textStyle: 'body5', | ||
color: 'gray.gray600', | ||
}); | ||
|
||
const remarkCss = css({ | ||
textStyle: 'body2', | ||
color: 'text.primary', | ||
}); | ||
|
||
const captionCss = css({ | ||
textStyle: 'body3', | ||
color: 'text.tertiary', | ||
display: 'flex', | ||
gap: '5px', | ||
alignItems: 'center', | ||
}); | ||
|
||
const dotCss = css({ | ||
width: '2px', | ||
height: '2px', | ||
borderRadius: '50%', | ||
backgroundColor: 'icon.tertiary', | ||
}); | ||
|
||
const profileWrapperCss = css({ | ||
display: 'flex', | ||
alignItems: 'center', | ||
padding: '16px 12px', | ||
textStyle: 'body3', | ||
color: 'text.primary', | ||
gap: '8px', | ||
cursor: 'pointer', | ||
}); |
This file contains hidden or 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,32 @@ | ||
'use client'; | ||
import { useFeedMe } from '@/apis/feed'; | ||
import FeedItem, { FeedSkeletonItem } from '@/app/feed/FeedItem'; | ||
import { css } from '@styled-system/css'; | ||
|
||
function FeedList() { | ||
const { data } = useFeedMe(); | ||
if (!data) | ||
return ( | ||
<ul className={feedListCss}> | ||
<FeedSkeletonItem /> | ||
<FeedSkeletonItem /> | ||
</ul> | ||
); | ||
|
||
return ( | ||
<ul className={feedListCss}> | ||
{data.map((feed) => ( | ||
<FeedItem key={feed.recordId} {...feed} /> | ||
))} | ||
</ul> | ||
); | ||
} | ||
|
||
export default FeedList; | ||
|
||
const feedListCss = css({ | ||
padding: '0 16px 132px 16px', | ||
display: 'flex', | ||
flexDirection: 'column', | ||
gap: '32px', | ||
}); |
This file contains hidden or 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,15 @@ | ||
import FeedList from '@/app/feed/FeedList'; | ||
import AppBar from '@/app/home/AppBar'; | ||
import AppBarBottom from '@/components/AppBarBottom/AppBarBottom'; | ||
import BottomDim from '@/components/BottomDim/BottomDim'; | ||
|
||
export default function FeedPage() { | ||
return ( | ||
<> | ||
<AppBar /> | ||
<FeedList /> | ||
<BottomDim /> | ||
<AppBarBottom /> | ||
</> | ||
); | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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,59 @@ | ||
import Image from 'next/image'; | ||
import MissionDuration from '@/app/record/[id]/detail/MissionDuration'; | ||
import { css } from '@styled-system/css'; | ||
|
||
function FeedThumbnail({ imageUrl, missionDuration }: { imageUrl: string; missionDuration: number }) { | ||
return ( | ||
<div className={historyThumbnailWrapperCss}> | ||
<div className={dimmedCss} /> | ||
<Image className={imageCss} width={365} height={365} src={imageUrl} alt={'피드 이미지'} /> | ||
<div className={positionCss}> | ||
<MissionDuration duration={missionDuration} type={'profileFeed'} /> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default FeedThumbnail; | ||
|
||
const dimmedCss = css({ | ||
position: 'absolute', | ||
width: '100%', | ||
height: '60px', | ||
background: | ||
'linear-gradient(0deg, rgba(27, 34, 51, 0.00) 0%, rgba(27, 34, 51, 0.01) 10%, rgba(27, 34, 51, 0.03) 19.79%, rgba(27, 34, 51, 0.07) 34.79%, rgba(27, 34, 51, 0.13) 56.25%, rgba(27, 34, 51, 0.20) 77.92%, rgba(27, 34, 51, 0.30) 100%)', | ||
top: 0, | ||
left: 0, | ||
right: 0, | ||
bottom: 0, | ||
zIndex: 1, | ||
}); | ||
|
||
const historyThumbnailWrapperCss = css({ | ||
width: '100%', | ||
aspectRatio: '1 / 1', | ||
position: 'relative', | ||
borderRadius: '16px', | ||
overflow: 'hidden', | ||
maxWidth: 'calc(475px - 32px)', | ||
maxHeight: 'calc(475px - 32px)', | ||
|
||
'@media (max-width: 475px)': { | ||
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. 👍🏻 |
||
maxWidth: 'calc(100vw - 32px)', | ||
maxHeight: 'calc(100vw - 32px)', | ||
}, | ||
}); | ||
|
||
const positionCss = css({ | ||
position: 'absolute', | ||
top: '9px', | ||
left: '8px', | ||
zIndex: 2, | ||
}); | ||
|
||
const imageCss = css({ | ||
width: '100%', | ||
borderRadius: '22px', | ||
objectFit: 'cover', | ||
height: '100%', | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
오 이런게 있구나
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.
아마 로그인 화면도 요거랑 백그라운드 여백 색으로 여차저차 하면 더 자연스러워지지 않을까...