Open History to see the last commit
1export type TodoId = string
2β
3export type TodoItem = {
4 id: TodoId
5 label: string
6}
7β
8export const initialItems: Array<TodoItem> = [
9 { id: 'todo-1', label: 'Collect requirements' },
10 { id: 'todo-2', label: 'Sketch the flow' },
11 { id: 'todo-3', label: 'Wire the form' },
12 { id: 'todo-4', label: 'Polish interactions' },
13]
14β
15export const initialDoneItems: Array<TodoItem> = [
16 { id: 'todo-5', label: 'Review accessibility' },
17 { id: 'todo-6', label: 'Ship example' },
18]
19β
20const itemGroups = ['items', 'doneItems'] as const
21β
22export type ItemGroup = (typeof itemGroups)[number]
23β
24export const itemGroupLabels: Record<ItemGroup, string> = {
25 items: 'Planning',
26 doneItems: 'Done',
27}
28β
29let nextId = initialItems.length + initialDoneItems.length + 1
30β
31export function createItem(): TodoItem {
32 const id = nextId++
33β
34 return {
35 id: `todo-${id}`,
36 label: `New item ${id}`,
37 }
38}