- feat(vscode-sync): restore auto-sync logic and enable by default

- refactor(settings): remove the VS Code auto-sync toggle from Settings UI
- feat(provider-list): enable auto-sync after "Apply to VS Code"; disable after "Remove"
- chore(prettier): run Prettier on changed files
- verify: typecheck and renderer build pass

- Files
  - added: src/hooks/useVSCodeAutoSync.ts
  - modified: src/App.tsx
  - modified: src/components/ProviderList.tsx
  - modified: src/components/SettingsModal.tsx

- Notes
  - Auto-sync now defaults to enabled for new users (stored in localStorage; existing saved state is respected).
  - No settings toggle is shown; manual Apply/Remove in the list still works as before.
This commit is contained in:
Jason
2025-09-19 15:48:35 +08:00
parent 7522ba3e03
commit 31cdc2a5cf
3 changed files with 12 additions and 29 deletions

View File

@@ -11,7 +11,6 @@ import { getVersion } from "@tauri-apps/api/app";
import "../lib/tauri-api";
import { relaunchApp } from "../lib/updater";
import { useUpdate } from "../contexts/UpdateContext";
import { useVSCodeAutoSync } from "../hooks/useVSCodeAutoSync";
import type { Settings } from "../types";
interface SettingsModalProps {
@@ -29,7 +28,6 @@ export default function SettingsModal({ onClose }: SettingsModalProps) {
const [showUpToDate, setShowUpToDate] = useState(false);
const { hasUpdate, updateInfo, updateHandle, checkUpdate, resetDismiss } =
useUpdate();
const { isAutoSyncEnabled, toggleAutoSync } = useVSCodeAutoSync();
useEffect(() => {
loadSettings();
@@ -203,28 +201,7 @@ export default function SettingsModal({ onClose }: SettingsModalProps) {
</label>
</div> */}
{/* VS Code 自动同步设置 */}
<div>
<h3 className="text-sm font-medium text-gray-900 dark:text-gray-100 mb-3">
Codex
</h3>
<label className="flex items-center justify-between cursor-pointer">
<div className="flex-1">
<span className="text-sm text-gray-700 dark:text-gray-300">
VS Code
</span>
<p className="text-xs text-gray-500 dark:text-gray-400 mt-0.5">
Codex VS Code
</p>
</div>
<input
type="checkbox"
checked={isAutoSyncEnabled}
onChange={toggleAutoSync}
className="w-4 h-4 text-blue-500 rounded focus:ring-blue-500/20"
/>
</label>
</div>
{/* VS Code 自动同步设置已移除 */}
{/* 配置文件位置 */}
<div>