-
Notifications
You must be signed in to change notification settings - Fork 6
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
[FE] feature/#301 내 정보 페이지 구현 #309
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
99faae7
feat: 내 정보 페이지 구현
GC-Park dc13809
refactor: early return 위치 변경
GC-Park c8eaa48
refactor: 에러 페이지 width 변경
GC-Park fbaa976
refactor: MyInfoPage 이름 수정
GC-Park 0847d46
refactor: Profile 내 토픽 get 요청 받아 데이터 받도록 수정
GC-Park bbfa912
refactor: 프로필 사진 로그인 됐을 시 카카오 프로필 사진으로 변경
GC-Park f44cdac
refactor: MyInfo 수정 버튼 삭제
GC-Park 13092dc
Merge branch 'develop' into feature/#301-myInfo-page
GC-Park 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
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
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 |
---|---|---|
|
@@ -16,6 +16,7 @@ const MyInfo = () => { | |
name: 'Patrick', | ||
email: '[email protected]', | ||
}); | ||
const user = JSON.parse(localStorage.getItem('user') || ''); | ||
|
||
// useEffect(()=>{ | ||
// setMyInfoName() | ||
|
@@ -44,11 +45,7 @@ const MyInfo = () => { | |
$justifyContent="center" | ||
$alignItems="center" | ||
> | ||
{isThereImg ? ( | ||
<MyInfoImg src="https://images.unsplash.com/photo-1480429370139-e0132c086e2a?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=988&q=80" /> | ||
) : ( | ||
<InfoDefalutImg /> | ||
)} | ||
<MyInfoImg src={user.imageUrl} /> | ||
<Space size={7} /> | ||
<Box> | ||
<Text color="black" $fontSize="default" $fontWeight="normal"> | ||
|
@@ -58,14 +55,12 @@ const MyInfo = () => { | |
{myInfoNameAndEmail.email} | ||
</Text> | ||
</Box> | ||
<MyInfoModifyIcon> | ||
<ModifyMyInfoIcon onClick={onModifyInfo} /> | ||
</MyInfoModifyIcon> | ||
</MyInfoContainer> | ||
); | ||
}; | ||
|
||
const MyInfoContainer = styled(Flex)` | ||
position: relative; | ||
border: 1px solid ${({ theme }) => theme.color.lightGray}; | ||
`; | ||
|
||
|
@@ -76,10 +71,4 @@ const MyInfoImg = styled.img` | |
border-radius: 50%; | ||
`; | ||
|
||
const MyInfoModifyIcon = styled(Box)` | ||
position: absolute; | ||
right: 32px; | ||
top: 32px; | ||
`; | ||
|
||
export default MyInfo; |
50 changes: 50 additions & 0 deletions
50
frontend/src/components/MyInfoContainer/MyInfoList/index.tsx
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,50 @@ | ||
import { Fragment, useEffect, useState } from 'react'; | ||
import { styled } from 'styled-components'; | ||
import { getApi } from '../../../apis/getApi'; | ||
import { MyInfoPinType, MyInfoTopicType } from '../../../types/MyInfo'; | ||
import PinCard from '../../PinCard'; | ||
import TopicCard from '../../TopicCard'; | ||
|
||
const MyInfoList = () => { | ||
const [myInfoTopics, setMyInfoTopics] = useState<MyInfoTopicType[]>([]); | ||
|
||
const getMyInfoListFromServer = async () => { | ||
const serverMyInfoTopics = await getApi<MyInfoTopicType[]>( | ||
'default', | ||
'/members/my/topics', | ||
); | ||
setMyInfoTopics(serverMyInfoTopics); | ||
}; | ||
|
||
useEffect(() => { | ||
getMyInfoListFromServer(); | ||
}, []); | ||
|
||
if (!myInfoTopics) return <></>; | ||
|
||
return ( | ||
<MyInfoListWrapper> | ||
{myInfoTopics.map((topic, index) => { | ||
return ( | ||
<Fragment key={topic.id}> | ||
<TopicCard | ||
topicId={topic.id} | ||
topicImage={topic.image} | ||
topicTitle={topic.name} | ||
topicUpdatedAt={topic.updatedAt} | ||
topicPinCount={topic.pinCount} | ||
/> | ||
</Fragment> | ||
); | ||
})} | ||
</MyInfoListWrapper> | ||
); | ||
}; | ||
|
||
const MyInfoListWrapper = styled.ul` | ||
display: grid; | ||
grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); | ||
grid-row-gap: ${({ theme }) => theme.spacing[5]}; | ||
`; | ||
|
||
export default MyInfoList; |
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,55 @@ | ||
import { styled } from 'styled-components'; | ||
import Flex from '../common/Flex'; | ||
import Text from '../common/Text'; | ||
import Box from '../common/Box'; | ||
import Space from '../common/Space'; | ||
import { lazy, Suspense } from 'react'; | ||
import TopicCardListSeleton from '../TopicCardList/TopicCardListSeleton'; | ||
import Button from '../common/Button'; | ||
import MyInfoList from './MyInfoList'; | ||
|
||
interface MyInfoContainerProps { | ||
containerTitle: string; | ||
containerDescription: string; | ||
} | ||
|
||
const MyInfoContainer = ({ | ||
containerTitle, | ||
containerDescription, | ||
}: MyInfoContainerProps) => ( | ||
<section> | ||
<Flex $justifyContent="space-between" $alignItems="flex-end"> | ||
<Box> | ||
<Text | ||
color="black" | ||
$fontSize="extraLarge" | ||
$fontWeight="bold" | ||
tabIndex={0} | ||
> | ||
{containerTitle} | ||
</Text> | ||
<Space size={0} /> | ||
<Text | ||
color="gray" | ||
$fontSize="default" | ||
$fontWeight="normal" | ||
tabIndex={1} | ||
> | ||
{containerDescription} | ||
</Text> | ||
</Box> | ||
</Flex> | ||
|
||
<Space size={4} /> | ||
|
||
<Suspense fallback={<TopicCardListSeleton />}> | ||
<MyInfoList /> | ||
</Suspense> | ||
</section> | ||
); | ||
|
||
const SeeAllButton = styled(Button)` | ||
cursor: pointer; | ||
`; | ||
|
||
export default MyInfoContainer; |
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,68 @@ | ||
import { styled } from 'styled-components'; | ||
import Text from '../common/Text'; | ||
import useNavigator from '../../hooks/useNavigator'; | ||
import Box from '../common/Box'; | ||
import Image from '../common/Image'; | ||
import { SyntheticEvent } from 'react'; | ||
import Space from '../common/Space'; | ||
import Flex from '../common/Flex'; | ||
import FavoriteSVG from '../../assets/favoriteBtn_filled.svg'; | ||
import SeeTogetherSVG from '../../assets/seeTogetherBtn_filled.svg'; | ||
import SmallTopicPin from '../../assets/smallTopicPin.svg'; | ||
import SmallTopicStar from '../../assets/smallTopicStar.svg'; | ||
import { DEFAULT_TOPIC_IMAGE } from '../../constants'; | ||
import AddSeeTogether from '../AddSeeTogether'; | ||
import AddFavorite from '../AddFavorite'; | ||
|
||
export interface PinCardProps { | ||
pinId: number; | ||
pinTitle: string; | ||
pinAddress: string; | ||
pinDescription: string; | ||
} | ||
|
||
const PinCard = ({ | ||
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. 오 새롭게 만든 핀카드??!!! 8시간 뒤가 기대되는군요 ⏰ 설레서 잠을 못 이루겠네요.. 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. 하하핳... 그냥 토픽 카드에서 이미지 지운 버전이라.. |
||
pinId, | ||
pinTitle, | ||
pinAddress, | ||
pinDescription, | ||
}: PinCardProps) => { | ||
const { routePage } = useNavigator(); | ||
|
||
return ( | ||
<Wrapper> | ||
<Flex position="relative"> | ||
<Box width="192px" padding={1}> | ||
<Box height="52px"> | ||
<Text color="black" $fontSize="default" $fontWeight="bold"> | ||
{pinTitle} | ||
</Text> | ||
</Box> | ||
|
||
<Space size={0} /> | ||
|
||
<Text color="gray" $fontSize="small" $fontWeight="normal"> | ||
{pinAddress} | ||
</Text> | ||
|
||
<Space size={0} /> | ||
<Text color="gray" $fontSize="small" $fontWeight="normal"> | ||
{pinDescription} | ||
</Text> | ||
</Box> | ||
</Flex> | ||
</Wrapper> | ||
); | ||
}; | ||
|
||
const Wrapper = styled.li` | ||
width: 332px; | ||
height: 140px; | ||
cursor: pointer; | ||
border: 1px solid ${({ theme }) => theme.color.gray}; | ||
border-radius: ${({ theme }) => theme.radius.small}; | ||
|
||
margin: 0 auto; | ||
`; | ||
|
||
export default PinCard; |
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,9 +1,41 @@ | ||
import { useState } from 'react'; | ||
import { styled } from 'styled-components'; | ||
import Box from '../components/common/Box'; | ||
import Flex from '../components/common/Flex'; | ||
import Space from '../components/common/Space'; | ||
import MyInfo from '../components/MyInfo'; | ||
import MyInfoContainer from '../components/MyInfoContainer'; | ||
import useNavigator from '../hooks/useNavigator'; | ||
import useSetNavbarHighlight from '../hooks/useSetNavbarHighlight'; | ||
|
||
const Profile = () => { | ||
const { navbarHighlights: _ } = useSetNavbarHighlight('profile'); | ||
const { routePage } = useNavigator(); | ||
const { navbarHighlights: __ } = useSetNavbarHighlight('profile'); | ||
|
||
return <div>profile</div>; | ||
const goToPopularTopics = () => { | ||
routePage('/see-all/popularity'); | ||
}; | ||
|
||
return ( | ||
<ProfileWrapper> | ||
<MyInfoWrapper $justifyContent="center" $alignItems="center"> | ||
<MyInfo /> | ||
</MyInfoWrapper> | ||
<Space size={6} /> | ||
<MyInfoContainer | ||
containerTitle="나의 지도" | ||
containerDescription="내가 만든 지도를 확인해보세요" | ||
/> | ||
</ProfileWrapper> | ||
); | ||
}; | ||
|
||
const ProfileWrapper = styled(Box)` | ||
width: 70vw; | ||
margin: 0 auto; | ||
`; | ||
|
||
const MyInfoWrapper = styled(Flex)` | ||
margin-top: ${({ theme }) => theme.spacing[6]}; | ||
`; | ||
export default Profile; |
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
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.
우하핳 😆