Files
AgentHub/client/src/components/settings/WorktreeVisibilitySettings.tsx
T
nntrivi2001 d0535af626 feat(ui): a Claude-Desktop-style home for every workspace
/workspace?lane=<id> opens on the workspace's home (WorkspaceHome): a prompt
box whose Start opens a new session in the first free pane slot, Recents (a
live session attaches its pane, any other opens its transcript, nothing
resumes), and Instructions / Memory / Context / Folder. Instructions live in
lanes.instructions, extra folders and uploaded files in the new lane_sources
table (copies under <data dir>/workspace-context/<lane id>/); spawnRun reads
them from the lane's rows and hands Claude --add-dir + an appended system
prompt file, Codex --add-dir + developer_instructions. Memory is read-only.

Every dashboard pane carries AGENTHUB_RUN_ID; hooks forward it and the run
records which session the pane holds (a Claude pane follows /clear and
/resume but not a nested claude -p), so the sidebar and notifications open
the right pane (&run=). Settings loses its Projects group; Worktrees now
decides which worktrees Add folder suggests.
2026-10-02 01:10:58 +07:00

61 lines
2.0 KiB
TypeScript

/**
* @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ĩ <vinnt@smartgift.vn>
*/
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) => (
<SettingsSwitchRow
key={src}
label={t(`worktrees.${src}`)}
description={t(`worktrees.${src}Desc`)}
checked={!hidden.includes(src)}
disabled={disabled}
onChange={(show) => onChange(show ? hidden.filter((s) => s !== src) : [...hidden, src])}
/>
))}
</>
);
}
export function WorktreeVisibilitySettings() {
const { t } = useTranslation("settings");
const prefs = useProjectTreePrefs();
return (
<SettingsSection title={t("worktrees.title")} description={t("worktrees.description")}>
<SettingsSwitchRow
label={t("worktrees.showUntracked")}
description={t("worktrees.showUntrackedDesc")}
checked={prefs.showUntracked}
onChange={(showUntracked) => writeProjectTreePrefs({ showUntracked })}
/>
<SourceSwitches
hidden={prefs.hideSources}
disabled={!prefs.showUntracked}
onChange={(hideSources) => writeProjectTreePrefs({ hideSources })}
/>
</SettingsSection>
);
}