Repository navigation
Commit 49c4275
committed
Extract alt pressed tracking into shared use-alt-pressed hook and reuse it across keyboard shortcut handlers
- when using a keyboard shortcut, keycaps should hide immediately when they take effect, e.g. cmd+2 change 'target' but keycaps are hidden only after releasing the shortcut
- simplify hiding keycaps by hiding them whenever two keys are pressed
- alt triggers our keycaps, it's great. what's not gret is that when a complete shortcut is pressed e.g. alt+X, and X released, the keycap re-appears because 'alt' is pressed. it's unexpected, alt should be required to be pressed again to trigger re-apparance of keycaps.
- extract shared logic from 'use keyboard shortcuts' to `apps/editor/src/views/prompt/frontend/hooks`
- once alt+x is ussed, keycap doesn't dissapear
- once keycaps outside of the prompt field are used e.g. alt+x, keycaps from the prompt field doesn't dissapear until next alt press but should.
├── apps
│ └── editor
│ └── src
│ └── views
│ └── prompt
│ └── frontend
│ ├── Home
│ │ ├── Home.tsx
│ │ └── hooks
│ │ └── use-keyboard-shortcuts.ts
│ ├── Main
│ │ └── MainView
│ │ ├── MainView.tsx
│ │ ├── components
│ │ │ ├── Header
│ │ │ │ └── Header.tsx
│ │ │ └── PromptAttachments
│ │ │ └── PromptAttachments.tsx
│ │ └── hooks
│ │ └── use-keyboard-shortcuts.ts
│ └── hooks
│ ├── use-alt-pressed.ts
│ ├── use-is-landscape.ts
│ └── use-modal-manager.ts
└── packages
└── ui
└── src
└── components
└── editor
├── common
│ └── prompts
│ └── PromptField
│ ├── PromptField.tsx
│ ├── components
│ │ └── Footer
│ │ ├── Footer.module.scss
│ │ └── Footer.tsx
│ └── hooks
│ └── use-keyboard-shortcuts.ts
└── prompt-view
├── KeycapWrapper
│ ├── KeycapWrapper.module.scss
│ ├── KeycapWrapper.tsx
│ └── index.ts
├── StatusBar
│ └── StatusBar.tsx
└── TargetButton
├── TargetButton.module.scss
└── TargetButton.tsx1 parent 81827f4 commit 49c4275
4 files changed
Lines changed: 116 additions & 169 deletions
File tree
- apps/editor/src/views/prompt/frontend
- Home/hooks
- Main/MainView/hooks
- hooks
- packages/ui/src/components/editor/common/prompts/PromptField/hooks
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
16 | 13 | | |
17 | 14 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
| 15 | + | |
22 | 16 | | |
23 | 17 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | 18 | | |
46 | 19 | | |
47 | | - | |
| 20 | + | |
48 | 21 | | |
49 | 22 | | |
50 | 23 | | |
| |||
62 | 35 | | |
63 | 36 | | |
64 | 37 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | 38 | | |
92 | | - | |
93 | | - | |
94 | 39 | | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
| 40 | + | |
100 | 41 | | |
101 | 42 | | |
102 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 19 | + | |
27 | 20 | | |
28 | 21 | | |
29 | 22 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | 23 | | |
52 | 24 | | |
53 | 25 | | |
| |||
61 | 33 | | |
62 | 34 | | |
63 | 35 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | 36 | | |
91 | 37 | | |
92 | 38 | | |
| |||
96 | 42 | | |
97 | 43 | | |
98 | 44 | | |
99 | | - | |
100 | | - | |
101 | 45 | | |
102 | 46 | | |
103 | 47 | | |
104 | 48 | | |
105 | | - | |
106 | | - | |
107 | 49 | | |
108 | 50 | | |
109 | 51 | | |
| |||
114 | 56 | | |
115 | 57 | | |
116 | 58 | | |
117 | | - | |
| 59 | + | |
118 | 60 | | |
119 | 61 | | |
120 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
0 commit comments