Skip to content

Commit fd2dd77

Browse files
committed
feat: update
1 parent c4b7b68 commit fd2dd77

6 files changed

Lines changed: 375 additions & 406 deletions

File tree

UI_IMPLEMENTATION_STATUS.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# UI Implementation Status for `todopro add`
2+
3+
## Changes Made
4+
5+
### 1. **Bottom Toolbar with Separator**
6+
- Added `bottom_toolbar` function that renders:
7+
- Horizontal separator line (matching terminal width)
8+
- Footer text: "Press **Enter** to submit or **Ctrl+C** to cancel."
9+
- The toolbar appears below the input line and completion suggestions
10+
11+
### 2. **Syntax Highlighting (Already Implemented)**
12+
- ✅ Priority colors: !!1 (red), !!2 (orange), !!3 (blue), !!4 (light gray)
13+
- ✅ Recognized date keywords: background light red (`bg:#ffcccc`)
14+
- ✅ Recognized labels (@): background light red when in cache
15+
- ✅ Recognized projects (#): background light red when in cache
16+
17+
### 3. **Autocomplete Suggestions (Already Implemented)**
18+
- ✅ Shows up to 10 suggestions for labels (@) and projects (#)
19+
- ✅ First item marked with ▋ symbol
20+
- ✅ First item is bolded
21+
- ✅ Filtered by prefix or shows all alphabetically
22+
23+
### 4. **Placeholder Text**
24+
- ✅ "Enter your task description" shown when input is empty (light gray)
25+
26+
## Testing Required
27+
28+
**The implementation cannot be fully tested in the current bash/non-TTY environment.**
29+
30+
To test the UI properly, please run in a real terminal:
31+
32+
```bash
33+
cd /home/minhdqdev/Projects/todopro/todopro-cli
34+
source .venv/bin/activate
35+
todopro add
36+
```
37+
38+
### Expected UI Layout:
39+
40+
```
41+
Inbox
42+
────────────────────────────────────────────────────────────────────
43+
❯ Enter your task description
44+
────────────────────────────────────────────────────────────────────
45+
Press Enter to submit or Ctrl+C to cancel.
46+
```
47+
48+
### When typing `@`:
49+
50+
```
51+
Inbox
52+
────────────────────────────────────────────────────────────────────
53+
❯ Buy groceries @
54+
────────────────────────────────────────────────────────────────────
55+
▋ @action
56+
@book
57+
@code
58+
@design
59+
────────────────────────────────────────────────────────────────────
60+
Press Enter to submit or Ctrl+C to cancel.
61+
```
62+
63+
## Known Issues in Non-TTY Environment
64+
65+
When testing via bash tool or piped input:
66+
- Blank lines appear where toolbar/completions should be
67+
- Warning: "Input is not a terminal (fd=0)"
68+
- Visual rendering doesn't work properly
69+
70+
This is expected behavior - prompt_toolkit requires a real TTY for proper rendering.
71+
72+
## Files Modified
73+
74+
- `/home/minhdqdev/Projects/todopro/todopro-cli/src/todopro_cli/ui/interactive_prompt.py`
75+
- Added bottom toolbar with separator and footer text
76+
- Updated styles for recognized entities (background color)
77+
- Improved cache loading error handling
78+
79+
## Next Steps
80+
81+
1. Test in a real terminal session
82+
2. Verify all colors match the spec
83+
3. Check that suggestions appear in the correct location
84+
4. Verify placeholder text visibility
85+
5. Test keyboard navigation through suggestions

docs/QUICK_ADD.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,19 @@ The quick-add feature allows you to create tasks using natural language instead
1515

1616
## Commands
1717

18-
### Top-Level Shortcut
18+
### Quick Add Command
1919

2020
The fastest way to add a task:
2121

2222
```bash
23+
# Interactive mode (shows autocomplete UI)
24+
todopro add
25+
26+
# Direct input
2327
todopro add "Task description"
2428
```
2529

26-
### Full Command
27-
28-
For more control and options:
30+
### Alternative Command
2931

3032
```bash
3133
todopro tasks quick-add "Task description"

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ dependencies = [
2828
"packaging>=26.0",
2929
"cryptography>=42.0.0",
3030
"mnemonic>=0.20",
31+
"prompt-toolkit>=3.0.0",
3132
]
3233

3334
[project.optional-dependencies]

src/todopro_cli/commands/tasks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ def today(
454454
) -> None:
455455
"""Show tasks for today (overdue + today's tasks)."""
456456
check_auth(profile)
457-
457+
458458
# Handle --json flag as alias for --output json
459459
if json:
460460
output = "json"
@@ -567,7 +567,7 @@ def next_task(
567567
) -> None:
568568
"""Show the next task to do right now."""
569569
check_auth(profile)
570-
570+
571571
# Handle --json flag as alias for --output json
572572
if json:
573573
output = "json"
@@ -810,7 +810,7 @@ async def do_quick_add():
810810
parsed["due_date"].replace("Z", "+00:00")
811811
)
812812
details.append(
813-
f"[blue]📅 {due.strftime('%b %d, %Y at %I:%M %p')}[/blue]"
813+
f"📅 {due.strftime('%b %d, %Y at %I:%M %p')}"
814814
)
815815

816816
if parsed.get("project_name"):

src/todopro_cli/main.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -267,17 +267,18 @@ def quick_add(
267267
"""
268268
# If no input text, enter interactive mode
269269
if input_text is None:
270+
import asyncio
271+
270272
from rich.console import Console
271-
from rich.panel import Panel
272273

273-
console = Console()
274-
console.print(Panel(
275-
"[dim]Type the task here (!!1, !!2 for priority, @label for label, #project for project,...)[/dim]",
276-
border_style="blue",
277-
padding=(0, 1)
278-
))
274+
from todopro_cli.ui.interactive_prompt import get_interactive_input
279275

280-
input_text = typer.prompt("❯", prompt_suffix=" ")
276+
console = Console()
277+
try:
278+
input_text = asyncio.run(get_interactive_input(profile=profile))
279+
except KeyboardInterrupt:
280+
console.print("\n[yellow]Cancelled.[/yellow]")
281+
raise typer.Exit(0) from None
281282

282283
if not input_text or not input_text.strip():
283284
console.print("[yellow]No task entered. Cancelled.[/yellow]")

0 commit comments

Comments
 (0)