diff --git a/apps/web/src/components/Badge.tsx b/apps/web/src/components/Badge.tsx
new file mode 100644
index 00000000..65fc3f24
--- /dev/null
+++ b/apps/web/src/components/Badge.tsx
@@ -0,0 +1,10 @@
+import type { ReactNode } from "react";
+
+const Badge = ({ value, iconLeft }: { value: string; iconLeft: ReactNode }) => (
+
+ {iconLeft}
+ {value}
+
+);
+
+export default Badge;
diff --git a/apps/web/src/views/board/components/Card.tsx b/apps/web/src/views/board/components/Card.tsx
new file mode 100644
index 00000000..385f7b9e
--- /dev/null
+++ b/apps/web/src/views/board/components/Card.tsx
@@ -0,0 +1,54 @@
+import Avatar from "~/components/Avatar";
+import Badge from "~/components/Badge";
+import LabelIcon from "~/components/LabelIcon";
+import { getPublicUrl } from "~/utils/supabase/getPublicUrl";
+
+const Card = ({
+ title,
+ labels,
+ members,
+}: {
+ title: string;
+ labels: { name: string; colourCode: string | null }[];
+ members: {
+ publicId: string;
+ user: { name: string | null; email: string; image: string | null } | null;
+ }[];
+}) => {
+ return (
+
+
{title}
+ {labels.length || members.length ? (
+
+
+ {labels.map((label) => (
+ }
+ />
+ ))}
+
+
+ {members.map(({ user }) => {
+ if (!user) return null;
+
+ const avatarUrl = user.image
+ ? getPublicUrl(user.image)
+ : undefined;
+
+ return (
+
+ );
+ })}
+
+
+ ) : null}
+
+ );
+};
+
+export default Card;
diff --git a/apps/web/src/views/board/index.tsx b/apps/web/src/views/board/index.tsx
index 1b095cf9..f937acee 100644
--- a/apps/web/src/views/board/index.tsx
+++ b/apps/web/src/views/board/index.tsx
@@ -9,7 +9,6 @@ import { HiOutlinePlusSmall } from "react-icons/hi2";
import type { UpdateBoardInput } from "@kan/api/types";
-import Avatar from "~/components/Avatar";
import Button from "~/components/Button";
import Modal from "~/components/modal";
import { NewWorkspaceForm } from "~/components/NewWorkspaceForm";
@@ -21,8 +20,8 @@ import { useModal } from "~/providers/modal";
import { useWorkspace } from "~/providers/workspace";
import { api } from "~/utils/api";
import { formatToArray } from "~/utils/helpers";
-import { getPublicUrl } from "~/utils/supabase/getPublicUrl";
import BoardDropdown from "./components/BoardDropdown";
+import Card from "./components/Card";
import { DeleteBoardConfirmation } from "./components/DeleteBoardConfirmation";
import { DeleteListConfirmation } from "./components/DeleteListConfirmation";
import Filters from "./components/Filters";
@@ -240,7 +239,7 @@ export default function BoardPage() {
}}
key={card.publicId}
href={`/cards/${card.publicId}`}
- className={`mb-2 flex !cursor-pointer flex-col rounded-md border border-light-200 bg-light-50 px-3 py-2 text-sm text-neutral-900 dark:border-dark-200 dark:bg-dark-200 dark:text-dark-1000 dark:hover:bg-dark-300 ${
+ className={`mb-2 flex !cursor-pointer flex-col ${
card.publicId.startsWith("PLACEHOLDER")
? "pointer-events-none"
: ""
@@ -249,52 +248,11 @@ export default function BoardPage() {
{...provided.draggableProps}
{...provided.dragHandleProps}
>
- {card.title}
- {(card.labels.length ?? 0) ||
- (card.members.length ?? 0) ? (
-
- {card.labels.map((label) => (
-
-
- {label.name}
-
- ))}
-
- {card.members.map((member) => {
- const fileName =
- member.user?.image;
-
- const avatarUrl = fileName
- ? getPublicUrl(fileName)
- : undefined;
-
- return (
-
- );
- })}
-
-
- ) : null}
+
)}
diff --git a/apps/web/src/views/card/components/LabelSelector.tsx b/apps/web/src/views/card/components/LabelSelector.tsx
index a568ca0c..50f89ea7 100644
--- a/apps/web/src/views/card/components/LabelSelector.tsx
+++ b/apps/web/src/views/card/components/LabelSelector.tsx
@@ -3,6 +3,7 @@ import { Fragment } from "react";
import { useForm } from "react-hook-form";
import { HiEllipsisHorizontal, HiMiniPlus } from "react-icons/hi2";
+import Badge from "~/components/Badge";
import LabelIcon from "~/components/LabelIcon";
import { useModal } from "~/providers/modal";
import { api } from "~/utils/api";
@@ -58,28 +59,19 @@ export default function LabelSelector({
className="relative flex w-full flex-wrap items-center text-left"
>
{selectedLabels.length ? (
- <>
+
{selectedLabels.map((label) => (
-
-
- {label.name}
+
+ }
+ />
))}
-
-
- Add label
+
+ } />
- >
+
) : (
diff --git a/apps/web/src/views/card/index.tsx b/apps/web/src/views/card/index.tsx
index a6e7ac97..9bfe9fb8 100644
--- a/apps/web/src/views/card/index.tsx
+++ b/apps/web/src/views/card/index.tsx
@@ -191,7 +191,7 @@ export default function CardPage() {
-
+
List
{
openModal("CARD");
}}
>
- {card.title}
- {card.labels.length ? (
-
- {card.labels.map((label) => (
-
-
- {label.name}
-
- ))}
- {/*
- {card.members.map((member) => (
-
-
- {member.user?.name
- ?.split(" ")
- .map((namePart) =>
- namePart.charAt(0).toUpperCase(),
- )
- .join("")}
-
-
- ))}
-
*/}
-
- ) : null}
+
))}