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
2 changes: 1 addition & 1 deletion next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const nextConfig: NextConfig = {
hostname: 'zzikzzik-bucket.s3.ap-northeast-2.amazonaws.com',
},
],
formats: ['image/avif', 'image/webp'], // AVIF μš°μ„  적용
formats: ['image/avif', 'image/webp'],
},
};

Expand Down
4 changes: 2 additions & 2 deletions src/app/(route)/dashboard/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Header } from '@/components/common/Header';
import { PageContainer } from '@/components/common/PageContainer';
import { Follwer } from '@/components/Dashboard/Follower';
import { Follower } from '@/components/Dashboard/Follower';
import { GoalList } from '@/components/Dashboard/GoalList';
import { MyProgress } from '@/components/Dashboard/MyProgress';
import { RecentTodos } from '@/components/Dashboard/RecentTodos';
Expand All @@ -10,7 +10,7 @@ export default function DashBoardPage() {
<>
<Header title="λŒ€μ‹œλ³΄λ“œ" />
<PageContainer>
<Follwer />
<Follower />
<RecentTodos />
<MyProgress />
<GoalList />
Expand Down
4 changes: 3 additions & 1 deletion src/app/(route)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { ReactNode } from 'react';

import { Sidebar } from '@/components/Sidebar';
import dynamic from 'next/dynamic';

const Sidebar = dynamic(() => import('@/components/Sidebar'));

export default function RootLayout({
children,
Expand Down
2 changes: 2 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export default function RootLayout({
name="google-site-verification"
content="z39r-2JIYzXYwS1QN_IVZHpSCp4wfM4qOvr5AVfSASc"
/>
<link rel="preconnect" href="https://solidtodo.shop" />
<link rel="dns-prefetch" href="https://solidtodo.shop" />
</head>
<body className={`${pretendard.variable} font-pretendard`}>
<QueryProvider>
Expand Down
5 changes: 4 additions & 1 deletion src/app/not-found.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
'use client';

import dynamic from 'next/dynamic';
import { useRouter } from 'next/navigation';

import LogoMain from '@/assets/svg/svg-logo-main.svg';
import { Button } from '@/components/common/Button/Button';
import { Header } from '@/components/common/Header';
import { PageContainer } from '@/components/common/PageContainer';
import { Sidebar } from '@/components/Sidebar';

const Sidebar = dynamic(() => import('@/components/Sidebar'));

export default function NotFound() {
const router = useRouter();
Expand Down
6 changes: 4 additions & 2 deletions src/components/Dashboard/Follower/FollowerStory/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import { formatDateToRelativeTime } from '@/utils/date';

interface FollowerStoryProps {
follower: ContentTypes;
priority: boolean;
}

export const FollowerStory = ({ follower }: FollowerStoryProps) => {
export const FollowerStory = ({ follower, priority }: FollowerStoryProps) => {
const router = useRouter();
const pic = follower.completePic;

Expand All @@ -26,7 +27,8 @@ export const FollowerStory = ({ follower }: FollowerStoryProps) => {
src={pic}
width={120}
height={120}
sizes="100vw"
sizes="120px"
priority={priority}
alt="νŒ”λ‘œμ›Œ 인증 사진"
className="size-120 rounded-20 object-cover"
/>
Expand Down
22 changes: 15 additions & 7 deletions src/components/Dashboard/Follower/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,36 @@ import { useGetFollowPosts } from '@/hooks/apis/Follows/useGetFollowPostsQuery';
import { useInfiniteScroll } from '@/hooks/useInfiniteScroll';
import { FollowerStory } from './FollowerStory';

export const Follwer = () => {
export const Follower = () => {
const { follows, isLoading, fetchNextPage, isFetchingNextPage } =
useGetFollowPosts();
const { observerRef } = useInfiniteScroll({ fetchNextPage, isLoading });

const hasFollowers = follows.length > 0;

return (
<DashboardItemContainer
title="νŒ”λ‘œμ›Œ ν˜„ν™©"
className="relative mb-22 mt-16"
>
{isLoading ? (
<FollowStorySkeleton />
) : follows.length === 0 ? (
{isLoading && <FollowStorySkeleton />}

{!isLoading && !hasFollowers && (
<Card>
<p className="text-sm-normal text-custom-gray-100">
찍찍이듀 νŒ”λ‘œμš° ν•˜κ³  인증 보기
</p>
</Card>
) : (
)}

{!isLoading && hasFollowers && (
<div className="flex snap-x snap-mandatory items-center gap-8 overflow-x-scroll scrollbar-hide">
{follows.map((follower) => (
<FollowerStory key={follower.completeId} follower={follower} />
{follows.map((follower, index) => (
<FollowerStory
key={follower.completeId}
follower={follower}
priority={index < 4}
/>
))}
{isFetchingNextPage && (
<span className="flex w-full justify-center">
Expand Down
24 changes: 14 additions & 10 deletions src/components/Dashboard/GoalList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,21 @@ export const GoalList = () => {
useTodosOfGoalsQuery();
const { observerRef } = useInfiniteScroll({ fetchNextPage, isLoading });

const hasGoals = goals.length > 0;

return (
<DashboardItemContainer title="λͺ©ν‘œ 별 ν•  일">
{isLoading ? (
<GoalListSkeleon />
) : goals.length > 0 ? (
{isLoading && <GoalListSkeleon />}

{!isLoading && !hasGoals && (
<div className="pb-16">
<Card>
<NoDataText text={NO_DATA_MESSAGES.NO_GOAL} />
</Card>
</div>
)}

{!isLoading && hasGoals && (
<div className="flex flex-col gap-16">
{goals.map((goal) => (
<GoalItem
Expand All @@ -32,18 +42,12 @@ export const GoalList = () => {
todos={goal.todos}
/>
))}
<div ref={observerRef} style={{ height: '1px' }} />
{isFetchingNextPage && (
<span className="flex w-full justify-center">
<Spinner className="size-18" />
</span>
)}
<div ref={observerRef} style={{ height: '1px' }} />
</div>
) : (
<div className="pb-16">
<Card>
<NoDataText text={NO_DATA_MESSAGES.NO_GOAL} />
</Card>
</div>
)}
</DashboardItemContainer>
Expand Down
22 changes: 15 additions & 7 deletions src/components/Dashboard/RecentTodos/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import { Button } from '@/components/common/Button/Button';
import { Card } from '@/components/common/Card';
import { NoDataText } from '@/components/common/NoDataText';

import { BasicTodoItem } from '@/components/TodosDetail/TodosDetailContent/TodoProfile/BasicTodoItem';
import { NO_DATA_MESSAGES } from '@/constants/Messages';
import { useRecentTodosQuery } from '@/hooks/apis/Dashboard/useRecnetTodosQuery';
import { useRecentTodosQuery } from '@/hooks/apis/Dashboard/useRecentTodosQuery';
import { useGoalsQuery } from '@/hooks/apis/useGoalsQuery';
import { useSidebarStore } from '@/store/useSidebarStore';
import { useTodoModalStore } from '@/store/useTodoModalStore';
import { BasicTodoItem } from '@/components/TodosDetail/TodosDetailContent/TodoProfile/BasicTodoItem';

export const RecentTodos = () => {
const { todos, isLoading } = useRecentTodosQuery();
Expand All @@ -24,6 +24,9 @@ export const RecentTodos = () => {
const { open: openModal } = useTodoModalStore();
const { open: openSidebar } = useSidebarStore();

const hasTodos = todos.length > 0;
const hasGoals = goals.length > 0;

return (
<DashboardItemContainer title="졜근 λ“±λ‘ν•œ 할일" className="relative">
<Link
Expand All @@ -32,23 +35,28 @@ export const RecentTodos = () => {
>
λͺ¨λ‘ 보기 <FaAngleRight className="ml-8" />
</Link>
{isLoading ? (
<TodoListSkeleton />
) : goals.length === 0 ? (

{isLoading && <TodoListSkeleton />}

{!isLoading && !hasGoals && (
<Card>
<NoDataText text={NO_DATA_MESSAGES.NO_TODO_AND_GOAL} />
<Button onClick={openSidebar} size="medium">
μƒˆ λͺ©ν‘œ 등둝
</Button>
</Card>
) : todos.length === 0 ? (
)}

{!isLoading && hasGoals && !hasTodos && (
<Card>
<NoDataText text={NO_DATA_MESSAGES.NO_TODO} />
<Button onClick={() => openModal('생성')} size="medium">
μƒˆ 할일 등둝
</Button>
</Card>
) : (
)}

{!isLoading && hasGoals && hasTodos && (
<ul>
{todos.map((todo) => (
<BasicTodoItem
Expand Down
4 changes: 3 additions & 1 deletion src/components/Sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { useTodoModalStore } from '@/store/useTodoModalStore';

import { cn } from '@/utils/className';

export const Sidebar = () => {
const Sidebar = () => {
const router = useRouter();
const path = usePathname();

Expand Down Expand Up @@ -147,3 +147,5 @@ export const Sidebar = () => {
</div>
);
};

export default Sidebar;
4 changes: 2 additions & 2 deletions src/hooks/apis/Follows/useGetFollowPostsQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import {
} from '@tanstack/react-query';
import { AxiosError } from 'axios';

import { GetFollowsResponse } from '@/types/Follows';
import { GET } from '@/apis/services/httpMethod';
import { API_ENDPOINTS } from '@/constants/ApiEndpoints';
import { QUERY_KEYS } from '@/constants/QueryKeys';
import { GetFollowsResponse } from '@/types/Follows';
import { BaseInfiniteQueryResponse } from '@/types/response';

export const getFollowPostsOptions = (): UseInfiniteQueryOptions<
Expand All @@ -18,7 +18,7 @@ export const getFollowPostsOptions = (): UseInfiniteQueryOptions<
queryKey: [QUERY_KEYS.FOLLOWS],
queryFn: ({ pageParam = 0 }) =>
GET<GetFollowsResponse>(
`${API_ENDPOINTS.FOLLOW.GET}?lastCompleteId=${pageParam}&size=10`,
`${API_ENDPOINTS.FOLLOW.GET}?lastCompleteId=${pageParam}&size=6`,
),
getNextPageParam: (lastPage) => {
const nextCursor = lastPage.data.nextCursor;
Expand Down
Loading