Skip to content

Commit

Permalink
피드홈/피드상세/모임상세/댓글/대댓글 차단된 컨텐츠 UI + API 연결 (#867)
Browse files Browse the repository at this point in the history
* test

* feat: ContentBlocker 컴포넌트 구현

* feat: 피드 홈 적용 (API 연결 X)

* feat: 피드 상세 적용 (API 연결 X)

* feat: 모임 상세 적용 (API 연결 X)

* docs: 불필요한 코드 삭제

* feat: 피드 상세 적용 추가

* docs: 폴더 이름 변경

* feat: 댓글/답글 적용 (API 연결 X)

* feat: ContentBlocker API 연결

* feat: CommentBlocker API 연결

* fix: isBlockedPost 로 수정

* fix: build 에러 수정

---------

Co-authored-by: borimong <[email protected]>
  • Loading branch information
j-nary and borimong authored Sep 23, 2024
1 parent 8afdd02 commit 24bf61a
Show file tree
Hide file tree
Showing 9 changed files with 621 additions and 488 deletions.
309 changes: 162 additions & 147 deletions pages/post/index.tsx

Large diffs are not rendered by default.

29 changes: 15 additions & 14 deletions src/__generated__/schema2.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions src/components/blocker/CommentBlocker.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { styled } from 'stitches.config';
import RecommentPointIcon from '@assets/svg/recomment_point_icon.svg';

interface CommentBlockerProps {
variant?: 'default' | 'secondary';
}
const CommentBlocker = ({ variant = 'default' }: CommentBlockerProps) => {
return (
<Container variant={variant}>
{variant == 'secondary' && <RecommentPointIcon style={{ marginRight: '12px' }} />}
<BlockerMessage>차단된 멤버의 게시글입니다.</BlockerMessage>
</Container>
);
};

export default CommentBlocker;

const Container = styled('div', {
display: 'flex',
variants: {
variant: {
default: {
paddingLeft: '$40',
},
secondary: {
paddingLeft: '$16',
'@tablet': {
paddingLeft: '$12',
},
},
},
},
});

const BlockerMessage = styled('p', {
fontAg: '16_medium_150',
color: '$gray500',

'@tablet': {
fontAg: '14_medium_100',
},
});
36 changes: 36 additions & 0 deletions src/components/blocker/ContentBlocker.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { styled } from 'stitches.config';

const ContentBlocker = () => {
return (
<Container>
<BlockerMessage>차단된 멤버의 게시글입니다.</BlockerMessage>
</Container>
);
};

export default ContentBlocker;

const Container = styled('div', {
display: 'flex',
justifyContent: 'center',
alignItems: 'center',

padding: '$20 $20 $28 $20',
height: '180px',
width: '380px',

background: '$gray900',
borderRadius: '12px',

'@tablet': {
padding: '$24 0 $28 0',
background: 'transparent',
borderRadius: 0,
margin: '0 auto',
},
});

const BlockerMessage = styled('p', {
fontAg: '14_semibold_100',
color: '$gray500',
});
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import ReWriteIcon from '@assets/svg/comment-write.svg';
import TrashIcon from '@assets/svg/trash.svg';
import AlertIcon from '@assets/svg/alert-triangle.svg';
import { useToast } from '@sopt-makers/ui';
import CommentBlocker from '@components/blocker/CommentBlocker';

interface FeedCommentContainerProps {
comment: paths['/comment/v2']['get']['responses']['200']['content']['application/json;charset=UTF-8']['comments'][number];
isMine: boolean;
Expand Down Expand Up @@ -83,6 +85,8 @@ export default function FeedCommentContainer({ comment, isMine, postUserId, onCl
<>
{comment.user.id === null ? (
<div style={{ color: colors.gray500 }}>{comment.contents}</div>
) : comment.isBlockedComment ? (
<CommentBlocker />
) : (
<FeedCommentViewer
key={comment.id}
Expand Down Expand Up @@ -174,7 +178,9 @@ export default function FeedCommentContainer({ comment, isMine, postUserId, onCl
) : (
<>
{comment?.replies?.map((reply: replyType) => {
return (
return reply.isBlockedComment ? (
<CommentBlocker variant="secondary" />
) : (
<FeedReCommentContainer
comment={comment}
reply={reply}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const Default: Story = {
isLiked: false,
isWriter: true,
order: 0,
isBlockedComment: false,
},
isMine: true,
Actions: ['수정', '삭제'],
Expand Down
55 changes: 31 additions & 24 deletions src/components/page/meetingDetail/Feed/FeedPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { styled } from 'stitches.config';
import EmptyView from './EmptyView';
import FeedItem from './FeedItem';
import MobileFeedListSkeleton from './Skeleton/MobileFeedListSkeleton';
import ContentBlocker from '@components/blocker/ContentBlocker';

interface FeedPanelProps {
isMember: boolean;
Expand Down Expand Up @@ -71,30 +72,36 @@ const FeedPanel = ({ isMember }: FeedPanelProps) => {
const renderedPosts = postsData?.pages.map(post => {
if (!post) return;
return (
<Link href={`/post?id=${post.id}`} key={post.id}>
<FeedItem
/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */
/* @ts-ignore */
post={post}
LikeButton={
<LikeButton isLiked={post.isLiked} likeCount={post.likeCount} onClickLike={handleLikeClick(post.id)} />
}
onClick={() =>
ampli.clickFeedCard({
feed_id: post.id,
feed_upload: post.updatedDate,
feed_title: post.title,
feed_image_total: post.images ? post.images.length : 0,
feed_comment_total: post.commentCount,
feed_like_total: post.likeCount,
group_id: Number(meetingId),
crew_status: meeting?.approved,
platform_type: isMobile ? 'MO' : 'PC',
location: router.pathname,
})
}
/>
</Link>
<>
{post.isBlockedPost ? (
<ContentBlocker />
) : (
<Link href={`/post?id=${post.id}`} key={post.id}>
<FeedItem
/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */
/* @ts-ignore */
post={post}
LikeButton={
<LikeButton isLiked={post.isLiked} likeCount={post.likeCount} onClickLike={handleLikeClick(post.id)} />
}
onClick={() =>
ampli.clickFeedCard({
feed_id: post.id,
feed_upload: post.updatedDate,
feed_title: post.title,
feed_image_total: post.images ? post.images.length : 0,
feed_comment_total: post.commentCount,
feed_like_total: post.likeCount,
group_id: Number(meetingId),
crew_status: meeting?.approved,
platform_type: isMobile ? 'MO' : 'PC',
location: router.pathname,
})
}
/>
</Link>
)}
</>
);
});

Expand Down
Loading

0 comments on commit 24bf61a

Please sign in to comment.