diff --git a/src/app/boards/[...id]/create.tsx b/src/app/boards/[...id]/NewCardForm.tsx
similarity index 100%
rename from src/app/boards/[...id]/create.tsx
rename to src/app/boards/[...id]/NewCardForm.tsx
diff --git a/src/app/boards/[...id]/NewListForm.tsx b/src/app/boards/[...id]/NewListForm.tsx
new file mode 100644
index 00000000..ddaccb2b
--- /dev/null
+++ b/src/app/boards/[...id]/NewListForm.tsx
@@ -0,0 +1,86 @@
+"use client";
+
+import { api } from "~/trpc/react";
+
+import { HiXMark } from "react-icons/hi2";
+
+import { useBoard } from "~/app/providers/board";
+import { useModal } from "~/app/providers/modal";
+
+import { Formik, Form, Field } from "formik";
+
+interface FormValues {
+ name: string;
+}
+
+interface boardPublicId {
+ boardPublicId: string;
+}
+
+export function NewListForm({ boardPublicId }: boardPublicId) {
+ const utils = api.useUtils();
+ const { boardData } = useBoard();
+ const { closeModal } = useModal();
+
+ const refetchBoard = () =>
+ utils.board.byId.refetch({ id: boardData.publicId });
+
+ const createList = api.list.create.useMutation({
+ onSuccess: async () => {
+ try {
+ await refetchBoard();
+ closeModal();
+ } catch (e) {
+ console.log(e);
+ }
+ },
+ });
+
+ return (
+ <>
+
+
New list
+
+
+
+ {
+ createList.mutate({
+ name: values.name,
+ boardPublicId,
+ });
+ }}
+ >
+
+
+ >
+ );
+}
diff --git a/src/app/boards/[...id]/page.tsx b/src/app/boards/[...id]/page.tsx
index 466ca4d0..7e962e9f 100644
--- a/src/app/boards/[...id]/page.tsx
+++ b/src/app/boards/[...id]/page.tsx
@@ -17,7 +17,9 @@ import { useBoard } from "~/app/providers/board";
import { useModal } from "~/app/providers/modal";
import Modal from "~/app/_components/modal";
-import { NewCardForm } from "~/app/boards/[...id]/create";
+
+import { NewCardForm } from "./NewCardForm";
+import { NewListForm } from "./NewListForm";
interface List {
publicId: string;
@@ -40,7 +42,7 @@ type PublicListId = string;
export default function BoardPage() {
const params = useParams();
const { boardData, setBoardData, updateCard, updateList } = useBoard();
- const { openModal } = useModal();
+ const { openModal, modalContentType } = useModal();
const [selectedPublicListId, setSelectedPublicListId] =
useState("");
@@ -73,8 +75,13 @@ export default function BoardPage() {
},
);
+ const openNewListForm = (publicBoardId: string) => {
+ openModal("NEW_LIST");
+ setSelectedPublicListId(publicBoardId);
+ };
+
const openNewCardForm = (publicListId: PublicListId) => {
- openModal();
+ openModal("NEW_CARD");
setSelectedPublicListId(publicListId);
};
@@ -153,6 +160,7 @@ export default function BoardPage() {