import type { ReactNode } from "react"; import { IconButton } from "../IconButton"; import { SettingRow, SettingRowBoolean, SettingRowSelect, SettingSelectControl, SettingsList, SettingsSection, SettingValue, } from "./SettingRow"; import { SettingsPage } from "./SettingsPage"; import type { SettingsCallbacks, SettingsView } from "./types"; export interface SettingsGeneralProps { view: SettingsView; callbacks: SettingsCallbacks; /** Shown under the heading, like the client's commercial-use banner */ banner?: ReactNode; /** Sections only this app has, shown before App Info */ extraSections?: ReactNode; } export function SettingsGeneral({ view, callbacks, banner, extraSections }: SettingsGeneralProps) { const { app, values } = view; return ( {view.updates != null && } {view.feedbackPrompts && ( callbacks.onChange({ promptFeedback })} /> )} {extraSections} callbacks.onRevealPath(app.dataDir), }, ]} /> callbacks.onRevealPath(app.logDir), }, ]} /> ); } /** The update channel, how updates install, and the check button */ export function SettingsUpdatesSection({ view, callbacks, }: { view: Pick; callbacks: Pick; }) { const { app, values } = view; return (
callbacks.onChange({ updateChannel })} options={[ { label: "Stable", value: "stable" }, { label: "Beta", value: "beta" }, ]} /> callbacks.onCheckForUpdates()} />
callbacks.onChange({ autoupdate: v === "auto" })} options={[ { label: "Automatic", value: "auto" }, { label: "Manual", value: "manual" }, ]} /> callbacks.onChange({ autoDownloadUpdates })} /> callbacks.onChange({ checkNotifications })} /> {}} />
); }