Skip to content

Commit a5ae571

Browse files
committed
Streamline preset and configuration management UI by integrating action buttons into section headers and modifying preset creation order
1 parent dd263b3 commit a5ae571

11 files changed

Lines changed: 46 additions & 67 deletions

File tree

packages/ui/src/components/editor/ChatInput/ChatInput.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@
251251
}
252252

253253
&--secondary {
254-
@media (max-width: 325px) {
254+
@media (max-width: 330px) {
255255
> span {
256256
display: none;
257257
}

packages/ui/src/components/editor/ChatInput/ChatInput.tsx

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ type Props = {
2828
use_default: string
2929
last_selection: string
3030
select: string
31-
select_config: string
3231
code_completions_mode_unavailable_with_text_selection: string
3332
code_completions_mode_unavailable_without_active_editor: string
3433
search: string
@@ -428,38 +427,20 @@ export const ChatInput: React.FC<Props> = (props) => {
428427
])}
429428
onClick={(e) => handle_submit(e, true)}
430429
disabled={is_submit_disabled}
431-
title={
432-
is_submit_disabled
433-
? get_disabled_title()
434-
: props.is_web_mode
435-
? props.translations.select
436-
: props.translations.select_config
437-
}
438430
>
439431
{navigator.userAgent.toUpperCase().indexOf('MAC') >= 0 ? (
440432
<Icon variant="COMMAND" />
441433
) : (
442434
<div className={styles.footer__right__button__ctrl}>Ctrl</div>
443435
)}
444436
<Icon variant="ENTER" />
445-
<span>
446-
{props.is_web_mode
447-
? props.translations.select
448-
: props.translations.select_config}
449-
</span>
437+
<span>{props.translations.select}</span>
450438
</button>
451439

452440
<button
453441
className={styles.footer__right__button}
454442
onClick={handle_submit}
455443
disabled={is_submit_disabled}
456-
title={
457-
is_submit_disabled
458-
? get_disabled_title()
459-
: props.is_web_mode
460-
? props.translations.last_selection
461-
: props.translations.use_default
462-
}
463444
>
464445
<Icon variant="ENTER" />
465446
<span>

packages/ui/src/components/editor/Configurations/Configurations.module.scss

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,13 @@
66
.my-configurations {
77
padding: 0 var(--padding-12px);
88
margin-bottom: var(--padding-4px);
9-
opacity: 0.7;
10-
color: var(--vscode-foreground);
9+
display: flex;
10+
align-items: center;
11+
gap: var(--padding-8px);
12+
13+
&__left {
14+
opacity: 0.7;
15+
}
1116
}
1217

1318
.configurations {
@@ -47,7 +52,7 @@
4752
&__left {
4853
display: flex;
4954
align-items: center;
50-
gap: 5px;
55+
gap: var(--padding-5px);
5156
overflow: hidden;
5257
white-space: nowrap;
5358

@@ -63,8 +68,4 @@
6368
}
6469
}
6570
}
66-
67-
&__create {
68-
margin: var(--padding-8px) var(--padding-12px) 0 var(--padding-12px);
69-
}
7071
}

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { Button } from '../Button/Button'
33
import { DEFAULT_TEMPERATURE } from '@shared/constants/api-tools'
44
import cn from 'classnames'
55
import { useState } from 'react'
6+
import { TextButton } from '../TextButton'
7+
import { IconButton } from '../IconButton/IconButton'
68

79
export namespace Configurations {
810
export type Configuration = {
@@ -39,7 +41,13 @@ export const Configurations: React.FC<Configurations.Props> = (props) => {
3941
return (
4042
<div className={styles.container}>
4143
<div className={styles['my-configurations']}>
42-
{props.translations.my_configurations}
44+
<div className={styles['my-configurations__left']}>
45+
{props.translations.my_configurations}
46+
</div>
47+
<IconButton
48+
codicon_icon="settings"
49+
on_click={props.on_manage_configurations}
50+
/>
4351
</div>
4452

4553
<div className={styles.configurations}>
@@ -96,12 +104,6 @@ export const Configurations: React.FC<Configurations.Props> = (props) => {
96104
)
97105
})}
98106
</div>
99-
100-
<div className={styles.configurations__create}>
101-
<Button on_click={props.on_manage_configurations}>
102-
{props.translations.manage_configurations}
103-
</Button>
104-
</div>
105107
</div>
106108
)
107109
}

packages/ui/src/components/editor/Presets/Presets.module.scss

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@
66
.my-presets {
77
display: flex;
88
align-items: center;
9-
justify-content: space-between;
109
padding: 0 var(--padding-12px);
1110
margin-bottom: var(--padding-4px);
11+
gap: var(--padding-8px);
1212

1313
&__left {
1414
opacity: 0.7;
15-
color: var(--vscode-foreground);
1615
}
1716
}
1817

@@ -57,7 +56,7 @@
5756
&__left {
5857
display: flex;
5958
align-items: center;
60-
gap: 5px;
59+
gap: var(--padding-5px);
6160
overflow: hidden;
6261
text-overflow: ellipsis;
6362
white-space: nowrap;
@@ -73,7 +72,7 @@
7372

7473
&--disabled {
7574
opacity: 0.3;
76-
cursor: auto
75+
cursor: auto;
7776
}
7877
}
7978

@@ -103,8 +102,4 @@
103102
padding-right: var(--padding-4px);
104103
}
105104
}
106-
107-
&__create {
108-
margin: var(--padding-8px) var(--padding-12px) 0 var(--padding-12px);
109-
}
110105
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const Multiple = () => {
4141
has_context={true}
4242
web_mode="edit-context"
4343
translations={{
44-
my_chat_presets: 'My Chat Presets',
44+
my_presets: 'My Chat Presets',
4545
set_presets_opening_by_default: 'Set presets opening by default',
4646
set_as_default: 'Set as Default',
4747
unset_as_default: 'Unset as Default',
@@ -89,7 +89,7 @@ export const CodeCompletionsMode = () => {
8989
has_context={true}
9090
web_mode="edit-context"
9191
translations={{
92-
my_chat_presets: 'My Chat Presets',
92+
my_presets: 'My Chat Presets',
9393
set_presets_opening_by_default: 'Set presets opening by default',
9494
set_as_default: 'Set as Default',
9595
unset_as_default: 'Unset as Default',

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

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import styles from './Presets.module.scss'
22
import { IconButton } from '../IconButton/IconButton'
3-
import { Button } from '../Button/Button'
43
import { Checkbox } from '../Checkbox'
54
import cn from 'classnames'
65
import { ReactSortable } from 'react-sortablejs'
76
import { Icon } from '../Icon'
87
import { useState } from 'react'
98
import { CHATBOTS } from '@shared/constants/chatbots'
9+
import { TextButton } from '../TextButton'
1010

1111
export const chatbot_to_icon: Record<keyof typeof CHATBOTS, Icon.Variant> = {
1212
'AI Studio': 'AI_STUDIO',
@@ -56,7 +56,7 @@ export namespace Presets {
5656
on_preset_delete: (name: string) => void
5757
on_toggle_default_preset: (name: string) => void
5858
translations: {
59-
my_chat_presets: string
59+
my_presets: string
6060
set_presets_opening_by_default: string
6161
not_connected: string
6262
preset_requires_active_editor: string
@@ -134,10 +134,9 @@ export const Presets: React.FC<Presets.Props> = (props) => {
134134
<div className={styles.container}>
135135
<div className={styles['my-presets']}>
136136
<div className={styles['my-presets__left']}>
137-
{props.translations.my_chat_presets}
137+
{props.translations.my_presets}
138138
</div>
139-
140-
<span></span>
139+
<IconButton codicon_icon="add" on_click={props.on_create_preset} />
141140
</div>
142141

143142
<div className={styles.presets}>
@@ -352,12 +351,6 @@ export const Presets: React.FC<Presets.Props> = (props) => {
352351
})}
353352
</ReactSortable>
354353
</div>
355-
356-
<div className={styles.presets__create}>
357-
<Button on_click={props.on_create_preset}>
358-
{props.translations.create}
359-
</Button>
360-
</div>
361354
</div>
362355
)
363356
}

packages/vscode/src/view/backend/message-handlers/handle-create-preset.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ export const handle_create_preset = async (
1414
[
1515
{
1616
label: 'Preset',
17-
description: 'Your favorite chatbot, preconfigured'
17+
description: 'Added at the top',
18+
detail: 'Your favorite chatbot, preconfigured.'
1819
},
1920
{
2021
label: 'Group',
21-
description: 'Simultaneous initializations of selected presets'
22+
description: 'Added at the bottom',
23+
detail: 'Simultaneous initializations of selected presets.'
2224
}
2325
],
2426
{
@@ -55,7 +57,10 @@ export const handle_create_preset = async (
5557
} as ConfigPresetFormat
5658
}
5759

58-
const updated_presets = [...current_presets, new_preset]
60+
const updated_presets =
61+
create_option.label == 'Preset'
62+
? [new_preset, ...current_presets]
63+
: [...current_presets, new_preset]
5964

6065
try {
6166
provider.send_message({

packages/vscode/src/view/frontend/EditPresetForm/EditPresetForm.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
&__item {
1414
display: flex;
1515
align-items: center;
16-
gap: 5px;
16+
gap: var(--padding-5px);
1717
cursor: pointer;
1818

1919
input {

packages/vscode/src/view/frontend/home/HomeView/HomeView.module.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
.inner {
99
display: flex;
1010
flex-direction: column;
11-
padding: var(--padding-3px) 0 var(--padding-12px) 0;
11+
padding: var(--padding-3px) 0 var(--padding-10px) 0;
1212
}
1313

1414
.commands {
@@ -55,7 +55,7 @@
5555
align-items: center;
5656
gap: var(--padding-4px);
5757
height: 24px;
58-
padding: 0 5px;
58+
padding: 0 var(--padding-5px);
5959
border-radius: var(--border-radius-4px);
6060
text-decoration: none;
6161
color: var(--vscode-foreground);

0 commit comments

Comments
 (0)