From f64549f743728c8a600fd51537f5ba9f87b091bf Mon Sep 17 00:00:00 2001 From: LovelessCodes Date: Fri, 6 Jun 2025 00:40:37 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20add=20not=20found=20states=20for=20boar?= =?UTF-8?q?d=20and=20card=20views=20with=20conditional=20=E2=80=A6=20(#41)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add not found states for board and card views with conditional rendering * refactor: move out of nested ternary --- apps/web/src/views/board/index.tsx | 33 ++++++------ apps/web/src/views/card/index.tsx | 84 +++++++++++++++++------------- 2 files changed, 65 insertions(+), 52 deletions(-) diff --git a/apps/web/src/views/board/index.tsx b/apps/web/src/views/board/index.tsx index 81cc54fa..79e16fd4 100644 --- a/apps/web/src/views/board/index.tsx +++ b/apps/web/src/views/board/index.tsx @@ -240,11 +240,12 @@ export default function BoardPage() {
- {isLoading ? ( + {isLoading && !boardData && (
- ) : ( + )} + {boardData && (
)} + {!boardData && !isLoading && ( +

Board not found

+ )}
- +
@@ -298,7 +302,7 @@ export default function BoardPage() {
- ) : ( + ) : boardData ? ( <> {boardData?.lists.length === 0 ? (
@@ -370,13 +374,12 @@ export default function BoardPage() { }} key={card.publicId} href={`/cards/${card.publicId}`} - className={`mb-2 flex !cursor-pointer flex-col ${ - card.publicId.startsWith( - "PLACEHOLDER", - ) - ? "pointer-events-none" - : "" - }`} + className={`mb-2 flex !cursor-pointer flex-col ${card.publicId.startsWith( + "PLACEHOLDER", + ) + ? "pointer-events-none" + : "" + }`} ref={provided.innerRef} {...provided.draggableProps} {...provided.dragHandleProps} @@ -404,7 +407,7 @@ export default function BoardPage() { )} - )} + ) : null}
{modalContentType === "DELETE_BOARD" && ( diff --git a/apps/web/src/views/card/index.tsx b/apps/web/src/views/card/index.tsx index 29eed41a..051743fc 100644 --- a/apps/web/src/views/card/index.tsx +++ b/apps/web/src/views/card/index.tsx @@ -148,12 +148,13 @@ export default function CardPage() {
- {isLoading ? ( + {!card && isLoading && (
- ) : ( + )} + {card && ( <> )} + {!card && !isLoading && ( +

+ Card not found +

+ )}
-
-
-
- setValue("description", e.target.value)} - onBlur={handleSubmit(onSubmit)} - className="block w-full border-0 bg-transparent py-1.5 text-light-900 focus-visible:outline-none dark:text-dark-1000 sm:text-sm sm:leading-6" - /> + {card && ( + <> +
+ +
+ setValue("description", e.target.value)} + onBlur={handleSubmit(onSubmit)} + className="block w-full border-0 bg-transparent py-1.5 text-light-900 focus-visible:outline-none dark:text-dark-1000 sm:text-sm sm:leading-6" + /> +
+
- -
-
-

- Activity -

-
- -
-
- -
-
+
+

+ Activity +

+
+ +
+
+ +
+
+ + )}
@@ -226,7 +236,7 @@ export default function CardPage() {
@@ -234,7 +244,7 @@ export default function CardPage() {
@@ -242,7 +252,7 @@ export default function CardPage() {