Introduce tomorrow section in todos

This commit is contained in:
2026-03-12 15:30:23 +01:00
parent 49aa8bc413
commit 5e61a50f25
+13 -1
View File
@@ -37,6 +37,11 @@ const groupedTodos = computed(() => {
if (!groups['today']) groups['today'] = [] if (!groups['today']) groups['today'] = []
groups['today'].push(todo) groups['today'].push(todo)
} }
// tomorrow
if (daysFromNow(dueDate) === 1) {
if (!groups['tomorrow']) groups['tomorrow'] = []
groups['tomorrow'].push(todo)
}
// overdue // overdue
else if (daysFromNow(dueDate) < 0) { else if (daysFromNow(dueDate) < 0) {
if (!groups['overdue']) groups['overdue'] = [] if (!groups['overdue']) groups['overdue'] = []
@@ -54,6 +59,13 @@ const groupedTodos = computed(() => {
return groups return groups
}) })
const groupNameForKey = (key: string) => {
if (key === 'today') return 'Heute'
if (key === 'tomorrow') return 'Morgen'
if (key === 'overdue') return 'Überfällig'
return key
}
const todosEmpty = (todos: Todo[]) => { const todosEmpty = (todos: Todo[]) => {
if (todos.length === 0) return true if (todos.length === 0) return true
if (!props.showCompleted && !todos.some(todo => todo.status?.toLowerCase() !== 'completed')) return true if (!props.showCompleted && !todos.some(todo => todo.status?.toLowerCase() !== 'completed')) return true
@@ -100,7 +112,7 @@ const shouldDisplay = (todo: Todo) => {
'text-destructive! font-bold': groupKey === 'overdue', 'text-destructive! font-bold': groupKey === 'overdue',
'text-warning! font-bold': groupKey === 'today' 'text-warning! font-bold': groupKey === 'today'
}"> }">
{{ groupKey === 'today' ? 'Heute' : groupKey === 'overdue' ? 'Verspätet' : groupKey }} {{ groupNameForKey(groupKey) }}
</h3> </h3>
<hr> <hr>