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:
2026-02-23 16:34:52 +01:00
parent ec76a52fdd
commit 56f89b6669
21 changed files with 1347 additions and 214 deletions

View File

@@ -0,0 +1,49 @@
import { computed, onMounted, ref } from 'vue'
import { useStore } from './useStore.ts'
export default function useHistory() {
const { getValue, setValue } = useStore()
const store = ref<string[]>([])
const history = computed<string[]>(() => store.value)
const historyIndex = ref(0)
const resetHistoryIndex = () => {
historyIndex.value = store.value.length - 1
}
onMounted(async () => {
store.value = await getValue('history') || []
resetHistoryIndex()
console.log({ s: store.value })
})
const pushHistory = (item: string) => {
if (store.value.length > 20)
store.value.shift()
store.value.push(item.trim())
setValue('history', store.value)
}
const matchHistory = (item: string) => {
const match = store.value.filter(i => i.startsWith(item.trim())).pop()
if (match) {
historyIndex.value = store.value.indexOf(match)
return match
}
return ''
}
const moveHistory = (direction: 'up' | 'down') => {
if (direction === 'up') {
historyIndex.value = Math.max(0, historyIndex.value - 1)
}
else {
historyIndex.value = Math.min(store.value.length - 1, historyIndex.value + 1)
}
}
const historyItem = computed(() => store.value[historyIndex.value])
return { history, pushHistory, matchHistory, moveHistory, historyItem, resetHistoryIndex }
}