add app shell with top bar, view routing, and board factory

This commit is contained in:
2026-02-15 18:44:19 +02:00
parent b07df5cf7b
commit f4ab1565f5
4 changed files with 259 additions and 3 deletions

44
src/lib/board-factory.ts Normal file
View File

@@ -0,0 +1,44 @@
import { ulid } from "ulid";
import type { Board, ColumnWidth } from "@/types/board";
type Template = "blank" | "kanban" | "sprint";
export function createBoard(
title: string,
color: string,
template: Template = "blank"
): Board {
const ts = new Date().toISOString();
const board: Board = {
id: ulid(),
title,
color,
createdAt: ts,
updatedAt: ts,
columns: [],
cards: {},
labels: [],
settings: { attachmentMode: "link" },
};
const col = (t: string, w: ColumnWidth = "standard") => ({
id: ulid(),
title: t,
cardIds: [] as string[],
width: w,
});
if (template === "kanban") {
board.columns = [col("To Do"), col("In Progress"), col("Done")];
} else if (template === "sprint") {
board.columns = [
col("Backlog"),
col("To Do"),
col("In Progress", "wide"),
col("Review"),
col("Done", "narrow"),
];
}
return board;
}