Skip to content

Commit 716f12e

Browse files
authored
Merge pull request continuedev#4760 from continuedev/dallin/better-toggles
Settings toggle improvements
2 parents 4664f61 + 171ab83 commit 716f12e

File tree

3 files changed

+45
-40
lines changed

3 files changed

+45
-40
lines changed

gui/src/components/gui/Switch.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from "react";
2+
import { vscButtonBackground } from "..";
23

34
type ToggleSwitchProps = {
45
isToggled: boolean;
@@ -28,7 +29,10 @@ const ToggleSwitch: React.FC<ToggleSwitchProps> = ({
2829
>
2930
<div className="relative h-full w-full">
3031
<div
31-
className={`absolute left-1/4 top-0 h-full w-1/2 transform rounded-full transition-all ${isToggled ? "translate-x-1/2 bg-green-500" : "-translate-x-1/2 bg-red-500"}`}
32+
className={`absolute left-1/4 top-0 h-full w-1/2 transform rounded-full border-[0.2px] border-solid transition-all ${isToggled ? "translate-x-1/2 brightness-150" : "-translate-x-1/2 brightness-75"}`}
33+
style={{
34+
backgroundColor: isToggled ? vscButtonBackground : "",
35+
}}
3236
/>
3337
</div>
3438
</div>

gui/src/pages/config/index.tsx

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,17 @@ function ConfigPage() {
8989
}
9090

9191
// TODO defaults are in multiple places, should be consolidated and probably not explicit here
92-
const showSessionTabs = config.ui?.showSessionTabs ?? false;
92+
const enableSessionTabs = config.ui?.showSessionTabs ?? false;
9393
const codeWrap = config.ui?.codeWrap ?? false;
9494
const showChatScrollbar = config.ui?.showChatScrollbar ?? false;
95-
const displayRawMarkdown = config.ui?.displayRawMarkdown ?? false;
96-
const disableSessionTitles = config.disableSessionTitles ?? false;
95+
const formatMarkdownOutput = !(config.ui?.displayRawMarkdown ?? false);
96+
const enableSessionTitles = !(config.disableSessionTitles ?? false);
9797
const readResponseTTS = config.experimental?.readResponseTTS ?? false;
9898

9999
const allowAnonymousTelemetry = config.allowAnonymousTelemetry ?? true;
100-
const disableIndexing = config.disableIndexing ?? false;
100+
const enableIndexing = !(config.disableIndexing ?? false);
101101

102-
const useAutocompleteCache = config.tabAutocompleteOptions?.useCache ?? false;
102+
const useAutocompleteCache = config.tabAutocompleteOptions?.useCache ?? true;
103103
const useChromiumForDocsCrawling =
104104
config.experimental?.useChromiumForDocsCrawling ?? false;
105105
const codeBlockToolbarPosition = config.ui?.codeBlockToolbarPosition ?? "top";
@@ -217,10 +217,10 @@ function ConfigPage() {
217217

218218
<div className="flex flex-col gap-4">
219219
<ToggleSwitch
220-
isToggled={showSessionTabs}
220+
isToggled={enableSessionTabs}
221221
onToggle={() =>
222222
handleUpdate({
223-
showSessionTabs: !showSessionTabs,
223+
showSessionTabs: !enableSessionTabs,
224224
})
225225
}
226226
text="Show Session Tabs"
@@ -234,82 +234,83 @@ function ConfigPage() {
234234
}
235235
text="Wrap Codeblocks"
236236
/>
237+
237238
<ToggleSwitch
238-
isToggled={displayRawMarkdown}
239+
isToggled={showChatScrollbar}
239240
onToggle={() =>
240241
handleUpdate({
241-
displayRawMarkdown: !displayRawMarkdown,
242+
showChatScrollbar: !showChatScrollbar,
242243
})
243244
}
244-
text="Display Raw Markdown"
245+
text="Show Chat Scrollbar"
245246
/>
246247
<ToggleSwitch
247-
isToggled={allowAnonymousTelemetry}
248+
isToggled={readResponseTTS}
248249
onToggle={() =>
249250
handleUpdate({
250-
allowAnonymousTelemetry: !allowAnonymousTelemetry,
251+
readResponseTTS: !readResponseTTS,
251252
})
252253
}
253-
text="Allow Anonymous Telemetry"
254+
text="Text to Speech Output"
254255
/>
255-
<ToggleSwitch
256-
isToggled={disableIndexing}
256+
257+
{/* <ToggleSwitch
258+
isToggled={useChromiumForDocsCrawling}
257259
onToggle={() =>
258260
handleUpdate({
259-
disableIndexing: !disableIndexing,
261+
useChromiumForDocsCrawling: !useChromiumForDocsCrawling,
260262
})
261263
}
262-
text="Disable Indexing"
263-
/>
264-
264+
text="Use Chromium for Docs Crawling"
265+
/> */}
265266
<ToggleSwitch
266-
isToggled={disableSessionTitles}
267+
isToggled={enableSessionTitles}
267268
onToggle={() =>
268269
handleUpdate({
269-
disableSessionTitles: !disableSessionTitles,
270+
disableSessionTitles: !enableSessionTitles,
270271
})
271272
}
272-
text="Disable Session Titles"
273+
text="Enable Session Titles"
273274
/>
274275
<ToggleSwitch
275-
isToggled={readResponseTTS}
276+
isToggled={formatMarkdownOutput}
276277
onToggle={() =>
277278
handleUpdate({
278-
readResponseTTS: !readResponseTTS,
279+
displayRawMarkdown: !formatMarkdownOutput,
279280
})
280281
}
281-
text="Response Text to Speech"
282+
text="Format Markdown"
282283
/>
283284

284285
<ToggleSwitch
285-
isToggled={showChatScrollbar}
286+
isToggled={allowAnonymousTelemetry}
286287
onToggle={() =>
287288
handleUpdate({
288-
showChatScrollbar: !showChatScrollbar,
289+
allowAnonymousTelemetry: !allowAnonymousTelemetry,
289290
})
290291
}
291-
text="Show Chat Scrollbar"
292+
text="Allow Anonymous Telemetry"
292293
/>
293294

294295
<ToggleSwitch
295-
isToggled={useAutocompleteCache}
296+
isToggled={enableIndexing}
296297
onToggle={() =>
297298
handleUpdate({
298-
useAutocompleteCache: !useAutocompleteCache,
299+
disableIndexing: !enableIndexing,
299300
})
300301
}
301-
text="Use Autocomplete Cache"
302+
text="Enable Indexing"
302303
/>
303304

304-
<ToggleSwitch
305-
isToggled={useChromiumForDocsCrawling}
305+
{/* <ToggleSwitch
306+
isToggled={useAutocompleteCache}
306307
onToggle={() =>
307308
handleUpdate({
308-
useChromiumForDocsCrawling: !useChromiumForDocsCrawling,
309+
useAutocompleteCache: !useAutocompleteCache,
309310
})
310311
}
311-
text="Use Chromium for Docs Crawling"
312-
/>
312+
text="Use Autocomplete Cache"
313+
/> */}
313314

314315
<label className="flex items-center justify-between gap-3">
315316
<span className="lines lines-1 text-left">

gui/src/pages/gui/Chat.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ export function Chat() {
322322
[history],
323323
);
324324

325-
const showScrollbar = showChatScrollbar || window.innerHeight > 5000;
325+
const showScrollbar = showChatScrollbar ?? window.innerHeight > 5000;
326326

327327
useAutoScroll(stepsDivRef, history);
328328

@@ -451,8 +451,8 @@ export function Chat() {
451451
</div>
452452
))}
453453
</StepsDiv>
454-
<div className={`relative`}>
455-
<div className="absolute -top-8 right-2 z-30">
454+
<div className={`relative mt-1`}>
455+
<div className="absolute -top-8 right-2 z-30 flex flex-col gap-1">
456456
{ttsActive && (
457457
<StopButton
458458
className=""

0 commit comments

Comments
 (0)