Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions app/blog/[id]/blog-post-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
import BlogPostHeader from '@/app/(shared)/components/blog-post-header';
import BlogPostMeta from '@/app/(shared)/components/blog-post-meta';
import BlogPostRenderer from '@/app/(shared)/components/blog-post-renderer';
import BlogPostTOC from '@/app/(shared)/components/blog-post-toc';
import { BlogPostContentProps } from '@/app/(shared)/types/blog-post';

// 상대 경로 임포트
import { calculateReadingTime, generateTableOfContents } from './utils';
import { calculateReadingTime } from './utils';

// 서버 컴포넌트로 블로그 포스트 내용 렌더링
export default async function BlogPostContent({ post }: BlogPostContentProps) {
Expand All @@ -21,17 +20,6 @@ export default async function BlogPostContent({ post }: BlogPostContentProps) {

const readingTime = await getReadingTime();

// 목차 생성
const getTableOfContents = async () => {
if (post.markdownContent) {
const content = await post.markdownContent;
return generateTableOfContents(content);
}
return [];
};

const tableOfContents = await getTableOfContents();

return (
<div className="max-w-6xl mx-auto bg-white rounded-2xl my-8 shadow-light flex flex-col">
{/* 헤더 */}
Expand All @@ -44,9 +32,6 @@ export default async function BlogPostContent({ post }: BlogPostContentProps) {

{/* 콘텐츠 렌더링 */}
<BlogPostRenderer post={post} />

{/* 목차 */}
<BlogPostTOC tableOfContents={tableOfContents} />
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion app/match/trading/TradingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default function TradingPage() {
const router = useRouter();
const { partner, setUserRole, userRole, updatePartner } = useMatchStore();
const [currentStep, setCurrentStep] = useState<TradingStep>('confirmation');
const [timeLeft, setTimeLeft] = useState(3000); // 5분 제한
const [timeLeft, setTimeLeft] = useState(600); // 10분 제한

Choose a reason for hiding this comment

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

medium

거래 제한 시간을 10분으로 변경하신 부분은 좋습니다. 다만, 600이라는 값은 '매직 넘버'로 사용되어 코드의 가독성을 저해할 수 있습니다. 의미 있는 이름의 상수로 추출하여 사용하는 것을 권장합니다. 예를 들어, 컴포넌트 외부에 다음과 같이 상수를 정의하고1, useState에서 이 상수를 사용하면 코드의 의도가 명확해집니다.

const TRADING_TIME_LIMIT_SECONDS = 600; // 10분
const [timeLeft, setTimeLeft] = useState(TRADING_TIME_LIMIT_SECONDS);

Style Guide References

Footnotes

  1. 상수는 UPPER_SNAKE_CASE를 사용합니다. (link)

const [isValidPartner, setIsValidPartner] = useState(false);

// TradingPage 진입 시 matchPageRefreshed 세션스토리지 아이템을 false로 설정
Expand Down