import { DEFAULT_UNIFIED_SETTINGS } from "@t3tools/contracts/settings"; import { AdvancedSettings } from "./AdvancedSettings"; import { BranchNamingSettings } from "./BranchNamingSettings"; import { WorktreeSubmodulesRow } from "./ProjectDefaultsSettings"; import { ScopedSwitch } from "./ScopedSwitch"; import { useSettingsScope } from "./SettingsScopeContext"; import { SettingResetButton, SettingsPageContainer, SettingsRow, SettingsSection, } from "./settingsLayout"; import { searchableSetting } from "./settingsSearch"; import { WorktreeCleanupSection, WorktreesDirectoryRow } from "./StorageSettings"; import { useScopedSettings, useScopedSettingsMixed, useUpdateScopedSettings, } from "./useScopedSettings"; function StartFromRemoteRow() { const settings = useScopedSettings(); const updateSettings = useUpdateScopedSettings(); return ( updateSettings({ newWorktreesStartFromOrigin: DEFAULT_UNIFIED_SETTINGS.newWorktreesStartFromOrigin, }) } /> ) : null } control={ updateSettings({ newWorktreesStartFromOrigin: Boolean(checked) }) } aria-label="Start new worktrees from remote by default" /> } /> ); } function FastCheckoutRow() { const { connectedEnvironments } = useSettingsScope(); const settings = useScopedSettings(); const updateSettings = useUpdateScopedSettings(); const mixed = useScopedSettingsMixed(["fastWorktreeCheckout"]); if ( connectedEnvironments.length === 0 || connectedEnvironments.some( (environment) => environment.serverConfig?.environment.capabilities.fastWorktreeCheckout !== true, ) ) return null; return ( updateSettings({ fastWorktreeCheckout: DEFAULT_UNIFIED_SETTINGS.fastWorktreeCheckout, }) } /> ) : null } control={ updateSettings({ fastWorktreeCheckout: Boolean(checked) })} aria-label="Clone new worktrees from a cached checkout" /> } /> ); } export function WorktreesSettingsPanel() { const { scope } = useSettingsScope(); const isProjectScope = scope.kind === "project" || scope.kind === "checkout"; return ( {!isProjectScope && } {!isProjectScope && } ); }