Roo-Code/webview-ui/src/components/settings/InterfaceSettings.tsx
Zhang Tony d3c65ceac6
feature: Closable welcome message (#2541)
* draft: try to add a setting button

* Add showGreeting setting and related changes

* i18n: showGreeting

* fix chinese i18n 'dot'
2025-04-13 01:16:01 -04:00

40 lines
1.3 KiB
TypeScript

import { HTMLAttributes } from "react"
import { useAppTranslation } from "@/i18n/TranslationContext"
import { VSCodeCheckbox } from "@vscode/webview-ui-toolkit/react"
import { Monitor } from "lucide-react"
import { SetCachedStateField } from "./types"
import { SectionHeader } from "./SectionHeader"
import { Section } from "./Section"
type InterfaceSettingsProps = HTMLAttributes<HTMLDivElement> & {
showGreeting?: boolean
setCachedStateField: SetCachedStateField<"showGreeting">
}
export const InterfaceSettings = ({ showGreeting, setCachedStateField, ...props }: InterfaceSettingsProps) => {
const { t } = useAppTranslation()
return (
<div {...props}>
<SectionHeader>
<div className="flex items-center gap-2">
<Monitor className="w-4" />
<div>{t("settings:sections.interface")}</div>
</div>
</SectionHeader>
<Section>
<div>
<VSCodeCheckbox
checked={showGreeting}
onChange={(e: any) => setCachedStateField("showGreeting", e.target.checked)}>
<span className="font-medium">{t("settings:interface.showgreeting.label")}</span>
</VSCodeCheckbox>
<div className="text-vscode-descriptionForeground text-sm mt-1">
{t("settings:interface.showgreeting.description")}
</div>
</div>
</Section>
</div>
)
}