-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtodo
74 lines (71 loc) · 3.95 KB
/
todo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
Immediate stuff:
✔ make quiting require typing the word "quit" instead of just hitting the letter q @done(22-11-24 20:57)
Right now I don't think there's much value to doing this. It's nice how loosely coupled it is.
Except the app can't quit on its own.
✔ refactor previously_typed_chars @done(22-11-27 12:37)
✔ organize draw_ui by adding helpers @done(22-11-27 18:25)
This will make it easier to mentally manage drawing different screens modifying current total times.
☐ be able to modify the current total times
useful for when you want to make corrections, like if you left it in rest mode by accident when you were actually focusing
Userflow
1) Press e to edit totals
2) _popup window_
Press f to edit focus total
Press r to edit rest total
Press c to cancel
3) _same popup window's content changes entirely_
Enter new total: █#:##:##
_Cursor moves right as they type valid numbers_
Press backspace to delete
Press enter to save
Press c to cancel
Would be nice at this point to have dedicated functions for drawing parts of the screen given some amount of state passed in.
Internal workings of editing a total I think would replace all sessions in that edited session type with a single session. If its the active session type, then the session would have no end time. If its paused or the inactive session, then the session has an end time of now.
Popup example using tui. Look for app.show_popup. https://github.com/fdehau/tui-rs/blob/master/examples/popup.rs
Technical implementation todo
add app commands
AppCommand::EnterEditMode
AppCommand::EditFocusTotal
AppCommand::EditRestTotal
AppCommand::CancelEditMode
used in both levels of the popup
AppCommand::InputNumber
AppCommand::DeleteInput
AppCommand::SaveNewTotal
some app state
is edit window is open
is editing focus or rest total
numbers that user is inputting
app functions
enter edit mode
exit edit mode
select rest or focus total to edit
accept number user is entering for new total
save total
Maybe I should revisit tests before adding more functionality...
[x] revisit tests @done(22-11-30 23:27)
I'd bet there are ways I can improve the testing based on things I've learned since I wrote it.
I want to do behaviour driven tests. Instead of testing internal state.
Possible new tests
<thing> <does> given <prelude>
[x] app is in focus mode given app start up
[x] session time increases given time passes
[x] session type total time keeps increases given being paused and restarted
[x] session type total time does not increase given it is paused
[x] session type total time does not increase given a different session type time is increasing
Long-term:
- Be able to create your own "modes".
Like have session types for "development", "PR review", "jira", etc.
Accept string input from user, use as key in sessions_by_type.
This will require a UI.
Could do a TUI with tui-rs https://github.com/fdehau/tui-rs
Only handles visuals, needs other for input
Works well with crossterm out of the box https://github.com/crossterm-rs/crossterm
- autosaving
Could turn on autosaving
Provide a save file location
Begins automatically saving the current "stopwatch" to that file and ids it with today's date.
"2022-07-14.stopwatch" and if duplicates "2022-07-14_2.stopwatch"
Serialized representation of session types & their sessions
Will have to end last session so its endtime isn't dangling in case file is resumed.
Optionally load a stopwatch from file at start.