Skip to content

Commit

Permalink
Fix: series에 속한 메모 삭제할 때 처리
Browse files Browse the repository at this point in the history
  • Loading branch information
dongree committed Oct 17, 2023
1 parent 350af72 commit 27f9d7b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/app/memos/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export default async function MemoPage({ params: { slug } }: Props) {
memoTags,
isMine,
createdDate,
seriesId,
},
{ isLike },
comments,
Expand Down Expand Up @@ -82,6 +83,7 @@ export default async function MemoPage({ params: { slug } }: Props) {
isLike={isLike}
isMyMemo={isMine}
createdDate={createdDate}
seriesId={seriesId}
/>
<MemoSideBar
authorName={authorName}
Expand Down
3 changes: 3 additions & 0 deletions src/components/memo/MemoViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type Props = {
isMyMemo: boolean;
createdDate: string;
type?: 'memo' | 'series';
seriesId: number;
};

export default function MemoViewer({
Expand All @@ -30,6 +31,7 @@ export default function MemoViewer({
isMyMemo,
createdDate,
type = 'memo',
seriesId,
}: Props) {
return (
<section
Expand All @@ -53,6 +55,7 @@ export default function MemoViewer({
isLike={isLike}
isMyMemo={isMyMemo}
createdDate={createdDate}
seriesId={seriesId}
/>
)}
<h1
Expand Down
13 changes: 10 additions & 3 deletions src/components/memo/MemoViewerHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type Props = {
isLike: boolean;
isMyMemo: boolean;
createdDate: string;
seriesId: number;
};

export default function MemoViewerHeader({
Expand All @@ -23,6 +24,7 @@ export default function MemoViewerHeader({
isLike,
isMyMemo,
createdDate,
seriesId,
}: Props) {
const dropdownRef = useRef<HTMLElement>(null);
const [isActive, setIsActive] = useDetectOutsideClick(dropdownRef, false);
Expand Down Expand Up @@ -77,9 +79,14 @@ export default function MemoViewerHeader({
className="hover:bg-gray-200 p-2 rounded-b-lg"
onClick={() => {
setIsActive(false);
open('메모를 삭제하시겠습니까?', () => {
handleDelete();
});
open(
seriesId
? '시리즈에 속한 메모입니다. 메모륵 삭제하시겠습니까?'
: '메모를 삭제하시겠습니까?',
() => {
handleDelete();
}
);
}}
>
삭제하기
Expand Down
1 change: 1 addition & 0 deletions src/components/series/SeriesDetailContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ export default function SeriesDetailContainer({
isMyMemo={isMine}
createdDate={currentMemo.createdDate}
type="series"
seriesId={seriesId}
/>
<MemoSideBar
authorName={authorName}
Expand Down
1 change: 1 addition & 0 deletions src/types/memo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export type Memo = {
memoTags: string[];
isTemporary: boolean;
isMine: boolean;
seriesId: number;
};

export type PostMemoData = {
Expand Down

0 comments on commit 27f9d7b

Please sign in to comment.