toggle improvements

This commit is contained in:
Dallin Romney 2025-03-21 15:36:54 -07:00
parent 71f5dda5b5
commit 2cd90254c9
3 changed files with 65 additions and 60 deletions

View file

@ -1,4 +1,5 @@
import React from "react";
import { vscButtonBackground } from "..";
type ToggleSwitchProps = {
isToggled: boolean;
@ -21,7 +22,10 @@ const ToggleSwitch: React.FC<ToggleSwitchProps> = ({
>
<div className="relative h-full w-full">
<div
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"}`}
className={`absolute left-1/4 top-0 h-full w-1/2 transform rounded-full transition-all ${isToggled ? "translate-x-1/2" : "-translate-x-1/2"}`}
style={{
backgroundColor: isToggled ? vscButtonBackground : "lightgray",
}}
/>
</div>
</div>

View file

@ -89,17 +89,17 @@ function ConfigPage() {
}
// TODO defaults are in multiple places, should be consolidated and probably not explicit here
const showSessionTabs = config.ui?.showSessionTabs ?? false;
const enableSessionTabs = config.ui?.showSessionTabs ?? false;
const codeWrap = config.ui?.codeWrap ?? false;
const showChatScrollbar = config.ui?.showChatScrollbar ?? false;
const displayRawMarkdown = config.ui?.displayRawMarkdown ?? false;
const disableSessionTitles = config.disableSessionTitles ?? false;
const formatMarkdownOutput = !(config.ui?.displayRawMarkdown ?? false);
const enableSessionTitles = !(config.disableSessionTitles ?? false);
const readResponseTTS = config.experimental?.readResponseTTS ?? false;
const allowAnonymousTelemetry = config.allowAnonymousTelemetry ?? true;
const disableIndexing = config.disableIndexing ?? false;
const enableIndexing = !(config.disableIndexing ?? false);
const useAutocompleteCache = config.tabAutocompleteOptions?.useCache ?? false;
const useAutocompleteCache = config.tabAutocompleteOptions?.useCache ?? true;
const useChromiumForDocsCrawling =
config.experimental?.useChromiumForDocsCrawling ?? false;
const codeBlockToolbarPosition = config.ui?.codeBlockToolbarPosition ?? "top";
@ -217,10 +217,10 @@ function ConfigPage() {
<div className="flex flex-col gap-4">
<ToggleSwitch
isToggled={showSessionTabs}
isToggled={enableSessionTabs}
onToggle={() =>
handleUpdate({
showSessionTabs: !showSessionTabs,
showSessionTabs: !enableSessionTabs,
})
}
text="Show Session Tabs"
@ -234,52 +234,6 @@ function ConfigPage() {
}
text="Wrap Codeblocks"
/>
<ToggleSwitch
isToggled={displayRawMarkdown}
onToggle={() =>
handleUpdate({
displayRawMarkdown: !displayRawMarkdown,
})
}
text="Display Raw Markdown"
/>
<ToggleSwitch
isToggled={allowAnonymousTelemetry}
onToggle={() =>
handleUpdate({
allowAnonymousTelemetry: !allowAnonymousTelemetry,
})
}
text="Allow Anonymous Telemetry"
/>
<ToggleSwitch
isToggled={disableIndexing}
onToggle={() =>
handleUpdate({
disableIndexing: !disableIndexing,
})
}
text="Disable Indexing"
/>
<ToggleSwitch
isToggled={disableSessionTitles}
onToggle={() =>
handleUpdate({
disableSessionTitles: !disableSessionTitles,
})
}
text="Disable Session Titles"
/>
<ToggleSwitch
isToggled={readResponseTTS}
onToggle={() =>
handleUpdate({
readResponseTTS: !readResponseTTS,
})
}
text="Response Text to Speech"
/>
<ToggleSwitch
isToggled={showChatScrollbar}
@ -290,18 +244,17 @@ function ConfigPage() {
}
text="Show Chat Scrollbar"
/>
<ToggleSwitch
isToggled={useAutocompleteCache}
isToggled={readResponseTTS}
onToggle={() =>
handleUpdate({
useAutocompleteCache: !useAutocompleteCache,
readResponseTTS: !readResponseTTS,
})
}
text="Use Autocomplete Cache"
text="Text to Speech Output"
/>
<ToggleSwitch
{/* <ToggleSwitch
isToggled={useChromiumForDocsCrawling}
onToggle={() =>
handleUpdate({
@ -309,7 +262,55 @@ function ConfigPage() {
})
}
text="Use Chromium for Docs Crawling"
/> */}
<ToggleSwitch
isToggled={enableSessionTitles}
onToggle={() =>
handleUpdate({
disableSessionTitles: !enableSessionTitles,
})
}
text="Enable Session Titles"
/>
<ToggleSwitch
isToggled={formatMarkdownOutput}
onToggle={() =>
handleUpdate({
displayRawMarkdown: !formatMarkdownOutput,
})
}
text="Format Markdown"
/>
<ToggleSwitch
isToggled={allowAnonymousTelemetry}
onToggle={() =>
handleUpdate({
allowAnonymousTelemetry: !allowAnonymousTelemetry,
})
}
text="Allow Anonymous Telemetry"
/>
<ToggleSwitch
isToggled={enableIndexing}
onToggle={() =>
handleUpdate({
disableIndexing: !enableIndexing,
})
}
text="Enable Indexing"
/>
{/* <ToggleSwitch
isToggled={useAutocompleteCache}
onToggle={() =>
handleUpdate({
useAutocompleteCache: !useAutocompleteCache,
})
}
text="Use Autocomplete Cache"
/> */}
<label className="flex items-center justify-between gap-3">
<span className="lines lines-1 text-left">

View file

@ -451,7 +451,7 @@ export function Chat() {
</div>
))}
</StepsDiv>
<div className={`relative`}>
<div className={`relative mt-1`}>
<div className="absolute -top-8 right-2 z-30">
{ttsActive && (
<StopButton