Add HelpPanel and TodoItemTouch components, extend task commands, and refactor task and view logic
- Introduced `HelpPanel.vue` for displaying keyboard shortcuts and command descriptions. - Added `TodoItemTouch.vue`, a mobile-friendly task item component with updated bindings and improved actions. - Extended task commands with support for tagging, due date parsing, and dynamic text formatting. - Implemented `useActions` utility for parsing and executing command-based task modifications. - Streamlined task editing and creation in `useTasks` for consistency and API integration. - Updated `ListScreen` to support collapsible, categorized task lists with visual enhancements. - Refactored `App.vue` for adaptive input handling on mobile versus desktop views. - Enhanced API communication in `useApi` with cleaner header generation and error handling.
This commit is contained in:
27
src/utils/helpers.ts
Normal file
27
src/utils/helpers.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import type { Task } from '../types.ts'
|
||||
import Sherlock from 'sherlockjs'
|
||||
|
||||
export function parseDueDate(text: string): number | null {
|
||||
try {
|
||||
const parsed = Sherlock.parse(text)
|
||||
if (parsed && parsed.startDate) {
|
||||
return parsed.startDate.getTime()
|
||||
}
|
||||
}
|
||||
catch {}
|
||||
const ts = Date.parse(text)
|
||||
return Number.isNaN(ts) ? null : ts
|
||||
}
|
||||
|
||||
export function stopWorkLogging(t: Task) {
|
||||
if (t.logs && t.logs.length) {
|
||||
const lastLog = t.logs[t.logs.length - 1]
|
||||
if (lastLog.start && !lastLog.end) {
|
||||
lastLog.end = Date.now()
|
||||
}
|
||||
}
|
||||
else {
|
||||
t.logs = []
|
||||
}
|
||||
return t
|
||||
}
|
||||
Reference in New Issue
Block a user