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
1,317 changes: 1,033 additions & 284 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"react": "^19.0.0",
"react-day-picker": "^8.10.1",
"react-dom": "^19.0.0",
"sharp": "^0.34.1",
"tailwind-merge": "^2.6.0",
"tailwindcss-animate": "^1.0.7",
"vaul": "^1.1.2",
"zustand": "^5.0.3"
},
Expand All @@ -56,6 +56,7 @@
"prettier": "^3.4.2",
"prettier-plugin-tailwindcss": "^0.6.10",
"tailwindcss": "^3.4.17",
"tailwindcss-animate": "^1.0.7",
"typescript": "^5"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"use client";

import Loader from "@/components/loader/Loader";
import { Button } from "@/components/ui/button";
import {
Dialog,
Expand All @@ -18,6 +19,7 @@ interface CharacterDialogProps {
taskType: string;
personaName: string;
personaId?: number;
isLoading: boolean;
onClick: () => void;
}

Expand All @@ -27,13 +29,14 @@ const CharacterDialog = ({
taskType,
personaName,
personaId,
isLoading,
onClick,
}: CharacterDialogProps) => {
const { userData } = useUserStore();
const personaImageSrc = getPersonaImage(personaId);

return (
<Dialog open={isOpen} onOpenChange={onClick}>
<Dialog open={isOpen} onOpenChange={onClick} modal>
<DialogContent className="w-[328px] rounded-[24px] border-none bg-component-gray-secondary px-4 py-6">
<DialogHeader>
<DialogTitle className="text-normal t3 mb-1">
Expand Down Expand Up @@ -65,7 +68,13 @@ const CharacterDialog = ({
<span className="l6 text-inverse">{`${personaName} ${userData.nickname}`}</span>
</div>
</div>
<Button variant="primary" className="w-full" onClick={onClick}>
<Button
variant="primary"
className="w-full"
disabled={isLoading}
onClick={onClick}
>
{isLoading && <Loader width={24} height={24} />}
{taskType === "instant" ? "시작" : "확인"}
</Button>
</DialogContent>
Expand Down
15 changes: 3 additions & 12 deletions src/app/(protected)/(create)/instant-create/page.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
"use client";

import BackHeader from "@/components/backHeader/BackHeader";
import Loader from "@/components/loader/Loader";

import useMount from "@/hooks/useMount";
import type { InstantTaskType, TimePickerType } from "@/types/create";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { createFunnelSteps, useFunnel } from "@use-funnel/browser";
import dynamic from "next/dynamic";

import { useRouter } from "next/navigation";
import InstantTaskTypeInput from "../_components/instantTaskTypeInput/InstantTaskTypeInput";
import TaskInput from "../_components/taskInput/TaskInput";
import type { InstantTaskInputType, TaskInputType } from "../context";

const InstantTaskTypeInput = dynamic(
() =>
import(
"@/app/(protected)/(create)/_components/instantTaskTypeInput/InstantTaskTypeInput"
),
{
loading: () => <Loader />,
},
);

type FormState = {
task?: string;
deadlineDate?: Date;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const HeaderBar = () => {
alt="SPURT"
width={54}
height={20}
priority
className="w-[54px]"
priority
/>
<Link href="/my-page" className="flex items-center">
<button type="button">
Expand All @@ -20,6 +20,7 @@ const HeaderBar = () => {
alt="마이페이지"
width={20}
height={20}
priority
/>
</button>
</Link>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
"use client";

import type { Task } from "@/types/task";
import { useRouter } from "next/navigation";
import { useState } from "react";

import ExpiredTaskDrawer from "../expiredTaskDrawer/ExpiredTaskDrawer";
import HasAllTasksOnlyScreen from "../hasAllTasksOnlyScreen/HasAllTasksOnlyScreen";
import HasInProgressTasksOnlyScreen from "../hasInProgressTasksOnlyScreen/HasInProgressTasksOnlyScreen";
import HasTodayAndInProgressTasksScreen from "../hasTodayAndInProgressTasksScreen/HasTodayAndInProgressTasksScreen";
Expand Down Expand Up @@ -37,20 +34,6 @@ const TodayTaskTabWrapper = ({
handleDetailTask,
handleDeleteTask,
}: TodayTaskTabWrapperProps) => {
const router = useRouter();

const [showExpiredTaskSheet, setShowExpiredTaskSheet] = useState(false);
const [expiredTask, setExpiredTask] = useState<Task | null>(null);

const handleGoToReflection = (taskId: number) => {
router.push(`/retrospection/${taskId}`);
setShowExpiredTaskSheet(false);
};

const handleCloseExpiredSheet = () => {
setShowExpiredTaskSheet(false);
};

return (
<>
{isTotallyEmpty && <IsEmptyScreen />}
Expand Down Expand Up @@ -94,14 +77,14 @@ const TodayTaskTabWrapper = ({
/>
)}

{/* 뭔가 잘못된거 같음. expiredTask를 할당하는 로직이 없음. */}
{/* 뭔가 잘못된거 같음. expiredTask를 할당하는 로직이 없음.
{showExpiredTaskSheet && expiredTask && (
<ExpiredTaskDrawer
expiredTask={expiredTask}
handleGoToReflection={handleGoToReflection}
handleCloseExpiredSheet={handleCloseExpiredSheet}
/>
)}
)} */}
</>
);
};
Expand Down
16 changes: 13 additions & 3 deletions src/app/(protected)/(root)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const HomePageContent = () => {
inProgressTasks,
});

// 화면 분기 처리를 위한 상태
const [isDetailSheetOpen, setIsDetailSheetOpen] = useState(false);
const [activeTab, setActiveTab] = useState<"today" | "all">("today");
const [detailTask, setDetailTask] = useState<Task | null>(null);
Expand All @@ -60,6 +59,7 @@ const HomePageContent = () => {
const [urgentTaskId, setUrgentTaskId] = useState<number | undefined>(
undefined,
);
const [isLoading, setIsLoading] = useState(false);

const handleDetailTask = (task: Task) => {
setDetailTask(task);
Expand Down Expand Up @@ -99,12 +99,15 @@ const HomePageContent = () => {
setIsCreateSheetOpen(false);
};

const handleCharacterDialogButtonClick = () => {
const handleCharacterDialogButtonClick = async () => {
if (taskType === "instant") {
router.push(`/immersion/${urgentTaskId}`);
setIsLoading(true);
await router.push(`/immersion/${urgentTaskId}`);
} else {
setIsDialogOpen(false);
}

setIsLoading(false);
};

const handleFailedDialogButtonClick = () => {
Expand All @@ -115,6 +118,12 @@ const HomePageContent = () => {
setActiveTab(tab);
}, []);

useEffect(() => {
if (isDialogOpen && taskType === "instant") {
router.prefetch(`immersion/${urgentTaskId}`);
}
}, [isDialogOpen, router, taskType, urgentTaskId]);

useEffect(() => {
if (searchParams.get("dialog") === "success") {
setIsDialogOpen(true);
Expand Down Expand Up @@ -231,6 +240,7 @@ const HomePageContent = () => {
taskType={taskType}
personaName={personaName}
personaId={personaId}
isLoading={isLoading}
onClick={handleCharacterDialogButtonClick}
/>

Expand Down
1 change: 0 additions & 1 deletion src/app/(protected)/my-page/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export default function MyPage() {
queryKey: ["myPage"],
queryFn: async () => await fetch("/api/my-page").then((res) => res.json()),
enabled: !!userData.memberId,
staleTime: 1000 * 60 * 5,
});

const handlePersonaClick = (id: number) => {
Expand Down
3 changes: 2 additions & 1 deletion tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Config } from "tailwindcss";
import animatePlugin from "tailwindcss-animate";

export default {
darkMode: ["class"],
Expand Down Expand Up @@ -209,5 +210,5 @@ export default {
},
},
},
plugins: [],
plugins: [animatePlugin],
} satisfies Config;