-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
841 additions
and
827 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,40 @@ | ||
// describe("로그인 페이지 테스트", () => { | ||
// it("로그인 성공.", () => { | ||
// cy.intercept("/dashboard*").as("dashboard"); | ||
|
||
// cy.visit("http://localhost:3000/login"); | ||
|
||
// cy.get('input[placeholder="이메일"]').type("[email protected]"); | ||
// cy.get('input[placeholder="비밀번호"]').type("012345678"); | ||
// cy.contains("로그인").click(); | ||
|
||
// cy.wait("@dashboard").then((_) => { | ||
// cy.contains("대시보드"); | ||
// }); | ||
// }); | ||
// it.only("로그인 실패.", () => { | ||
// cy.visit("http://localhost:3000/login"); | ||
|
||
// cy.get('input[placeholder="이메일"]').type("[email protected]"); | ||
// cy.get('input[placeholder="비밀번호"]').type("wrongnumber"); | ||
// cy.contains("로그인").click(); | ||
|
||
// cy.wait("@dashboard").then(() => { | ||
// cy.contains("대시보드"); | ||
// }); | ||
// }); | ||
|
||
// it("로그인 실패.", () => { | ||
// cy.intercept("/login").as("login"); | ||
|
||
// cy.visit("http://localhost:3000/login"); | ||
|
||
// cy.get('input[placeholder="이메일"]').type("[email protected]"); | ||
// cy.get('input[placeholder="비밀번호"]').type("wrongnumber"); | ||
// cy.contains("로그인").click(); | ||
|
||
// cy.wait("@login").then(() => { | ||
// cy.contains("로그인에 실패했습니다. 다시 시도해 주세요.").should("be.visible"); | ||
// }); | ||
// }); | ||
// }); | ||
describe("로그인 페이지 테스트", () => { | ||
it("로그인 성공.", () => { | ||
cy.intercept("/dashboard*").as("dashboard"); | ||
|
||
cy.visit("http://localhost:3000/login"); | ||
|
||
cy.get('input[placeholder="이메일"]').type("[email protected]"); | ||
cy.get('input[placeholder="비밀번호"]').type("012345678"); | ||
cy.contains("로그인").click(); | ||
|
||
cy.wait("@dashboard").then((_) => { | ||
cy.contains("대시보드"); | ||
}); | ||
}); | ||
// it.only("로그인 실패.", () => { | ||
// cy.visit("http://localhost:3000/login"); | ||
|
||
// cy.get('input[placeholder="이메일"]').type("[email protected]"); | ||
// cy.get('input[placeholder="비밀번호"]').type("wrongnumber"); | ||
// cy.contains("로그인").click(); | ||
|
||
// cy.wait("@dashboard").then(() => { | ||
// cy.contains("대시보드"); | ||
// }); | ||
// }); | ||
|
||
// it("로그인 실패.", () => { | ||
// cy.intercept("/login").as("login"); | ||
|
||
// cy.visit("http://localhost:3000/login"); | ||
|
||
// cy.get('input[placeholder="이메일"]').type("[email protected]"); | ||
// cy.get('input[placeholder="비밀번호"]').type("wrongnumber"); | ||
// cy.contains("로그인").click(); | ||
|
||
// cy.wait("@login").then(() => { | ||
// cy.contains("로그인에 실패했습니다. 다시 시도해 주세요.").should("be.visible"); | ||
// }); | ||
// }); | ||
}); |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
export type InitialTodoType = { | ||
title?: string; | ||
fileUrl?: string | null; | ||
linkUrl?: string | null; | ||
goalId?: number; | ||
}; | ||
|
||
export type TodoType = { | ||
noteId?: number | null; | ||
done: boolean; | ||
linkUrl?: string | null; | ||
fileUrl?: string | null; | ||
title: string; | ||
id: number; | ||
goal: GoalType; | ||
userId: number; | ||
teamId: string; | ||
updatedAt: string; | ||
createdAt: string; | ||
}; | ||
|
||
export type GoalType = { | ||
id: number; | ||
teamId: string; | ||
title: string; | ||
userId: number; | ||
createdAt: string; | ||
updatedAt: string; | ||
}; | ||
|
||
export type NoteType = { | ||
content: string; | ||
createdAt: string; | ||
goal: { | ||
id: number; | ||
title: string; | ||
}; | ||
id: number; | ||
linkUrl: string; | ||
teamId: string; | ||
title: string; | ||
todo: { | ||
done: boolean; | ||
fileUrl: string | null; | ||
id: number; | ||
linkUrl: string | null; | ||
title: string; | ||
}; | ||
updatedAt: string; | ||
userId: number; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import Image from "next/image"; | ||
import { useRouter } from "next/navigation"; | ||
import { useEffect, useState } from "react"; | ||
import { toast } from "react-toastify"; | ||
|
||
import { NoteType } from "@/app/Types/TodoGoalType"; | ||
import deleteNote, { getNote } from "@/api/noteAPI"; | ||
|
||
import NoteViewer from "./NoteViewer"; | ||
|
||
export default function NoteItem({ note }: { note: NoteType }) { | ||
const router = useRouter(); | ||
const [isDropdownOpen, setIsDropdownOpen] = useState(false); | ||
const [isNoteOpen, setIsNoteOpen] = useState(false); | ||
const [noteContent, setNoteContent] = useState<NoteType>(); | ||
|
||
const loadNoteItemData = async () => { | ||
const response = await getNote(note.id); | ||
if (response) { | ||
console.log(isNoteOpen); | ||
console.log(noteContent); | ||
setNoteContent(response.data); | ||
} | ||
}; | ||
|
||
const handleDelete = async () => { | ||
const response = await deleteNote(note.id); | ||
if (response) { | ||
toast.success("삭제되었습니다."); | ||
} | ||
}; | ||
|
||
useEffect(() => { | ||
loadNoteItemData(); | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, []); | ||
|
||
return ( | ||
<div key={note.id} className="relative rounded-xl bg-white p-[24px]"> | ||
<div className="mb-[16px] flex justify-between"> | ||
<Image src="/note-header.webp" width={28} height={28} alt="note-header-icon" /> | ||
<Image | ||
className="cursor-pointer" | ||
src="/note-kebab.webp" | ||
width={28} | ||
height={28} | ||
alt="note-header-icon" | ||
onClick={() => setIsDropdownOpen((prev) => !prev)} | ||
/> | ||
</div> | ||
<h2 className="cursor-pointer text-lg hover:underline" onClick={() => setIsNoteOpen((prev) => !prev)}> | ||
{note.title} | ||
</h2> | ||
<hr className="my-3" /> | ||
<div className="flex gap-2"> | ||
<span className="rounded-[4px] bg-[#f1f5f9] px-[3px] py-[2px] text-xs"> | ||
{note.todo.done ? "Done" : "To do"} | ||
</span> | ||
<h3>{note.todo.title}</h3> | ||
</div> | ||
{isDropdownOpen && ( | ||
<div | ||
className="absolute right-10 top-20 z-10 rounded-lg border bg-white" | ||
onMouseLeave={() => setIsDropdownOpen(false)} | ||
> | ||
<p | ||
className="cursor-pointer p-5 hover:bg-slate-200" | ||
onClick={() => router.push(`/dashboard/note/${note.todo.id}?goalId=${note.goal.id}`)} | ||
> | ||
수정하기 | ||
</p> | ||
<p className="cursor-pointer p-5 hover:bg-slate-200" onClick={handleDelete}> | ||
삭제하기 | ||
</p> | ||
</div> | ||
)} | ||
<NoteViewer isNoteOpen={isNoteOpen} setIsNoteOpen={setIsNoteOpen} noteContent={noteContent} /> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.