Skip to content

Commit 7a7549b

Browse files
committed
Rename general settings to preferences and update corresponding navigation and translation keys
- in General create a subsection 'commit messages'. Place it below 'Checkpoints'. Should include setting: 'include prompts in commit messages' - below 'edit formats' subsection, create 'misc' subsection. It should have settings: 'check new files' and 'clear checks in workspace behavior'. - rename 'general' to 'preferences'. Update file namaes as well. - assess correctness and clarity of 'nav items' [Fragment] rename as you deem necessary.
1 parent 3ec9deb commit 7a7549b

7 files changed

Lines changed: 257 additions & 198 deletions

File tree

‎apps/editor/src/views/settings/frontend/Home/Home.tsx‎

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,15 @@ import { useState, useRef, useEffect, useCallback } from 'react'
22
import { Layout as UiLayout } from '@ui/components/editor/settings/Layout'
33
import { NavigationItem as UiNavigationItem } from '@ui/components/editor/settings/NavigationItem'
44
import { ApiConfigurationsSection } from './sections/ApiConfigurationsSection'
5-
import { Item as UiItem } from '@ui/components/editor/settings/Item'
6-
import { Group as UiGroup } from '@ui/components/editor/settings/Group/Group'
7-
import { Section as UiSection } from '@ui/components/editor/settings/Section'
8-
import { Button as UiButton } from '@ui/components/editor/common/Button'
9-
import { Notice as UiNotice } from '@ui/components/editor/settings/Notice'
105
import {
116
ApiConfiguration,
127
Provider,
138
EditFormatInstructions
149
} from '@/views/settings/types/messages'
1510
import { WebConfiguration } from '@shared/types/web-configuration'
16-
import { GeneralSection } from './sections/GeneralSection'
11+
import { PreferencesSection } from './sections/PreferencesSection'
1712
import { ToolType } from '@/views/settings/types/tools'
18-
import {
19-
Translation,
20-
use_translation,
21-
TranslationKey
22-
} from '../i18n/use-translation'
13+
import { use_translation, TranslationKey } from '../i18n/use-translation'
2314
import { WebConfigurationsSection } from './sections/WebConfigurationsSection'
2415
import {
2516
commit_message_instructions as default_commit_message_instructions,
@@ -28,51 +19,63 @@ import {
2819
import { default_system_instructions } from '@shared/constants/default-system-instructions'
2920

3021
export type NavItem =
31-
| 'general'
22+
| 'preferences'
3223
| 'prompt-field'
3324
| 'checkpoints'
25+
| 'commit-messages'
3426
| 'edit-format'
27+
| 'misc'
28+
| 'chatbots'
29+
| 'web-configurations'
30+
| 'api-calls'
3531
| 'model-providers'
3632
| 'api-configurations'
37-
| 'api-configurations-list'
38-
| 'web-configurations'
39-
| 'web-configurations-list'
4033
| 'default-configurations'
4134
| 'instructions'
4235

4336
type NavConfigItem = { id: NavItem; label: TranslationKey; is_nested?: boolean }
4437

4538
const NAV_ITEMS_CONFIG: NavConfigItem[] = [
4639
{
47-
id: 'general',
48-
label: 'sections.general'
40+
id: 'preferences',
41+
label: 'sections.preferences'
4942
},
5043
{
5144
id: 'prompt-field',
52-
label: 'general.prompt-field.title',
45+
label: 'preferences.prompt-field.title',
5346
is_nested: true
5447
},
5548
{
5649
id: 'checkpoints',
57-
label: 'general.checkpoints.title',
50+
label: 'preferences.checkpoints.title',
51+
is_nested: true
52+
},
53+
{
54+
id: 'commit-messages',
55+
label: 'preferences.commit-messages.title',
5856
is_nested: true
5957
},
6058
{
6159
id: 'edit-format',
62-
label: 'general.edit-formats.title',
60+
label: 'preferences.edit-formats.title',
6361
is_nested: true
6462
},
6563
{
66-
id: 'web-configurations',
64+
id: 'misc',
65+
label: 'preferences.misc.title',
66+
is_nested: true
67+
},
68+
{
69+
id: 'chatbots',
6770
label: 'sections.chatbots'
6871
},
6972
{
70-
id: 'web-configurations-list',
73+
id: 'web-configurations',
7174
label: 'web-configurations.configurations.title',
7275
is_nested: true
7376
},
7477
{
75-
id: 'api-configurations',
78+
id: 'api-calls',
7679
label: 'sections.api-configurations'
7780
},
7881
{
@@ -81,7 +84,7 @@ const NAV_ITEMS_CONFIG: NavConfigItem[] = [
8184
is_nested: true
8285
},
8386
{
84-
id: 'api-configurations-list',
87+
id: 'api-configurations',
8588
label: 'web-configurations.configurations.title',
8689
is_nested: true
8790
},
@@ -186,15 +189,17 @@ export const Home: React.FC<Props> = (props) => {
186189

187190
const scroll_container_ref = useRef<HTMLDivElement>(null)
188191
const section_refs = useRef<Record<NavItem, HTMLDivElement | null>>({
189-
general: null,
192+
preferences: null,
190193
'prompt-field': null,
191194
checkpoints: null,
195+
'commit-messages': null,
192196
'edit-format': null,
197+
misc: null,
198+
chatbots: null,
199+
'web-configurations': null,
200+
'api-calls': null,
193201
'model-providers': null,
194202
'api-configurations': null,
195-
'api-configurations-list': null,
196-
'web-configurations': null,
197-
'web-configurations-list': null,
198203
'default-configurations': null,
199204
instructions: null
200205
})
@@ -214,9 +219,9 @@ export const Home: React.FC<Props> = (props) => {
214219
const get_has_warning = (id: NavItem): boolean => {
215220
if (id == 'model-providers') {
216221
return props.providers.length == 0
217-
} else if (id == 'api-configurations') {
222+
} else if (id == 'api-calls' || id == 'api-configurations') {
218223
return props.api_configurations.length == 0
219-
} else if (id == 'web-configurations') {
224+
} else if (id == 'chatbots' || id == 'web-configurations') {
220225
return props.web_configurations.length == 0
221226
} else {
222227
return false
@@ -333,8 +338,8 @@ export const Home: React.FC<Props> = (props) => {
333338
)
334339
})}
335340
>
336-
<GeneralSection
337-
ref={(el) => set_section_ref('general', el)}
341+
<PreferencesSection
342+
ref={(el) => set_section_ref('preferences', el)}
338343
set_section_ref={set_section_ref}
339344
context_size_warning_threshold={props.context_size_warning_threshold}
340345
on_context_size_warning_threshold_change={
@@ -385,7 +390,7 @@ export const Home: React.FC<Props> = (props) => {
385390
/>
386391

387392
<WebConfigurationsSection
388-
ref={(el) => set_section_ref('web-configurations', el)}
393+
ref={(el) => set_section_ref('chatbots', el)}
389394
set_section_ref={set_section_ref}
390395
web_configurations={props.web_configurations}
391396
set_web_configurations={props.set_web_configurations}
@@ -403,7 +408,7 @@ export const Home: React.FC<Props> = (props) => {
403408
/>
404409

405410
<ApiConfigurationsSection
406-
ref={(el) => set_section_ref('api-configurations', el)}
411+
ref={(el) => set_section_ref('api-calls', el)}
407412
set_section_ref={set_section_ref}
408413
providers={props.providers}
409414
set_providers={props.set_providers}

‎apps/editor/src/views/settings/frontend/Home/sections/ApiConfigurationsSection.tsx‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,10 @@ export const ApiConfigurationsSection = forwardRef<HTMLDivElement, Props>(
9696
</UiNotice>
9797
<UiGroup>
9898
<UiItem
99-
title={t('general.intelligent-update.auto-run.title')}
100-
description={t('general.intelligent-update.auto-run.description')}
99+
title={t('preferences.intelligent-update.auto-run.title')}
100+
description={t(
101+
'preferences.intelligent-update.auto-run.description'
102+
)}
101103
slot_right={
102104
<UiToggler
103105
is_on={props.auto_run_intelligent_update}
@@ -160,7 +162,7 @@ export const ApiConfigurationsSection = forwardRef<HTMLDivElement, Props>(
160162
</UiGroup>
161163
</div>
162164

163-
<div ref={(el) => props.set_section_ref('api-configurations-list', el)}>
165+
<div ref={(el) => props.set_section_ref('api-configurations', el)}>
164166
<UiGroup title={t('web-configurations.configurations.title')}>
165167
{props.api_configurations.length == 0 && (
166168
<UiNotice type="warning">

0 commit comments

Comments
 (0)