Skip to content

Commit 47d6b78

Browse files
committed
Refactor Separator component to use inline styles, update UI spacing, and remove the collapsible Options section from the web configuration form
- make the prop accepted separator height flexible (number) - disable collapsing 'options'
1 parent 99b060d commit 47d6b78

4 files changed

Lines changed: 5 additions & 40 deletions

File tree

‎apps/editor/src/views/panel/frontend/Main/MainView/MainView.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ export const MainView: React.FC<Props> = (props) => {
442442

443443
{props.mode == MODE.WEB && (
444444
<>
445-
<UiSeparator height={8} />
445+
<UiSeparator height={6} />
446446
<UiConfigurations
447447
configurations={web_configurations}
448448
disable_invocation={!!warning || !props.is_connected}
@@ -497,7 +497,7 @@ export const MainView: React.FC<Props> = (props) => {
497497

498498
{props.mode == MODE.API && (
499499
<>
500-
<UiSeparator height={8} />
500+
<UiSeparator height={6} />
501501
<UiConfigurations
502502
configurations={api_configurations_ui}
503503
disable_invocation={!!warning}

‎apps/editor/src/views/shared/components/EditWebConfigurationForm/EditWebConfigurationForm.tsx‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ export const EditWebConfigurationForm: React.FC<Props> = (props) => {
4949
const [is_sampling_collapsed, set_is_sampling_collapsed] = useState(
5050
props.web_configuration.temperature === undefined && props.web_configuration.top_p === undefined
5151
)
52-
const [is_options_collapsed, set_is_options_collapsed] = useState(
53-
(props.web_configuration.options || []).length == 0
54-
)
5552

5653
const chatbot_config = chatbot ? CHATBOTS[chatbot] : undefined
5754
const models = useMemo(() => chatbot_config?.models || {}, [chatbot_config])
@@ -384,10 +381,6 @@ export const EditWebConfigurationForm: React.FC<Props> = (props) => {
384381
Object.keys(chatbot_config?.supported_options || {}).length > 0 && (
385382
<UiFieldset
386383
label="Options"
387-
is_collapsed={is_options_collapsed}
388-
on_toggle_collapsed={() =>
389-
set_is_options_collapsed(!is_options_collapsed)
390-
}
391384
>
392385
<div className={styles.options}>
393386
{Object.entries(chatbot_config!.supported_options!).map(
Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,3 @@
11
.separator {
22
flex-shrink: 0;
3-
4-
&--4 {
5-
height: 4px;
6-
}
7-
8-
&--8 {
9-
height: 8px;
10-
}
11-
12-
&--12 {
13-
height: 12px;
14-
}
15-
16-
&--14 {
17-
height: 14px;
18-
}
19-
20-
&--16 {
21-
height: 16px;
22-
}
23-
24-
&--10 {
25-
height: 10px;
26-
}
27-
28-
&--24 {
29-
height: 24px;
30-
}
313
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import styles from './Separator.module.scss'
2-
import cn from 'classnames'
32

43
export namespace Separator {
54
export type Props = {
6-
height: 4 | 8 | 10 | 12 | 14 | 16 | 24
5+
height: number
76
}
87
}
98

109
export const Separator: React.FC<Separator.Props> = (props) => {
1110
return (
1211
<div
13-
className={cn(styles.separator, styles[`separator--${props.height}`])}
12+
className={styles.separator}
13+
style={{ height: `${props.height}px` }}
1414
/>
1515
)
1616
}

0 commit comments

Comments
 (0)