mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
* Use the Slider component everywhere * onValueCommit -> onValueChange * More cleanup * Fix tests * Add missing translations * Update webview-ui/src/components/settings/ContextManagementSettings.tsx Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * SelectDropdown fixes * Fix tests --------- Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
93 lines
3 KiB
TypeScript
93 lines
3 KiB
TypeScript
import { HTMLAttributes } from "react"
|
|
import { useAppTranslation } from "@/i18n/TranslationContext"
|
|
import { VSCodeCheckbox } from "@vscode/webview-ui-toolkit/react"
|
|
import { Database } from "lucide-react"
|
|
|
|
import { cn } from "@/lib/utils"
|
|
import { Slider } from "@/components/ui"
|
|
|
|
import { SetCachedStateField } from "./types"
|
|
import { SectionHeader } from "./SectionHeader"
|
|
import { Section } from "./Section"
|
|
|
|
type ContextManagementSettingsProps = HTMLAttributes<HTMLDivElement> & {
|
|
maxOpenTabsContext: number
|
|
maxWorkspaceFiles: number
|
|
showRooIgnoredFiles?: boolean
|
|
setCachedStateField: SetCachedStateField<"maxOpenTabsContext" | "maxWorkspaceFiles" | "showRooIgnoredFiles">
|
|
}
|
|
|
|
export const ContextManagementSettings = ({
|
|
maxOpenTabsContext,
|
|
maxWorkspaceFiles,
|
|
showRooIgnoredFiles,
|
|
setCachedStateField,
|
|
className,
|
|
...props
|
|
}: ContextManagementSettingsProps) => {
|
|
const { t } = useAppTranslation()
|
|
return (
|
|
<div className={cn("flex flex-col gap-2", className)} {...props}>
|
|
<SectionHeader description={t("settings:contextManagement.description")}>
|
|
<div className="flex items-center gap-2">
|
|
<Database className="w-4" />
|
|
<div>{t("settings:sections.contextManagement")}</div>
|
|
</div>
|
|
</SectionHeader>
|
|
|
|
<Section>
|
|
<div>
|
|
<span className="block font-medium mb-1">{t("settings:contextManagement.openTabs.label")}</span>
|
|
<div className="flex items-center gap-2">
|
|
<Slider
|
|
min={0}
|
|
max={500}
|
|
step={1}
|
|
value={[maxOpenTabsContext ?? 20]}
|
|
onValueChange={([value]) => setCachedStateField("maxOpenTabsContext", value)}
|
|
data-testid="open-tabs-limit-slider"
|
|
/>
|
|
<span className="w-10">{maxOpenTabsContext ?? 20}</span>
|
|
</div>
|
|
<div className="text-vscode-descriptionForeground text-sm mt-1">
|
|
{t("settings:contextManagement.openTabs.description")}
|
|
</div>
|
|
</div>
|
|
|
|
<div>
|
|
<span className="block font-medium mb-1">
|
|
{t("settings:contextManagement.workspaceFiles.label")}
|
|
</span>
|
|
<div className="flex items-center gap-2">
|
|
<Slider
|
|
min={0}
|
|
max={500}
|
|
step={1}
|
|
value={[maxWorkspaceFiles ?? 200]}
|
|
onValueChange={([value]) => setCachedStateField("maxWorkspaceFiles", value)}
|
|
data-testid="workspace-files-limit-slider"
|
|
/>
|
|
<span className="w-10">{maxWorkspaceFiles ?? 200}</span>
|
|
</div>
|
|
<div className="text-vscode-descriptionForeground text-sm mt-1">
|
|
{t("settings:contextManagement.workspaceFiles.description")}
|
|
</div>
|
|
</div>
|
|
|
|
<div>
|
|
<VSCodeCheckbox
|
|
checked={showRooIgnoredFiles}
|
|
onChange={(e: any) => setCachedStateField("showRooIgnoredFiles", e.target.checked)}
|
|
data-testid="show-rooignored-files-checkbox">
|
|
<label className="block font-medium mb-1">
|
|
{t("settings:contextManagement.rooignore.label")}
|
|
</label>
|
|
</VSCodeCheckbox>
|
|
<div className="text-vscode-descriptionForeground text-sm mt-1">
|
|
{t("settings:contextManagement.rooignore.description")}
|
|
</div>
|
|
</div>
|
|
</Section>
|
|
</div>
|
|
)
|
|
}
|