From 3608ec0e31204326e89bd59eabaaa0cfe037b199 Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 21 Feb 2025 09:10:27 +0000 Subject: [PATCH] feat: empty boards and lists state --- apps/web/src/views/board/index.tsx | 182 ++++++++++-------- .../views/boards/components/BoardsList.tsx | 20 +- apps/web/src/views/boards/index.tsx | 4 +- 3 files changed, 126 insertions(+), 80 deletions(-) diff --git a/apps/web/src/views/board/index.tsx b/apps/web/src/views/board/index.tsx index 6f35e55e..76cff545 100644 --- a/apps/web/src/views/board/index.tsx +++ b/apps/web/src/views/board/index.tsx @@ -5,7 +5,7 @@ import { useRouter } from "next/router"; import { useEffect, useState } from "react"; import { DragDropContext, Draggable } from "react-beautiful-dnd"; import { useForm } from "react-hook-form"; -import { HiOutlinePlusSmall } from "react-icons/hi2"; +import { HiOutlinePlusSmall, HiOutlineSquare3Stack3D } from "react-icons/hi2"; import type { UpdateBoardInput } from "@kan/api/types"; @@ -274,83 +274,111 @@ export default function BoardPage() {
) : ( - - - {(provided) => ( -
-
- {boardData?.lists.map((list, index) => ( - - setSelectedPublicListId(publicListId) - } - > - - {(provided) => ( -
- {list.cards.map((card, index) => ( - - {(provided) => ( - { - if ( - card.publicId.startsWith( - "PLACEHOLDER", - ) - ) - e.preventDefault(); - }} - key={card.publicId} - href={`/cards/${card.publicId}`} - className={`mb-2 flex !cursor-pointer flex-col ${ - card.publicId.startsWith("PLACEHOLDER") - ? "pointer-events-none" - : "" - }`} - ref={provided.innerRef} - {...provided.draggableProps} - {...provided.dragHandleProps} - > - - - )} - - ))} - {provided.placeholder} -
- )} -
-
- ))} -
- {provided.placeholder} + <> + {boardData?.lists.length === 0 ? ( +
+
+ +

+ No lists +

+

+ Get started by creating a new list +

- )} - - + +
+ ) : ( + + + {(provided) => ( +
+
+ {boardData?.lists.map((list, index) => ( + + setSelectedPublicListId(publicListId) + } + > + + {(provided) => ( +
+ {list.cards.map((card, index) => ( + + {(provided) => ( + { + if ( + card.publicId.startsWith( + "PLACEHOLDER", + ) + ) + e.preventDefault(); + }} + key={card.publicId} + href={`/cards/${card.publicId}`} + className={`mb-2 flex !cursor-pointer flex-col ${ + card.publicId.startsWith( + "PLACEHOLDER", + ) + ? "pointer-events-none" + : "" + }`} + ref={provided.innerRef} + {...provided.draggableProps} + {...provided.dragHandleProps} + > + + + )} + + ))} + {provided.placeholder} +
+ )} +
+
+ ))} +
+ {provided.placeholder} +
+ )} + + + )} + )}
diff --git a/apps/web/src/views/boards/components/BoardsList.tsx b/apps/web/src/views/boards/components/BoardsList.tsx index c4f5a682..f5510de8 100644 --- a/apps/web/src/views/boards/components/BoardsList.tsx +++ b/apps/web/src/views/boards/components/BoardsList.tsx @@ -1,11 +1,15 @@ import Link from "next/link"; +import { HiOutlineRectangleStack } from "react-icons/hi2"; +import Button from "~/components/Button"; import PatternedBackground from "~/components/PatternedBackground"; +import { useModal } from "~/providers/modal"; import { useWorkspace } from "~/providers/workspace"; import { api } from "~/utils/api"; export function BoardsList() { const { workspace } = useWorkspace(); + const { openModal } = useModal(); const { data, isLoading } = api.board.all.useQuery( { workspacePublicId: workspace.publicId }, @@ -21,7 +25,21 @@ export function BoardsList() {
); - if (data?.length === 0) return <>; + if (data?.length === 0) + return ( +
+
+ +

+ No boards +

+

+ Get started by creating a new board +

+
+ +
+ ); return (
diff --git a/apps/web/src/views/boards/index.tsx b/apps/web/src/views/boards/index.tsx index d3764d4c..b8ca61fa 100644 --- a/apps/web/src/views/boards/index.tsx +++ b/apps/web/src/views/boards/index.tsx @@ -16,7 +16,7 @@ export default function BoardsPage() { return ( <> -
+

Boards @@ -57,7 +57,7 @@ export default function BoardsPage() { {modalContentType === "NEW_WORKSPACE" && } -
+