Skip to content

Commit 4816aa4

Browse files
committed
Improve UI to make Save more visible
1 parent 93db0fd commit 4816aa4

File tree

1 file changed

+27
-35
lines changed

1 file changed

+27
-35
lines changed

src/renderer/components/Experiment/Interact/SystemMessageBox.tsx

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,22 @@ import {
22
Button,
33
Checkbox,
44
FormControl,
5-
FormHelperText,
65
FormLabel,
76
Sheet,
87
Textarea,
98
} from '@mui/joy';
109
import { useEffect, useState } from 'react';
11-
import { RotateCcwIcon } from 'lucide-react';
1210

1311
import * as chatAPI from '../../../lib/transformerlab-api-sdk';
1412
import SafeJSONParse from '../../Shared/SafeJSONParse';
1513

1614
export default function SystemMessageBox({
1715
experimentInfo,
1816
experimentInfoMutate,
19-
showResetButton = false,
2017
defaultPromptConfigForModel = {},
2118
}: {
2219
experimentInfo: any;
2320
experimentInfoMutate: () => void;
24-
showResetButton?: boolean;
2521
defaultPromptConfigForModel?: any;
2622
}) {
2723
// Check if override is enabled from experiment config
@@ -204,6 +200,7 @@ export default function SystemMessageBox({
204200
flex: '0 0 130px',
205201
overflow: 'auto',
206202
padding: 2,
203+
position: 'relative',
207204
}}
208205
>
209206
<FormControl>
@@ -220,9 +217,35 @@ export default function SystemMessageBox({
220217
'--Textarea-focusedHighlight': 'transparent !important',
221218
opacity: isOverrideEnabled ? 1 : 0.7,
222219
cursor: isOverrideEnabled ? 'text' : 'default',
220+
paddingBottom: isOverrideEnabled && hasEdited ? '40px' : '0px',
223221
}}
224222
/>
225223
</FormControl>
224+
225+
{isOverrideEnabled && hasEdited && (
226+
<div
227+
style={{
228+
position: 'absolute',
229+
bottom: '8px',
230+
right: '8px',
231+
display: 'flex',
232+
gap: '8px',
233+
alignItems: 'center',
234+
}}
235+
>
236+
<Button
237+
size="sm"
238+
variant="solid"
239+
onClick={handleSave}
240+
sx={{
241+
padding: '4px 12px',
242+
fontSize: '12px',
243+
}}
244+
>
245+
Save
246+
</Button>
247+
</div>
248+
)}
226249
</Sheet>
227250

228251
<FormControl sx={{ marginTop: 1, marginBottom: 1 }}>
@@ -238,37 +261,6 @@ export default function SystemMessageBox({
238261
}}
239262
/>
240263
</FormControl>
241-
242-
<FormHelperText
243-
sx={{ display: 'flex', gap: 1, justifyContent: 'flex-end' }}
244-
>
245-
{isOverrideEnabled && hasEdited && (
246-
<Button size="sm" variant="soft" onClick={handleSave}>
247-
Save
248-
</Button>
249-
)}
250-
251-
{showResetButton && isOverrideEnabled && (
252-
<Button
253-
variant="plain"
254-
startDecorator={<RotateCcwIcon size="14px" />}
255-
onClick={() => {
256-
setCustomSystemMessage(
257-
defaultPromptConfigForModel?.system_message || '',
258-
);
259-
setHasEdited(true);
260-
}}
261-
sx={{
262-
padding: '2px',
263-
margin: '0px',
264-
minHeight: 'unset',
265-
marginLeft: 'auto',
266-
}}
267-
>
268-
Reset to Default
269-
</Button>
270-
)}
271-
</FormHelperText>
272264
</div>
273265
);
274266
}

0 commit comments

Comments
 (0)