From a9c6051d1264066310c344c093d868ce73c5da46 Mon Sep 17 00:00:00 2001
From: Philipinho <16838612+Philipinho@users.noreply.github.com>
Date: Sun, 24 May 2026 13:51:20 +0100
Subject: [PATCH] feat(bases): add per-column '+ New' button to kanban
---
.../components/views/kanban/base-kanban.tsx | 19 ++++++++++++
.../views/kanban/kanban-add-card-button.tsx | 29 +++++++++++++++++++
.../components/views/kanban/kanban-column.tsx | 4 +++
3 files changed, 52 insertions(+)
create mode 100644 apps/client/src/features/base/components/views/kanban/kanban-add-card-button.tsx
diff --git a/apps/client/src/features/base/components/views/kanban/base-kanban.tsx b/apps/client/src/features/base/components/views/kanban/base-kanban.tsx
index 8498b2665..a9d55fb79 100644
--- a/apps/client/src/features/base/components/views/kanban/base-kanban.tsx
+++ b/apps/client/src/features/base/components/views/kanban/base-kanban.tsx
@@ -3,9 +3,11 @@ import {
IBase,
IBaseRow,
IBaseView,
+ NO_VALUE_CHOICE_ID,
} from "@/features/base/types/base.types";
import { useKanbanGroups } from "@/features/base/hooks/use-kanban-groups";
import { useUpdateViewMutation } from "@/features/base/queries/base-view-query";
+import { useCreateRowMutation } from "@/features/base/queries/base-row-query";
import { KanbanColumn } from "./kanban-column";
import { KanbanEmptyState } from "./kanban-empty-state";
import classes from "@/features/base/styles/kanban.module.css";
@@ -37,6 +39,7 @@ export function BaseKanban({
);
const isGroupable = property?.type === "select" || property?.type === "status";
const updateViewMutation = useUpdateViewMutation();
+ const createRowMutation = useCreateRowMutation();
// Rules of Hooks: call useKanbanGroups unconditionally with `undefined`
// when not groupable; switch the render path on isGroupable below.
@@ -56,6 +59,21 @@ export function BaseKanban({
});
};
+ const handleAddCard = (columnKey: string) => {
+ if (!groupByPropertyId) return;
+ const cells =
+ columnKey === NO_VALUE_CHOICE_ID
+ ? {}
+ : { [groupByPropertyId]: columnKey };
+ const column = columns.find((c) => c.key === columnKey);
+ const afterRowId = column?.rows[column.rows.length - 1]?.id;
+ createRowMutation.mutate({
+ pageId: base.id,
+ cells,
+ afterRowId,
+ });
+ };
+
if (!isGroupable) {
return