-
Notifications
You must be signed in to change notification settings - Fork 0
활동기록 구현 (#issue 261) #264
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
활동기록 구현 (#issue 261) #264
Changes from all commits
3674231
ec49b2f
e68aaed
68ef2e0
0808209
3e4632c
f8a38d2
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,24 @@ | ||
| import type { ApiMyComments, ApiMyInquiries } from './../models/activityLog'; | ||
| import { httpClient } from './http.api'; | ||
|
|
||
| export const getMyComments = async () => { | ||
| try { | ||
| const response = await httpClient.get<ApiMyComments>(`user/my-comments`); | ||
|
|
||
| return response.data.data; | ||
| } catch (e) { | ||
| console.error('내 댓글 에러', e); | ||
| throw e; | ||
| } | ||
| }; | ||
|
|
||
| export const getMyInquiries = async () => { | ||
| try { | ||
| const response = await httpClient.get<ApiMyInquiries>(`user/my-inquiries`); | ||
|
|
||
| return response.data.data; | ||
| } catch (e) { | ||
| console.error('내 문의글 에러 ', e); | ||
| throw e; | ||
| } | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,37 @@ | ||
| import { Fragment } from 'react/jsx-runtime'; | ||
| import { useGetMyComments } from '../../../../hooks/useGetMyComments'; | ||
| import NoContent from '../../../common/noContent/NoContent'; | ||
| import Spinner from '../../Spinner'; | ||
| import CommentActivity from './commentActivity/CommentActivity'; | ||
| import * as S from './CommentsActivity.styled'; | ||
|
|
||
| export default function CommentsActivity() { | ||
| return ( | ||
| <S.container> | ||
| const { myCommentsData, isLoading } = useGetMyComments(); | ||
|
|
||
| if (isLoading) { | ||
| return <Spinner size='50px' color='#3e5879;' />; | ||
| } | ||
|
|
||
| if (!myCommentsData || myCommentsData.length === 0) { | ||
| return ( | ||
| <S.WrapperNoContent> | ||
| <NoContent type='comment' /> | ||
| </S.WrapperNoContent> | ||
| </S.container> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <S.Container> | ||
| <S.CommentsWrapper> | ||
| {myCommentsData.map((list, idx: number) => ( | ||
| <Fragment key={list.id}> | ||
| <CommentActivity list={list} /> | ||
| {idx !== myCommentsData.length - 1 && ( | ||
| <S.CommentBorder></S.CommentBorder> | ||
| )} | ||
| </Fragment> | ||
| ))} | ||
| </S.CommentsWrapper> | ||
| </S.Container> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import styled from 'styled-components'; | ||
|
|
||
| export const CommentContent = styled.div``; | ||
|
|
||
| export const CommentDate = styled.div` | ||
| font-size: 0.8rem; | ||
| color: ${({ theme }) => theme.color.placeholder}; | ||
| `; | ||
|
|
||
| export const CommentProject = styled.div` | ||
| font-size: 0.9rem; | ||
| `; |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,18 @@ | ||||||||||||||||||||||||||||||||||||||||||
| import { Link } from 'react-router-dom'; | ||||||||||||||||||||||||||||||||||||||||||
| import type { MyComments } from '../../../../../models/activityLog'; | ||||||||||||||||||||||||||||||||||||||||||
| import * as S from './CommentActivity.styled'; | ||||||||||||||||||||||||||||||||||||||||||
| import { formatDate } from '../../../../../util/formatDate'; | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| interface CommentActivityProps { | ||||||||||||||||||||||||||||||||||||||||||
| list: MyComments; | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| export default function CommentActivity({ list }: CommentActivityProps) { | ||||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||||
| <Link to={`/project-detail/${list.projectId}`}> | ||||||||||||||||||||||||||||||||||||||||||
| <S.CommentContent>{list.content}</S.CommentContent> | ||||||||||||||||||||||||||||||||||||||||||
| <S.CommentDate>{formatDate(list.createdAt)}</S.CommentDate> | ||||||||||||||||||||||||||||||||||||||||||
| <S.CommentProject>{list.projectTitle}</S.CommentProject> | ||||||||||||||||||||||||||||||||||||||||||
| </Link> | ||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+10
to
+18
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. 🛠️ Refactor suggestion CommentWrapper 스타일 컴포넌트가 사용되지 않았습니다.
export default function CommentActivity({ list }: CommentActivityProps) {
return (
- <Link to={`/project-detail/${list.projectId}`}>
+ <S.CommentWrapper>
+ <Link to={`/project-detail/${list.projectId}`}>
<S.CommentContent>{list.content}</S.CommentContent>
<S.CommentDate>{formatDate(list.createdAt)}</S.CommentDate>
<S.CommentProject>{list.projectTitle}</S.CommentProject>
- </Link>
+ </Link>
+ </S.CommentWrapper>
);
}📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,42 @@ | ||
| import { useGetMyInquiries } from '../../../../hooks/useGetMyInquiries'; | ||
| import NoContent from '../../../common/noContent/NoContent'; | ||
| import Spinner from '../../Spinner'; | ||
| import * as S from './Inquiries.styled'; | ||
| import Inquiry from './inquiry/Inquiry'; | ||
|
|
||
| export default function Inquiries() { | ||
| return ( | ||
| <S.container> | ||
| const { myInquiriesData, isLoading } = useGetMyInquiries(); | ||
|
|
||
| if (isLoading) { | ||
| return <Spinner size='50px' color='#3e5879;' />; | ||
| } | ||
|
|
||
| if (!myInquiriesData || myInquiriesData?.length === 0) | ||
| return ( | ||
| <S.WrapperNoContent> | ||
| <NoContent type='inquiries' /> | ||
| </S.WrapperNoContent> | ||
| ); | ||
|
|
||
| return ( | ||
| <S.container> | ||
| <S.InquiriesContainer> | ||
| <S.InquiriesTableHeadWrapper> | ||
| <S.InquiriesTableHeaderNo>No</S.InquiriesTableHeaderNo> | ||
| <S.InquiriesTableHeaderCategory>구별</S.InquiriesTableHeaderCategory> | ||
| <S.InquiriesTableHeaderTitle>제목</S.InquiriesTableHeaderTitle> | ||
| <S.InquiriesTableHeaderState>상태</S.InquiriesTableHeaderState> | ||
| </S.InquiriesTableHeadWrapper> | ||
| <S.InquiriesWrapper> | ||
| {myInquiriesData.map((list, index) => ( | ||
| <Inquiry | ||
| key={`${index}-${list.title}`} | ||
| list={list} | ||
| no={myInquiriesData.length - index} | ||
| /> | ||
| ))} | ||
| </S.InquiriesWrapper> | ||
| </S.InquiriesContainer> | ||
| </S.container> | ||
| ); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| import styled from 'styled-components'; | ||
|
|
||
| export const Container = styled.div` | ||
| width: 100%; | ||
| font-size: 1.1rem; | ||
| `; | ||
|
|
||
| export const InquiryTitleWrapper = styled.div` | ||
| display: grid; | ||
| grid-template-columns: 8% 18% 62% 12%; | ||
| cursor: pointer; | ||
| `; | ||
|
|
||
| export const InquiryNumber = styled.div` | ||
| text-align: center; | ||
| `; | ||
|
|
||
| export const InquiryCategory = styled.div``; | ||
|
|
||
| export const InquiryTitle = styled.div``; | ||
|
|
||
| export const InquiryState = styled.div` | ||
| text-align: center; | ||
| `; | ||
|
|
||
| export const InquiryContentWrapper = styled.div` | ||
| margin: 0.5rem 0; | ||
| background: ${({ theme }) => theme.color.white}; | ||
| padding: 1rem; | ||
| `; | ||
|
|
||
| export const InquiryContent = styled.div``; | ||
|
|
||
| export const InquiryImgWrapper = styled.div` | ||
| margin-top: 1rem; | ||
| cursor: pointer; | ||
| `; | ||
|
|
||
| export const InquiryModalImgWrapper = styled.div` | ||
| display: flex; | ||
| `; | ||
|
|
||
| export const InquiryImg = styled.img` | ||
| width: 5rem; | ||
| `; | ||
|
|
||
| export const ModalImgContainer = styled.div` | ||
| position: fixed; | ||
| top: 0; | ||
| left: 0; | ||
| right: 0; | ||
| bottom: 0; | ||
| width: 100vw; | ||
| height: 100vh; | ||
| z-index: 10; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| background: rgba(0, 0, 0, 0.7); | ||
| `; | ||
|
|
||
| export const ModalImgWrapper = styled.div` | ||
| margin-top: 1rem; | ||
| cursor: pointer; | ||
| background: ${({ theme }) => theme.color.white}; | ||
| border: 1px solid ${({ theme }) => theme.color.navy}; | ||
| display: flex; | ||
| flex-direction: column; | ||
| justify-content: center; | ||
| align-items: center; | ||
| width: fit-content; | ||
| `; | ||
|
|
||
| export const ModalImgButtonWrapper = styled.div` | ||
| width: 100%; | ||
| color: ${({ theme }) => theme.color.white}; | ||
| font-size: 0.8rem; | ||
| background: ${({ theme }) => theme.color.navy}; | ||
| padding: 0.2rem; | ||
| `; | ||
|
|
||
| export const ModalImg = styled.img``; |
Uh oh!
There was an error while loading. Please reload this page.