Apps
Tasks
Lists, tags, natural language quick add, grouping, subtasks, repeats and an inline task panel.
Tasks carry time, repeat, notes, subtasks, createdAt and createdBy. TodoTaskPanel edits every field in place, so there is no task dialog.
Every app follows the same pattern: typed models in types/models/, demo data in mocks/, state and actions in a composable under composables/apps/, page-only components in components/pages/<app>/ and UI strings in locales/<code>/apps.json. Read the apps overview once and every app looks familiar.
Files
File | Role |
|---|---|
pages/todo.vue | The page: sidebar, list and task panel. |
composables/apps/useTodo.ts | Tasks, filters, groups, quick add and trash. |
types/models/todo.ts | Tasks, filters and the provider. |
config/todo.config.ts | Lists, tags, priorities and repeat options. |
utils/todo.ts | Pure rules, unit tested. |
components/pages/todo/ | TodoSidebar, TodoList, TodoTaskItem, TodoTaskPanel, TodoQuickAdd. |
Data and provider
export interface TodoProvider {
list: () => Promise<TodoTask[]>
save: (task: TodoTask) => Promise<void>
remove: (id: string) => Promise<void>
}
Connect your backend
The page calls useTodo() with the mock provider. Write a provider that calls your API with useApi() and pass it in the page. The composable loads it through useAsyncData and applies every change optimistically, so the interface does not wait for the server.
import type { TodoProvider, TodoTask } from '~/types/models/todo'
export function createTodoApiProvider(): TodoProvider {
const api = useApi()
return {
list: () => api<TodoTask[]>('/tasks'),
save: (task) => api(`/tasks/${task.id}`, { method: 'PUT', body: task }),
remove: (id) => api(`/tasks/${id}`, { method: 'DELETE' }),
}
}
<script setup lang="ts">
import { createTodoApiProvider } from '~/providers/todo'
const { ... } = useTodo({ provider: createTodoApiProvider() })
</script>
Keep ids in your data and labels in the locales: folders, labels and tags resolve their names through apps.<app>.* unless you give them a raw title. See Connect your API for the token, validation errors and the actions the demo only fakes.
Configuration
TODO_FILTERS
The lists of the sidebar with their icon.
const TODO_FILTERS: TodoFilterConfig[]
TODO_TAGS
Tags with their color and an optional raw title; otherwise apps.todo.tags.<id>.
const TODO_TAGS: TodoTagConfig[]
TODO_PRIORITIES
The priorities.
const TODO_PRIORITIES: TodoPriority[]
TODO_REPEATS
The repeat options.
const TODO_REPEATS: TodoRepeat[]
Rules
Pure functions in utils/, unit tested. Use them in your backend too if you want the same answers.
parseTodoQuickAdd()
Parses the quick add text.
parseTodoQuickAdd(text: string, today: string, vocabulary: TodoQuickAddVocabulary): TodoQuickAdd
todoDateGroup()
The date group of a task.
todoDateGroup(task: TodoTask, today: string, weekEnd: string): TodoDateGroup
matchesTodoFilter()
Whether a task belongs to a list.
matchesTodoFilter(task: TodoTask, filter: TodoFilter, context: { today: string; weekEnd: string; me: string }): booleansubtaskProgress()
Subtask progress.
subtaskProgress(task: TodoTask): { done: number; total: number; }donetotalHow it works
TodoQuickAddunderstandstodayandtomorrow(plus the words inapps.todo.quickAdd.todayWords|tomorrowWords),HH:MM,!priorityand#tag, and previews the chips before Enter.nfocuses it.- Groups follow
groupBy(date,priorityorassignee). The completed group starts collapsed and the overdue group offers “move all to today”. - Moving to the trash shows an undo toast; deleting forever and emptying the trash confirm with
useConfirm(). - The sidebar has the progress ring, the lists and multi-select tags.