+ {/* 메인 그리드 레이아웃 */}
+
+ {/* 왼쪽 컬럼: 메인 피드 */}
+
+ {/* 3일 스프린트 챌린지 */}
+
+
+
+
+ {/* 구분선 */}
+
+
+ {/* 포스트 입력 */}
+
+ {user ? (
+
+ ) : (
+
+ 로그인이 필요합니다.
+
+ )}
+
+
+ {/* 구분선 */}
+
+
+ {/* 필터 섹션 */}
+
+
+
+
+ {/* 포스트 리스트 */}
+
+
{
+ // TODO: 삭제 기능 구현
+ console.log("Delete post:", postId);
+ }}
+ />
+
+
-
-
-
+ {/* 오른쪽 컬럼: 사이드바 (1024px 이상에서만 표시) */}
+
diff --git a/fundamentals/today-i-learned/src/pages/newHome/components/FilterSection.tsx b/fundamentals/today-i-learned/src/pages/timeline/components/FilterSection.tsx
similarity index 100%
rename from fundamentals/today-i-learned/src/pages/newHome/components/FilterSection.tsx
rename to fundamentals/today-i-learned/src/pages/timeline/components/FilterSection.tsx
diff --git a/fundamentals/today-i-learned/src/pages/newHome/components/MonthlyChallenge.tsx b/fundamentals/today-i-learned/src/pages/timeline/components/MonthlyChallenge.tsx
similarity index 91%
rename from fundamentals/today-i-learned/src/pages/newHome/components/MonthlyChallenge.tsx
rename to fundamentals/today-i-learned/src/pages/timeline/components/MonthlyChallenge.tsx
index 528fadbc..178f1051 100644
--- a/fundamentals/today-i-learned/src/pages/newHome/components/MonthlyChallenge.tsx
+++ b/fundamentals/today-i-learned/src/pages/timeline/components/MonthlyChallenge.tsx
@@ -1,5 +1,5 @@
import { Card } from "@/components/shared/ui/Card";
-import { cn } from "@/lib/utils/cn";
+import { cn } from "@/libs/cn";
import type { MonthlyChallengeProps, ChallengeDay } from "../utils/types";
const MONTH_NAMES = [
@@ -17,12 +17,7 @@ const MONTH_NAMES = [
"12월"
];
-function ChallengeDayItem({
- day
-}: {
- day: ChallengeDay;
-}) {
-
+function ChallengeDayItem({ day }: { day: ChallengeDay }) {
const getDayStyle = () => {
switch (day.status) {
case "completed":
@@ -73,9 +68,7 @@ function ChallengeDayItem({
);
}
-export function MonthlyChallenge({
- challenge
-}: MonthlyChallengeProps) {
+export function MonthlyChallenge({ challenge }: MonthlyChallengeProps) {
const monthName = MONTH_NAMES[challenge.month - 1];
// 7x5 그리드로 배치 (주단위)
@@ -104,10 +97,7 @@ export function MonthlyChallenge({
className="grid grid-cols-7 gap-4 justify-items-center"
>
{week.map((day) => (
-
+
))}
{/* 빈 칸 채우기 (마지막 주가 7일 미만인 경우) */}
{week.length < 7 &&
diff --git a/fundamentals/today-i-learned/src/pages/newHome/components/NewHomeHeader.tsx b/fundamentals/today-i-learned/src/pages/timeline/components/NewHomeHeader.tsx
similarity index 100%
rename from fundamentals/today-i-learned/src/pages/newHome/components/NewHomeHeader.tsx
rename to fundamentals/today-i-learned/src/pages/timeline/components/NewHomeHeader.tsx
diff --git a/fundamentals/today-i-learned/src/pages/newHome/components/PostInput.tsx b/fundamentals/today-i-learned/src/pages/timeline/components/PostInput.tsx
similarity index 100%
rename from fundamentals/today-i-learned/src/pages/newHome/components/PostInput.tsx
rename to fundamentals/today-i-learned/src/pages/timeline/components/PostInput.tsx
diff --git a/fundamentals/today-i-learned/src/pages/timeline/components/PostList.tsx b/fundamentals/today-i-learned/src/pages/timeline/components/PostList.tsx
index 19fc7fbb..32e97fa8 100644
--- a/fundamentals/today-i-learned/src/pages/timeline/components/PostList.tsx
+++ b/fundamentals/today-i-learned/src/pages/timeline/components/PostList.tsx
@@ -1,7 +1,8 @@
import { useCallback } from "react";
-import { PostCard } from "@/components/features/discussions/LegacyPostCard";
-import { Button } from "@/components/shared/ui/Button";
-import { LoadingSpinner } from "@/components/shared/ui/LoadingSpinner";
+import {
+ PostCard,
+ PostCardSkeleton
+} from "../../../components/features/discussions/PostCard";
import { useInfiniteDiscussions } from "@/api/hooks/useDiscussions";
import { useIntersectionObserver } from "@/hooks/useIntersectionObserver";
@@ -13,6 +14,10 @@ interface PostListProps {
filterBy?: {
label?: string;
};
+ onLike: (postId: string) => void;
+ onComment: (postId: string) => void;
+ onUpvote: (postId: string) => void;
+ onDelete?: (postId: string) => void;
}
export function PostList({
@@ -20,17 +25,25 @@ export function PostList({
repo,
categoryName,
sortBy = "latest",
- filterBy
+ filterBy,
+ onLike,
+ onComment,
+ onUpvote,
+ onDelete
}: PostListProps) {
const {
- data,
+ data: postsData,
fetchNextPage,
hasNextPage,
isFetchingNextPage,
- isLoading,
- error,
- refetch
- } = useInfiniteDiscussions({ owner, repo, categoryName, sortBy, filterBy });
+ isLoading
+ } = useInfiniteDiscussions({
+ owner,
+ repo,
+ categoryName,
+ sortBy,
+ filterBy
+ });
const handleLoadMore = useCallback(() => {
if (hasNextPage && !isFetchingNextPage) {
@@ -44,70 +57,59 @@ export function PostList({
rootMargin: "300px"
});
- const handleComment = (id: string) => {
- // TODO: 댓글 페이지로 이동
- };
-
+ const discussions =
+ postsData?.pages.flatMap((page) => page.discussions) || [];
if (isLoading) {
return (
-
-
-
- );
- }
-
- if (error) {
- return (
-
-
- 게시물을 불러올 수 없습니다
-
-
{error.message}
-
refetch()} variant="default">
- 다시 시도
-
+
+ {[...new Array(3)].map((_, index) => (
+
+ ))}
);
}
- const allDiscussions = data?.pages.flatMap((page) => page.discussions) ?? [];
-
- if (allDiscussions.length === 0) {
+ if (discussions.length === 0) {
return (
-
-
- 아직 게시물이 없습니다
-
-
- 첫 번째 Today I Learned 게시물을 작성해보세요!
-
-
새 글 작성하기
+
+
+
+ 📝
+
+
+ 아직 포스트가 없습니다
+
+
+ 첫 번째 포스트를 작성해서 오늘 배운 내용을 공유해보세요!
+
+
);
}
return (
-
-
- {allDiscussions.map((discussion, index) => (
+
+ {discussions.map((discussion, index) => (
+
+
+ ))}
+ {/* Load more trigger */}
{hasNextPage && (
-
- {isFetchingNextPage && (
-
- )}
+
+ {isFetchingNextPage ?
: null}
)}
diff --git a/fundamentals/today-i-learned/src/pages/newHome/components/PostMoreMenu.tsx b/fundamentals/today-i-learned/src/pages/timeline/components/PostMoreMenu.tsx
similarity index 100%
rename from fundamentals/today-i-learned/src/pages/newHome/components/PostMoreMenu.tsx
rename to fundamentals/today-i-learned/src/pages/timeline/components/PostMoreMenu.tsx
diff --git a/fundamentals/today-i-learned/src/pages/newHome/components/SprintChallenge.tsx b/fundamentals/today-i-learned/src/pages/timeline/components/SprintChallenge.tsx
similarity index 100%
rename from fundamentals/today-i-learned/src/pages/newHome/components/SprintChallenge.tsx
rename to fundamentals/today-i-learned/src/pages/timeline/components/SprintChallenge.tsx
diff --git a/fundamentals/today-i-learned/src/pages/newHome/hooks/useWritePostModal.tsx b/fundamentals/today-i-learned/src/pages/timeline/hooks/useWritePostModal.tsx
similarity index 100%
rename from fundamentals/today-i-learned/src/pages/newHome/hooks/useWritePostModal.tsx
rename to fundamentals/today-i-learned/src/pages/timeline/hooks/useWritePostModal.tsx
diff --git a/fundamentals/today-i-learned/src/pages/newHome/utils/types.ts b/fundamentals/today-i-learned/src/pages/timeline/utils/types.ts
similarity index 100%
rename from fundamentals/today-i-learned/src/pages/newHome/utils/types.ts
rename to fundamentals/today-i-learned/src/pages/timeline/utils/types.ts