Skip to content

Commit

Permalink
Fix: 메모에서 시리즈 정보 볼 수 있게 하기
Browse files Browse the repository at this point in the history
  • Loading branch information
dongree committed Oct 18, 2023
1 parent dc2b0a7 commit cd9e243
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/app/memos/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { getIsLike } from '@/service/like';
import { ACCESS_TOKEN, REFRESH_TOKEN } from '@/utils/const';
import { checkUser, getUserInfo } from '@/service/auth';
import { getQuestionsByMemoId } from '@/service/questions';
import { getFollowers, getFollowings } from '@/service/follow';

type Props = {
params: {
Expand Down Expand Up @@ -42,6 +41,7 @@ export default async function MemoPage({ params: { slug } }: Props) {
isMine,
createdDate,
seriesId,
seriesTitle,
},
{ isLike },
comments,
Expand Down Expand Up @@ -84,6 +84,7 @@ export default async function MemoPage({ params: { slug } }: Props) {
isMyMemo={isMine}
createdDate={createdDate}
seriesId={seriesId}
seriesTitle={seriesTitle}
/>
<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 @@ -18,6 +18,7 @@ type Props = {
createdDate: string;
type?: 'memo' | 'series';
seriesId: number;
seriesTitle: string;
};

export default function MemoViewer({
Expand All @@ -32,6 +33,7 @@ export default function MemoViewer({
createdDate,
type = 'memo',
seriesId,
seriesTitle,
}: Props) {
return (
<section
Expand All @@ -56,6 +58,7 @@ export default function MemoViewer({
isMyMemo={isMyMemo}
createdDate={createdDate}
seriesId={seriesId}
seriesTitle={seriesTitle}
/>
)}
<h1
Expand Down
15 changes: 15 additions & 0 deletions src/components/memo/MemoViewerHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ModalContext } from '@/context/ModalProvider';
import LikeBox from '../shared/LikeBox';
import { extractYMDHM } from '@/service/time';
import { notifyToast } from '@/service/notification';
import Link from 'next/link';

type Props = {
memoId: number;
Expand All @@ -16,6 +17,7 @@ type Props = {
isMyMemo: boolean;
createdDate: string;
seriesId: number;
seriesTitle: string;
};

export default function MemoViewerHeader({
Expand All @@ -25,6 +27,7 @@ export default function MemoViewerHeader({
isMyMemo,
createdDate,
seriesId,
seriesTitle,
}: Props) {
const dropdownRef = useRef<HTMLElement>(null);
const [isActive, setIsActive] = useDetectOutsideClick(dropdownRef, false);
Expand All @@ -48,6 +51,18 @@ export default function MemoViewerHeader({
{extractYMDHM(createdDate)}
</div>
<nav className="relative flex items-center pl-5" ref={dropdownRef}>
{seriesId && (
<div className="text-xs mx-4 text-soma-grey-70">
{`🔗 Series `}
<Link
href={`/series/${seriesId}`}
className="text-soma-blue-40 font-extrabold underline "
>
{seriesTitle}
</Link>
에 속한 메모
</div>
)}
<LikeBox
likeNum={likes}
postId={memoId}
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 @@ -184,6 +184,7 @@ export default function SeriesDetailContainer({
createdDate={currentMemo.createdDate}
type="series"
seriesId={seriesId}
seriesTitle={seriesTitle}
/>
<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 @@ -20,6 +20,7 @@ export type Memo = {
seriesId: number;
isCreated: boolean;
authorRank: Rank;
seriesTitle: string;
};

export type PostMemoData = {
Expand Down

0 comments on commit cd9e243

Please sign in to comment.