Skip to content

Commit

Permalink
Fix: series isLile 설정, series일 때 memo header 안보이게 하기
Browse files Browse the repository at this point in the history
  • Loading branch information
dongree committed Oct 16, 2023
1 parent b8345c9 commit ea69271
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/app/series/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default async function SeriesDetailPage({ params: { slug } }: Props) {
const { memoInfoList, likes, title } = await getSeriesById(seriesId);

const memoData = getMemoById(memoInfoList[0].id, cookie);
const likeData = getIsLike('memos', memoInfoList[0].id, cookie);
const likeData = getIsLike('series', seriesId, cookie);
const commentData = getCommentsByPostTypeAndPostId(
'memo',
memoInfoList[0].id,
Expand Down
24 changes: 16 additions & 8 deletions src/components/memo/MemoViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type Props = {
isLike: boolean;
isMyMemo: boolean;
createdDate: string;
type?: 'memo' | 'series';
};

export default function MemoViewer({
Expand All @@ -28,6 +29,7 @@ export default function MemoViewer({
isLike,
isMyMemo,
createdDate,
type = 'memo',
}: Props) {
return (
<section
Expand All @@ -44,14 +46,20 @@ export default function MemoViewer({
}[color]
} `}
>
<MemoViewerHeader
memoId={memoId}
likes={likes}
isLike={isLike}
isMyMemo={isMyMemo}
createdDate={createdDate}
/>
<h1 className={`text-2xl sm:text-4xl font-bold py-2 px-4 break-all`}>
{type === 'memo' && (
<MemoViewerHeader
memoId={memoId}
likes={likes}
isLike={isLike}
isMyMemo={isMyMemo}
createdDate={createdDate}
/>
)}
<h1
className={`text-2xl sm:text-4xl font-bold py-2 px-4 break-all ${
type === 'series' && 'pt-8'
}`}
>
{title}
</h1>
<div className="h-[0.5px] mx-3 my-4 bg-soma-grey-49"></div>
Expand Down
9 changes: 3 additions & 6 deletions src/components/series/SeriesDetailContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export default function SeriesDetailContainer({
}: Props) {
const [currentIdx, setCurrentIdx] = useState<number>(0);
const [currentMemo, setCurrentMemo] = useState<Memo>(memo);
const [currentMemoIsLike, setCurrentMemoIsLike] = useState<boolean>(isLike);
const [currentComments, setCurrentComments] = useState<Comment[]>(comments);
const [currentQuestions, setCurrentQuestions] =
useState<Question[]>(questions);
Expand All @@ -69,9 +68,6 @@ export default function SeriesDetailContainer({
getMemoById(memoInfoList[currentIdx].id).then((memo) => {
setCurrentMemo(memo);
});
getIsLike('memos', memoInfoList[currentIdx].id).then((likedata) =>
setCurrentMemoIsLike(likedata.isLike)
);
getCommentsByPostTypeAndPostId('memo', memoInfoList[currentIdx].id).then(
(comments) => setCurrentComments(comments)
);
Expand Down Expand Up @@ -103,7 +99,7 @@ export default function SeriesDetailContainer({
<LikeBox
likeNum={seriesLikeNum}
postId={seriesId}
isLike={false}
isLike={isLike}
postType="series"
iconSize={20}
/>
Expand Down Expand Up @@ -168,9 +164,10 @@ export default function SeriesDetailContainer({
memoTags={currentMemo.memoTags}
memoId={currentMemo.memoId}
likes={currentMemo.likes}
isLike={currentMemoIsLike}
isLike={false}
isMyMemo={isMine}
createdDate={currentMemo.createdDate}
type="series"
/>
<MemoSideBar
authorName={authorName}
Expand Down

0 comments on commit ea69271

Please sign in to comment.