Skip to content
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

🚨 Fix: μ•Œλ¦Ό 생성 전달 였λ₯˜ ν•΄κ²° #128

Merged
merged 8 commits into from
Sep 26, 2023
1 change: 1 addition & 0 deletions src/pages/notice/Notice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const Notice = () => {
}}
/>
</Header>
{list.length < 1 && <div>μ•Œλ¦Όμ΄ μ—†μŠ΅λ‹ˆλ‹€.</div>}
<NoticeList list={list} />
</NoticePage>
);
Expand Down
3 changes: 3 additions & 0 deletions src/pages/notice/components/NoticeItem/NoticeItem.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const NoticeItemContainer = styled.div`
justify-content: flex-start;
padding: 10px;
border-bottom: 0.5px solid ${({ theme }) => theme.color['greyLight']};
line-height: 1.5;
margin-bottom: 10px;
`;

Expand All @@ -22,6 +23,8 @@ const NoticeContent = styled.div`
`;

const Message = styled.div`
display: flex;
align-items: center;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

theme.style.flexAlignCenterλ₯Ό μ‚¬μš©ν•  μˆ˜λ„ μžˆμŠ΅λ‹ˆλ‹€!

font-weight: 700;
font-size: 0.8rem;
color: ${({ theme }) => theme.color['black']};
Expand Down
5 changes: 1 addition & 4 deletions src/pages/notice/components/NoticeItem/NoticeItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@ const NoticeItem = ({
/>
</ProfileImage>
<NoticeContent>
<Message>
<span>{authorName}</span>
{typeToMessage(type)}
</Message>
<Message>{typeToMessage(type)}</Message>
{type === NOTICE_TYPE.COMMENT && (
<MessagePreview>
{comment && comment.comment.length > 25
Expand Down
2 changes: 1 addition & 1 deletion src/pages/notice/components/NoticeList/NoticeList.style.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import styled from '@emotion/styled';

const NoticeListContainer = styled.div`
height: calc(100% - 1.5rem);
height: calc(100% - 2rem);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저희 rem은 μ‚¬μš©ν•˜μ§€ μ•ŠκΈ°λ‘œ ν–ˆμŠ΅λ‹ˆλ‹€! px둜 λ°”κΏ”μ£Όμ‹œλ©΄ 쒋을것 κ°™μ•„μš”!

overflow-y: scroll;
`;

Expand Down
2 changes: 2 additions & 0 deletions src/pages/postDetail/PostDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const PostDetail = () => {
createdAt={formatDate(data?.createdAt)}
/>
<PostCommentInput
userId={data?.author._id}
postId={postId}
token={'Bearer ' + token}
avatarSrc={image}
Expand All @@ -48,6 +49,7 @@ const PostDetail = () => {
}}
/>
<PostComments
userId={data?.author._id}
postId={postId}
currentUserId={_id}
token={'Bearer ' + token}
Expand Down
15 changes: 9 additions & 6 deletions src/pages/postDetail/components/PostCommentHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ interface PostCommentHeaderProps {
refetch: () => void;
myLike: Like;
postCommentCount: number;
userId?: string;
}

const PostCommentHeader = ({
Expand All @@ -25,6 +26,7 @@ const PostCommentHeader = ({
refetch,
myLike,
likeCounts,
userId,
postCommentCount = 0
}: PostCommentHeaderProps) => {
const [possibleMutateLike, setPossibleMutateLike] = useState(true);
Expand All @@ -34,12 +36,13 @@ const PostCommentHeader = ({
},
{
onSuccess: (res) => {
postNotifications(token, {
notificationType: 'LIKE',
notificationTypeId: res._id,
userId: res.user,
postId: res.post
});
!myLike &&
postNotifications(token, {
notificationType: 'LIKE',
notificationTypeId: res._id,
userId: userId,
postId: res.post
});
}
}
);
Expand Down
4 changes: 3 additions & 1 deletion src/pages/postDetail/components/PostCommentInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ interface PostCommentInputProps {
token: string;
avatarSrc: string;
userName: string;
userId?: string;
refetch: () => void;
}

Expand All @@ -27,6 +28,7 @@ const PostCommentInput = ({
userName,
token,
postId,
userId,
refetch
}: PostCommentInputProps) => {
const COMMENT_PLACEHOLDER = 'λŒ“κΈ€μ„ λ‹¬μ•„λ³΄μ„Έμš”.';
Expand All @@ -38,7 +40,7 @@ const PostCommentInput = ({
postNotifications(token, {
notificationType: 'COMMENT',
notificationTypeId: res._id,
userId: res.author._id,
userId: userId,
postId: res.post
});
}
Expand Down
5 changes: 4 additions & 1 deletion src/pages/postDetail/components/PostComments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ interface PostCommentsProps {
refetch: () => void;
myLike: Like;
likeCounts: number;
userId?: string;
}

const PostComments = ({
Expand All @@ -20,11 +21,13 @@ const PostComments = ({
refetch,
comments,
myLike,
likeCounts
likeCounts,
userId
}: PostCommentsProps) => {
return (
<PostCommentsSection>
<PostCommentHeader
userId={userId}
postId={postId}
token={token}
refetch={refetch}
Expand Down