Create alternative Kanban view to collection view
Per some users request, it could be useful to switch the default collection view to a Kanban view, like Trello. Users could define one property that generates the columns, and one property to define the order of each entry in each column.
Implemented and shipped in FireCMS 3.1.0 🎉 It works as described in this issue — one property defines the columns, and ordering within each column is persisted.
import { buildCollection } from "@firecms/core";
const tasksCollection = buildCollection({
name: "Tasks",
path: "tasks",
// the property that generates the columns — must be a string
// property with enumValues; column order follows the enumValues order
kanban: { columnProperty: "status" },
// optional: open in Kanban by default ("table" | "cards" | "kanban")
defaultViewMode: "kanban",
// optional: restrict which view modes users can switch to
enabledViews: ["table", "kanban"],
// optional: number property used to persist ordering within a column
// (uses fractional indexing, so reordering touches one document)
orderProperty: "order",
properties: {
title: { dataType: "string", name: "Title" },
status: {
dataType: "string",
name: "Status",
enumValues: {
todo: "To do",
in_progress: "In progress",
done: "Done"
}
},
order: { dataType: "number", name: "Order" }
}
});
One gotcha: Kanban is only offered when the collection has at least one string property with enumValues — that's what the columns are built from. There's also a cards view mode now, which wasn't part of the original request but tends to be useful for image-heavy collections.
Docs: https://firecms.co/docs/collections/view_modes
Closing as done.