Skip to content

Commit 20bacab

Browse files
committed
Rename *Mode types and variables to *PromptType across the codebase for improved clarity and consistency
1 parent 9924825 commit 20bacab

34 files changed

Lines changed: 393 additions & 348 deletions

‎packages/shared/src/types/modes.ts‎

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export type WebPromptType =
2+
| 'ask'
3+
| 'edit-context'
4+
| 'code-completions'
5+
| 'no-context'
6+
export type ApiPromptType = 'edit-context' | 'code-completions'

‎packages/ui/src/components/editor/panel/Configurations/Configurations.stories.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const configurations: Configurations.Configuration[] = [
2929
export const Default = () => {
3030
return (
3131
<Configurations
32-
api_mode="edit-context"
32+
api_prompt_type="edit-context"
3333
configurations={configurations}
3434
on_configuration_click={(id) => {
3535
console.log('on_configuration_click', id)
@@ -50,7 +50,7 @@ export const Default = () => {
5050

5151
export const Empty = () => (
5252
<Configurations
53-
api_mode="edit-context"
53+
api_prompt_type="edit-context"
5454
configurations={[]}
5555
on_configuration_click={(id) => {
5656
console.log('on_configuration_click', id)

‎packages/ui/src/components/editor/panel/Configurations/Configurations.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export namespace Configurations {
1616
}
1717

1818
export type Props = {
19-
api_mode: 'edit-context' | 'code-completions'
19+
api_prompt_type: 'edit-context' | 'code-completions'
2020
configurations: Configuration[]
2121
on_configuration_click: (id: string) => void
2222
on_reorder?: (configurations: Configuration[]) => void
@@ -41,7 +41,7 @@ export const Configurations: React.FC<Configurations.Props> = (props) => {
4141
}
4242
if (
4343
configuration.temperature &&
44-
configuration.temperature != DEFAULT_TEMPERATURE[props.api_mode]
44+
configuration.temperature != DEFAULT_TEMPERATURE[props.api_prompt_type]
4545
) {
4646
description_parts.push(`${configuration.temperature}`)
4747
}

‎packages/ui/src/components/editor/panel/Presets/Presets.stories.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const presets: Presets.Preset[] = [
1919
export const Primary = () => {
2020
return (
2121
<Presets
22-
web_mode="edit-context"
22+
web_prompt_type="edit-context"
2323
is_connected={true}
2424
has_instructions={true}
2525
is_in_code_completions_mode={false}

‎packages/ui/src/components/editor/panel/Presets/Presets.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export namespace Presets {
4646
}
4747

4848
export type Props = {
49-
web_mode: 'ask' | 'edit-context' | 'code-completions' | 'no-context'
49+
web_prompt_type: 'ask' | 'edit-context' | 'code-completions' | 'no-context'
5050
is_connected: boolean
5151
has_instructions: boolean
5252
is_in_code_completions_mode: boolean

‎packages/ui/src/components/editor/panel/PromptField/PromptField.module.scss‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@
379379

380380
.tooltip {
381381
position: absolute;
382-
z-index: 1;
382+
z-index: 2;
383383
bottom: calc(100% - 2px);
384384
font-size: var(--font-size-12px);
385385
white-space: normal;

‎packages/ui/src/components/editor/panel/PromptField/hooks/use-handlers.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,13 @@ export const use_handlers = (
453453
handle_history_navigation(e)
454454
return
455455
}
456+
457+
if (key == 'Escape') {
458+
if (input_ref.current) {
459+
input_ref.current.blur()
460+
}
461+
return
462+
}
456463
}
457464

458465
return {

‎packages/ui/src/components/editor/panel/ViewTypeButton/ViewTypeButton.module.scss‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
font-family: var(--font-family-accent);
1919
font-size: 22px;
2020
line-height: 1.2;
21+
letter-spacing: 1px;
2122
}
2223

2324
&__pre {

‎packages/vscode/src/constants/state-keys.ts‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,21 @@ export const PINNED_HISTORY_CODE_COMPLETIONS_STATE_KEY =
5656
'pinned-history-code-completions'
5757
export const PINNED_HISTORY_NO_CONTEXT_STATE_KEY = 'pinned-history-no-context'
5858

59-
export const get_presets_collapsed_state_key = (web_mode: string) =>
60-
`presets-collapsed-${web_mode}`
61-
export const get_configurations_collapsed_state_key = (api_mode: string) =>
62-
`configurations-collapsed-${api_mode}`
59+
export const get_presets_collapsed_state_key = (web_prompt_type: string) =>
60+
`presets-collapsed-${web_prompt_type}`
61+
export const get_configurations_collapsed_state_key = (
62+
api_prompt_type: string
63+
) => `configurations-collapsed-${api_prompt_type}`
6364

64-
export const get_last_group_or_preset_choice_state_key = (web_mode: string) =>
65-
`last-group-or-preset-choice-${web_mode}`
65+
export const get_last_group_or_preset_choice_state_key = (
66+
web_prompt_type: string
67+
) => `last-group-or-preset-choice-${web_prompt_type}`
6668

67-
export const get_last_selected_preset_key = (web_mode: string) =>
68-
`last-selected-preset-${web_mode}`
69+
export const get_last_selected_preset_key = (web_prompt_type: string) =>
70+
`last-selected-preset-${web_prompt_type}`
6971

70-
export const get_last_selected_group_state_key = (web_mode: string) =>
71-
`last-selected-group-${web_mode}`
72+
export const get_last_selected_group_state_key = (web_prompt_type: string) =>
73+
`last-selected-group-${web_prompt_type}`
7274

7375
export type DuplicateWorkspaceContext = {
7476
checked_files: string[]

0 commit comments

Comments
 (0)