/** * @file WorktreeVisibilitySettings — Settings → Git → Worktrees: whether a * workspace home's Add folder suggests the repo's untracked worktrees, and * which sources of them (`.claude/worktrees/*`, AgentHub-managed) it leaves * out. Writes the localStorage prefs in `lib/projectTreePrefs.ts`. * @author Nguyễn Ngọc Trí Vĩ */ import { useTranslation } from "react-i18next"; import { useProjectTreePrefs, writeProjectTreePrefs } from "../../lib/projectTreePrefs"; import { SettingsSection, SettingsSwitchRow } from "./SettingsRow"; export const WORKTREE_SOURCES = ["claude", "agenthub"] as const; /** Show/hide switches for each source over a `hideSources` list. */ export function SourceSwitches({ hidden, onChange, disabled = false, }: { hidden: string[]; onChange: (hidden: string[]) => void; disabled?: boolean; }) { const { t } = useTranslation("settings"); return ( <> {WORKTREE_SOURCES.map((src) => ( onChange(show ? hidden.filter((s) => s !== src) : [...hidden, src])} /> ))} ); } export function WorktreeVisibilitySettings() { const { t } = useTranslation("settings"); const prefs = useProjectTreePrefs(); return ( writeProjectTreePrefs({ showUntracked })} /> ); }