Skip to content

Commit 91913cc

Browse files
committed
Refactor confirmation messages to use warning level and standardize UI components for configuration lists
1 parent 34e8201 commit 91913cc

16 files changed

Lines changed: 185 additions & 293 deletions

‎packages/shared/src/constants/dictionary.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ export const dictionary = {
8383
NO_HISTORY_FOR_MODE: 'No history to show for the current mode.',
8484
NO_TEXT_SELECTED_FOR_SELECTION_PLACEHOLDER:
8585
'No text selected for #Selection placeholder.',
86-
PLEASE_CONFIRM: 'Please confirm',
8786
NOTHING_TO_DELETE: 'Nothing to delete.',
8887
RESTORED_CONTEXT: (context_name: string) =>
8988
`Restored context "${context_name}".`,
@@ -112,6 +111,7 @@ export const dictionary = {
112111
},
113112

114113
warning_message: {
114+
PLEASE_CONFIRM: 'Please confirm',
115115
SKIPPING_INVALID_PATH: (file_path: string) =>
116116
`Skipping applying change to invalid path: ${file_path}.`,
117117
CODE_COMPLETIONS_NO_SELECTION:

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FC, ChangeEvent, MouseEvent } from 'react'
1+
import { FC } from 'react'
22
import styles from './Radio.module.scss'
33

44
type Props = {
@@ -11,7 +11,7 @@ type Props = {
1111
}
1212

1313
export const Radio: FC<Props> = (props) => {
14-
const handle_change = (e: ChangeEvent<HTMLInputElement>) => {
14+
const handle_change = () => {
1515
props.on_change()
1616
}
1717

@@ -23,6 +23,9 @@ export const Radio: FC<Props> = (props) => {
2323
className={styles.radio}
2424
checked={props.checked}
2525
onChange={handle_change}
26+
onClick={(e) => {
27+
e.stopPropagation()
28+
}}
2629
disabled={props.disabled}
2730
title={props.title}
2831
/>

‎packages/ui/src/components/editor/settings/ConfigurationsList/ConfigurationsList.module.scss‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
.container {
22
display: flex;
33
flex-direction: column;
4-
padding-top: 12px;
54
}
65

76
.toolbar {
87
display: flex;
9-
padding: 0 10px 8px 10px;
8+
padding: 12px 12px 8px 12px;
109
align-items: center;
11-
gap: 8px;
10+
justify-content: space-between;
1211
}
1312

1413
.list {
@@ -20,15 +19,16 @@
2019
.row {
2120
display: flex;
2221
align-items: center;
23-
height: 36px;
22+
height: 40px;
23+
gap: 12px;
24+
padding: 0 12px;
2425

2526
&:nth-child(even) {
2627
background-color: var(--vscode-welcomePage-tileBackground);
2728
}
2829

2930
&__content {
3031
flex: 1;
31-
padding: 0 12px;
3232
overflow: hidden;
3333
white-space: nowrap;
3434
text-overflow: ellipsis;
@@ -37,6 +37,11 @@
3737
margin-right: 0.5em;
3838
}
3939

40+
> span:first-child:hover {
41+
text-decoration: underline;
42+
cursor: pointer;
43+
}
44+
4045
> span:last-child {
4146
margin-left: 0.5em;
4247
opacity: 0.7;
@@ -69,7 +74,7 @@
6974
}
7075

7176
.col-drag {
72-
width: 40px;
77+
padding: 4px;
7378
display: flex;
7479
align-items: center;
7580
justify-content: center;
@@ -79,5 +84,4 @@
7984
display: flex;
8085
justify-content: flex-end;
8186
gap: 8px;
82-
padding-right: 8px;
8387
}

‎packages/ui/src/components/editor/settings/ConfigurationsList/ConfigurationsList.tsx‎

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Radio } from '../../panel/Radio'
44
import { ReactSortable } from 'react-sortablejs'
55
import { IconButton } from '../../panel/IconButton'
66
import { TextButton } from '../TextButton'
7+
import { Button } from '../../common/Button'
78

89
export namespace ConfigurationsList {
910
export type Configuration = {
@@ -32,7 +33,11 @@ export const ConfigurationsList: React.FC<ConfigurationsList.Props> = (
3233
const has_default = props.configurations.some((c) => c.is_default)
3334

3435
const render_item = (config: ConfigurationsList.Configuration) => (
35-
<div key={config.id} className={styles.row}>
36+
<div
37+
key={config.id}
38+
className={styles.row}
39+
onClick={() => props.on_edit(config.id)}
40+
>
3641
{sortable && (
3742
<div className={cn(styles['drag-handle'], styles['col-drag'])}>
3843
<span className="codicon codicon-gripper" />
@@ -53,18 +58,14 @@ export const ConfigurationsList: React.FC<ConfigurationsList.Props> = (
5358
<span>{config.description}</span>
5459
</div>
5560
<div className={styles['col-actions']}>
56-
{props.on_edit && (
57-
<IconButton
58-
codicon_icon="edit"
59-
title="Edit configuration"
60-
on_click={() => props.on_edit?.(config.id)}
61-
/>
62-
)}
6361
{props.on_delete && (
6462
<IconButton
65-
codicon_icon="trash"
63+
codicon_icon="remove"
6664
title="Delete configuration"
67-
on_click={() => props.on_delete?.(config.id)}
65+
on_click={(e) => {
66+
e.stopPropagation()
67+
props.on_delete(config.id)
68+
}}
6869
/>
6970
)}
7071
</div>
@@ -74,12 +75,7 @@ export const ConfigurationsList: React.FC<ConfigurationsList.Props> = (
7475
return (
7576
<div className={styles.container}>
7677
<div className={styles.toolbar}>
77-
<IconButton
78-
codicon_icon="add"
79-
on_click={props.on_add}
80-
title="New configuration"
81-
/>
82-
<div style={{ flex: 1 }} />
78+
<Button on_click={props.on_add}>New Configuration...</Button>
8379
{props.on_unset_default && has_default && (
8480
<TextButton on_click={props.on_unset_default}>
8581
Unset default

‎packages/ui/src/components/editor/settings/ModelProviders/ModelProviders.module.scss‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
.container {
22
display: flex;
33
flex-direction: column;
4-
padding-top: 12px;
54
}
65

76
.toolbar {
87
display: flex;
9-
padding: 0 10px 8px 10px;
8+
padding: 12px 12px 8px 12px;
109
align-items: center;
1110
gap: 8px;
1211
}
@@ -20,7 +19,8 @@
2019
.row {
2120
display: flex;
2221
align-items: center;
23-
height: 36px;
22+
height: 40px;
23+
gap: 12px;
2424

2525
&:nth-child(even) {
2626
background-color: var(--vscode-welcomePage-tileBackground);
@@ -29,7 +29,6 @@
2929
&__content {
3030
flex: 1;
3131
display: flex;
32-
padding: 0 12px;
3332
overflow: hidden;
3433
gap: 8px;
3534

@@ -42,21 +41,24 @@
4241
}
4342

4443
.col-drag {
45-
width: 40px;
44+
padding: 0 4px 0 14px;
4645
display: flex;
4746
align-items: center;
4847
justify-content: center;
4948
}
5049

5150
.col-name {
52-
flex: 1 1 25%;
51+
width: 90px;
5352
}
53+
5454
.col-api-key {
5555
width: 50px;
5656
}
57+
5758
.col-base-url {
58-
flex: 1 1 45%;
59+
flex: 1;
5960
}
61+
6062
.col-actions {
6163
display: flex;
6264
justify-content: flex-end;

‎packages/ui/src/components/editor/settings/ModelProviders/ModelProviders.tsx‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import styles from './ModelProviders.module.scss'
22
import { ReactSortable } from 'react-sortablejs'
33
import cn from 'classnames'
44
import { IconButton } from '../../panel/IconButton'
5+
import { Button } from '../../common/Button'
56

67
export namespace ModelProviders {
78
export type Provider = {
@@ -57,7 +58,7 @@ export const ModelProviders: React.FC<ModelProviders.Props> = (props) => {
5758
/>
5859
)}
5960
<IconButton
60-
codicon_icon="trash"
61+
codicon_icon="remove"
6162
on_click={() => props.on_delete_provider(provider.name)}
6263
title="Delete provider"
6364
/>
@@ -68,11 +69,7 @@ export const ModelProviders: React.FC<ModelProviders.Props> = (props) => {
6869
return (
6970
<div className={styles.container}>
7071
<div className={styles.toolbar}>
71-
<IconButton
72-
codicon_icon="add"
73-
on_click={props.on_add_provider}
74-
title="New provider"
75-
/>
72+
<Button on_click={props.on_add_provider}>New Provider...</Button>
7673
</div>
7774
<div className={styles.list}>
7875
{props.providers.length > 0 ? (

‎packages/vscode/src/views/panel/backend/message-handlers/handle-delete-preset-group-or-separator.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ export const handle_delete_preset_group_or_separator = async (
4444
const display_item_name = is_unnamed ? 'Unnamed' : item_name!
4545

4646
const delete_button = 'Delete'
47-
const result = await vscode.window.showInformationMessage(
48-
dictionary.information_message.PLEASE_CONFIRM,
47+
const result = await vscode.window.showWarningMessage(
48+
dictionary.warning_message.PLEASE_CONFIRM,
4949
{
5050
modal: true,
5151
detail: is_unnamed

‎packages/vscode/src/views/settings/backend/message-handlers/handle-delete-code-completions-configuration.ts‎

Lines changed: 0 additions & 51 deletions
This file was deleted.

‎packages/vscode/src/views/settings/backend/message-handlers/handle-delete-commit-messages-configuration.ts‎

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)