Repository navigation
Commit 891d482
committed
Add mode switch control to prompt field, use keycap wrapper across various components
- should accept props: on_mode_change, mode:string. render it in place where we previously had 'invocation count' [Commit]
- fix prompt field stories
- move `apps/editor/src/views/prompt/types/main-view-mode.ts` to `packages/shared/src/types` as mode.ts
- `packages/ui/src/components/editor/common/prompts/PromptField/PromptField.tsx` should use `packages/shared/src/types/mode.ts` type
- 'mode switch' should use Tooltip, add appropriate translation
- rename tooltip 'change mode' to 'mode'
- from header, remove keycap over 'back' button, remove changing mode with shortcuts alt+1/alt+2
- show keycap 'esc' over 'mode' in prompt type (when alt is pressed) and handle mode toggling (alt+esc)
- the 'esc' keycap should be rendered on top (stacked), not replace the mode (inspire by `packages/ui/src/components/editor/prompt/PromptTypeButton/PromptTypeButton.tsx`)
- in prompt field, 'esc' is not properly shown on mode (as stack), but slightly above, move it back down
- rename 'shortcut' to keycap
- prompt field should use keycap wrapper
- prompt field should use keycap wrappers for each prompt type char
├── apps
│ └── editor
│ └── src
│ └── views
│ └── prompt
│ ├── backend
│ │ ├── message-handlers
│ │ │ ├── handle-autofill.ts
│ │ │ ├── handle-save-edit-format.ts
│ │ │ ├── handle-select-edit-format.ts
│ │ │ └── handle-template-quick-pick.ts
│ │ └── prompt-view-provider.ts
│ ├── frontend
│ │ ├── Home
│ │ │ ├── Home.tsx
│ │ │ └── hooks
│ │ │ ├── use-has-scrolled-past-mode-button.ts
│ │ │ ├── use-keyboard-shortcuts.ts
│ │ │ └── use-tasks.ts
│ │ ├── Main
│ │ │ ├── Main.tsx
│ │ │ └── MainView
│ │ │ ├── MainView.module.scss
│ │ │ ├── MainView.tsx
│ │ │ ├── components
│ │ │ │ └── Header
│ │ │ │ ├── Header.module.scss
│ │ │ │ ├── Header.tsx
│ │ │ │ ├── hooks
│ │ │ │ │ └── use-keyboard-shortcuts.ts
│ │ │ │ └── index.ts
│ │ │ ├── hooks
│ │ │ │ ├── use-invocation-counts.ts
│ │ │ │ ├── use-last-choice-tooltip.ts
│ │ │ │ └── use-re-render-on-interval.ts
│ │ │ ├── index.ts
│ │ │ └── prompt-type-labels.ts
│ │ ├── Prompt.tsx
│ │ ├── hooks
│ │ │ └── use-prompt
│ │ │ ├── hooks
│ │ │ │ └── use-instructions.ts
│ │ │ └── use-prompt.ts
│ │ └── i18n
│ │ └── translations
│ │ └── prompt-field.ts
│ └── types
│ └── messages.ts
└── packages
├── shared
│ └── src
│ └── types
│ ├── edit-format.ts
│ ├── file-in-preview.ts
│ ├── mode.ts
│ ├── prompt-types.ts
│ ├── response-history-item.ts
│ ├── task.ts
│ ├── web-configuration.ts
│ └── websocket-message.ts
└── ui
└── src
└── components
└── editor
├── common
│ └── prompts
│ ├── PromptField
│ │ ├── PromptField.module.scss
│ │ ├── PromptField.stories.tsx
│ │ ├── PromptField.tsx
│ │ ├── components
│ │ │ ├── Tooltip.module.scss
│ │ │ ├── Tooltip.tsx
│ │ │ └── index.ts
│ │ ├── hooks
│ │ │ ├── use-drag-drop.ts
│ │ │ ├── use-dropdown.ts
│ │ │ ├── use-ghost-text.ts
│ │ │ ├── use-handlers
│ │ │ │ ├── handle-copy.ts
│ │ │ │ ├── handle-cut.ts
│ │ │ │ ├── handle-input-change.ts
│ │ │ │ ├── handle-input-click.ts
│ │ │ │ ├── handle-key-down.ts
│ │ │ │ ├── handle-paste.ts
│ │ │ │ ├── handle-submit.ts
│ │ │ │ ├── index.ts
│ │ │ │ ├── types.ts
│ │ │ │ ├── use-handlers.ts
│ │ │ │ └── utils.ts
│ │ │ └── use-keyboard-shortcuts.ts
│ │ └── index.ts
│ ├── Template
│ │ ├── Template.module.scss
│ │ ├── Template.tsx
│ │ └── index.ts
│ └── shared
│ └── symbols
│ ├── caret.ts
│ ├── get-highlighted-text.tsx
│ ├── index.ts
│ ├── position-mapping.ts
│ ├── prompt-symbols.module.scss
│ ├── reconstruct-raw-value.ts
│ └── use-symbol-deletion.ts
└── prompt
├── KeycapWrapper
│ ├── KeycapWrapper.module.scss
│ ├── KeycapWrapper.stories.tsx
│ ├── KeycapWrapper.tsx
│ └── index.ts
├── ModeButton
│ ├── ModeButton.module.scss
│ └── ModeButton.tsx
└── PromptTypeButton
├── PromptTypeButton.module.scss
├── PromptTypeButton.stories.tsx
├── PromptTypeButton.tsx
└── index.ts1 parent 0505902 commit 891d482
25 files changed
Lines changed: 338 additions & 291 deletions
File tree
- apps/editor/src/views/prompt
- backend
- message-handlers
- frontend
- Home
- Main
- MainView
- components/Header
- hooks
- hooks
- hooks/use-prompt
- hooks
- i18n/translations
- types
- packages
- ui/src
- components/editor
- common
- Button
- prompts/PromptField
- hooks
- prompt/KeycapWrapper
- hooks
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
| 107 | + | |
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
239 | 238 | | |
240 | 239 | | |
241 | 240 | | |
| |||
310 | 309 | | |
311 | 310 | | |
312 | 311 | | |
| 312 | + | |
| 313 | + | |
313 | 314 | | |
314 | 315 | | |
315 | 316 | | |
| |||
351 | 352 | | |
352 | 353 | | |
353 | 354 | | |
354 | | - | |
| 355 | + | |
| 356 | + | |
355 | 357 | | |
356 | 358 | | |
357 | 359 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
| |||
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
32 | | - | |
33 | 31 | | |
34 | 32 | | |
35 | 33 | | |
| |||
39 | 37 | | |
40 | 38 | | |
41 | 39 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
53 | 45 | | |
54 | 46 | | |
55 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
| |||
116 | 115 | | |
117 | 116 | | |
118 | 117 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | 118 | | |
130 | 119 | | |
131 | 120 | | |
| |||
135 | 124 | | |
136 | 125 | | |
137 | 126 | | |
138 | | - | |
139 | 127 | | |
140 | 128 | | |
141 | 129 | | |
| |||
0 commit comments