diff --git a/src/app/(route)/completes/[completeId]/page.tsx b/src/app/(route)/completes/[completeId]/page.tsx index 979be568..f6568cc3 100644 --- a/src/app/(route)/completes/[completeId]/page.tsx +++ b/src/app/(route)/completes/[completeId]/page.tsx @@ -15,7 +15,7 @@ export default async function CompletePage({ const { completeId } = await params; return ( - + diff --git a/src/app/(route)/todos/[todoId]/page.tsx b/src/app/(route)/todos/[todoId]/page.tsx index 8b4aaecf..873c1230 100644 --- a/src/app/(route)/todos/[todoId]/page.tsx +++ b/src/app/(route)/todos/[todoId]/page.tsx @@ -14,7 +14,7 @@ export default async function todoDetail({ const { todoId } = await params; return ( - + diff --git a/src/components/Complete/Comments/CommentInput.tsx b/src/components/Complete/Comments/CommentInput.tsx index 2caf9cb4..4bb59b24 100644 --- a/src/components/Complete/Comments/CommentInput.tsx +++ b/src/components/Complete/Comments/CommentInput.tsx @@ -1,11 +1,13 @@ 'use client'; import { useState } from 'react'; + import { useQueryClient } from '@tanstack/react-query'; import { FaArrowUp } from 'react-icons/fa6'; -import { GetCommentRequest } from '@/types/Comment'; -import { useCreateComment } from '@/hooks/apis/Comment/useCreateCommentQuery'; + import { QUERY_KEYS } from '@/constants/QueryKeys'; +import { useCreateComment } from '@/hooks/apis/Comment/useCreateCommentQuery'; +import { GetCommentRequest } from '@/types/Comment'; import { GetCompleteDetailResponse } from '@/types/Completes'; import { cn } from '@/utils/className'; @@ -55,7 +57,6 @@ export const CommentInput = (props: CommentInputProps) => { }, ); }, - onError: () => {}, }); }; @@ -70,7 +71,7 @@ export const CommentInput = (props: CommentInputProps) => { : 'text-custom-gray-100 cursor-not-allowed'; return ( -
+
{ const [isEditing, setIsEditing] = useState(false); const [editedContent, setEditedContent] = useState(comment.content); + const [isModalOpen, setIsModalOpen] = useState(false); const handleSave = () => { if (editedContent.trim() === '') return; @@ -49,20 +50,27 @@ export const CommentItem = (props: CommentItemProps) => { }; const handleDelete = () => { - if (confirm('정말로 이 댓글을 삭제하시겠습니까?')) { - deleteCommentMutation.mutate(comment.commentId); - } + setIsModalOpen(true); + }; + + const handleConfirmDelete = () => { + deleteCommentMutation.mutate(comment.commentId); + setIsModalOpen(false); + }; + + const handleCancelDelete = () => { + setIsModalOpen(false); }; return (
-
+
{

)}
+ +
); }; diff --git a/src/components/Complete/Comments/index.tsx b/src/components/Complete/Comments/index.tsx index d7e6a9be..dae637bd 100644 --- a/src/components/Complete/Comments/index.tsx +++ b/src/components/Complete/Comments/index.tsx @@ -2,9 +2,9 @@ import { useRouter } from 'next/navigation'; -import { FollowsSkeleton } from '@/components/Skeletons/FollowsSkeleton'; import { useGetCompleteDetailQuery } from '@/hooks/apis/Complete/useGetCompleteDetailQuery'; +import { Spinner } from '@/components/common/Spinner'; import { CommentInput } from './CommentInput'; import { CommentList } from './CommentList'; @@ -27,7 +27,9 @@ export const CompleteComments = (props: CompleteCommentsProps) => { return (
{isLoading ? ( - + + + ) : complete ? (
diff --git a/src/components/Complete/Post/index.tsx b/src/components/Complete/Post/index.tsx index 1e173ddb..fbe7c968 100644 --- a/src/components/Complete/Post/index.tsx +++ b/src/components/Complete/Post/index.tsx @@ -6,7 +6,7 @@ import { PostContent } from '@/components/Follows/Post/PostContent'; import { PostImage } from '@/components/Follows/Post/PostImage'; import { PostLike } from '@/components/Follows/Post/PostLike'; import { PostProfile } from '@/components/Follows/Post/PostProfile'; -import { FollowsSkeleton } from '@/components/Skeletons/FollowsSkeleton'; +import { CompleteSkeleton } from '@/components/Skeletons/CompleteSkeleton'; import { useGetCompleteDetailQuery } from '@/hooks/apis/Complete/useGetCompleteDetailQuery'; import { PostGoalAndTodo } from './PostGoalAndTodo'; @@ -31,7 +31,7 @@ export const CompletePost = (props: CompletePostProps) => { return (
{isLoading ? ( - + ) : complete ? (
diff --git a/src/components/Follows/Post/PostComments.tsx b/src/components/Follows/Post/PostComments.tsx index cccd9b96..a74bf7d1 100644 --- a/src/components/Follows/Post/PostComments.tsx +++ b/src/components/Follows/Post/PostComments.tsx @@ -10,7 +10,7 @@ export function PostComments(props: PostCommentsProps) { return (
-
{commentCount}
+

{commentCount}

); } diff --git a/src/components/Follows/Post/PostLike.tsx b/src/components/Follows/Post/PostLike.tsx index 367f1b9a..f8adc1a4 100644 --- a/src/components/Follows/Post/PostLike.tsx +++ b/src/components/Follows/Post/PostLike.tsx @@ -1,5 +1,6 @@ -import { FaRegHeart, FaHeart } from 'react-icons/fa6'; import { motion } from 'motion/react'; +import { FaHeart, FaRegHeart } from 'react-icons/fa6'; + import { useCreateLike } from '@/hooks/apis/Likes/useCreateLikeQuery'; import { useDeleteLike } from '@/hooks/apis/Likes/useDeleteLikeQuery'; @@ -38,7 +39,7 @@ export function PostLike(props: PostLikeProps) { )} -
{likeCount}
+

{likeCount}

); } diff --git a/src/components/Follows/Post/PostProfile.tsx b/src/components/Follows/Post/PostProfile.tsx index 9c0fe11e..c3c3990d 100644 --- a/src/components/Follows/Post/PostProfile.tsx +++ b/src/components/Follows/Post/PostProfile.tsx @@ -1,7 +1,8 @@ 'use client'; -import { useRouter } from 'next/navigation'; import Image from 'next/image'; +import { useRouter } from 'next/navigation'; + import { formatDateToRelativeTime } from '@/utils/date'; interface PostProfileProps { @@ -31,7 +32,7 @@ export function PostProfile(props: PostProfileProps) { alt="profilePic" width={40} height={40} - className="max-h-40 max-w-40 rounded-full" + className="size-40 rounded-full" />
{username}
diff --git a/src/components/Sidebar/index.tsx b/src/components/Sidebar/index.tsx index 9d964fa4..1b5d4eec 100644 --- a/src/components/Sidebar/index.tsx +++ b/src/components/Sidebar/index.tsx @@ -65,7 +65,9 @@ export const Sidebar = () => { close(); }} > - {isOpen ? : } + + {isOpen ? : } +
{isOpen ? ( { + return ( +
+
+ +
+ +
+ +
+ + +
+ ); +}; diff --git a/src/components/common/PageContainer/index.tsx b/src/components/common/PageContainer/index.tsx index b5df81eb..fcc85d37 100644 --- a/src/components/common/PageContainer/index.tsx +++ b/src/components/common/PageContainer/index.tsx @@ -1,16 +1,23 @@ import { ReactNode } from 'react'; +import { cn } from '@/utils/className'; + interface PageContainerProps { children: ReactNode; className?: string; + header?: boolean; } -export const PageContainer = ({ children, className }: PageContainerProps) => { - return ( -
- {children} -
+export const PageContainer = ({ + children, + className, + header = true, +}: PageContainerProps) => { + const containerClass = cn( + 'flex h-screen w-screen flex-col gap-16 overflow-y-scroll bg-custom-white-100 px-16 scrollbar-hide', + className, + header ? 'pt-48 md:pt-16' : 'pt-16', ); + + return
{children}
; }; diff --git a/src/hooks/apis/Complete/useGetCompleteDetailQuery.ts b/src/hooks/apis/Complete/useGetCompleteDetailQuery.ts index 51d2290e..3c037c64 100644 --- a/src/hooks/apis/Complete/useGetCompleteDetailQuery.ts +++ b/src/hooks/apis/Complete/useGetCompleteDetailQuery.ts @@ -1,5 +1,6 @@ import { useQuery, UseQueryOptions } from '@tanstack/react-query'; import { AxiosError } from 'axios'; + import { GET } from '@/apis/services/httpMethod'; import { API_ENDPOINTS } from '@/constants/ApiEndpoints'; import { QUERY_KEYS } from '@/constants/QueryKeys'; @@ -8,7 +9,7 @@ import { GetCompleteDetailResponse } from '@/types/Completes'; const GetCompleteDetailOptions = ( completeId: number, ): UseQueryOptions => ({ - queryKey: [QUERY_KEYS.COMPLETE_DETAIL], + queryKey: [QUERY_KEYS.COMPLETE_DETAIL, completeId], queryFn: () => GET( API_ENDPOINTS.TODOS.GET_CERTIFIED_TODO(completeId), @@ -16,10 +17,8 @@ const GetCompleteDetailOptions = ( }); export const useGetCompleteDetailQuery = (completeId: number) => { - const { data, isLoading, error, isError } = useQuery( - GetCompleteDetailOptions(completeId), - ); + const { data, ...etc } = useQuery(GetCompleteDetailOptions(completeId)); const complete = data?.data; - return { complete, isLoading, error, isError }; + return { complete, ...etc }; }; diff --git a/src/mocks/TodoMockData.ts b/src/mocks/TodoMockData.ts deleted file mode 100644 index 4e0220ff..00000000 --- a/src/mocks/TodoMockData.ts +++ /dev/null @@ -1,32 +0,0 @@ -export const TODO_MOCK_DATA = [ - { - goalId: 1, - goalTitle: '토익 900점 맞기', - color: 'blue', - createdAt: new Date().toISOString(), - }, - { - goalId: 2, - goalTitle: '달리기 1등 하기', - color: 'green', - createdAt: new Date().toISOString(), - }, - { - goalId: 3, - goalTitle: '체중 10kg 감량', - color: 'red', - createdAt: new Date().toISOString(), - }, - { - goalId: 4, - goalTitle: '복근 만들기', - color: 'yellow', - createdAt: new Date().toISOString(), - }, - { - goalId: 5, - goalTitle: '복싱 배우기', - color: 'purple', - createdAt: new Date().toISOString(), - }, -];