Chat2API icon indicating copy to clipboard operation
Chat2API copied to clipboard

fix: add save button to settings page with draft mode

Open bennylii opened this issue 7 months ago • 1 comments

Summary

Fixes #76 — settings page changes were not always persisting correctly with the instant-save approach. This PR converts settings controls to draft mode with an explicit save button.

Changes

  • settingsStore: All setters are now synchronous (zustand only), new saveSettings() batches and persists to backend
  • AppearanceSettings: theme, language, sidebar → draft + save button
  • GeneralSettings: autoStart, autoStartProxy, minimizeToTray, closeBehavior, notifications, oauthProxyMode → draft + save button
  • DataManagement: logLevel, logRetentionDays, maxLogs → draft + save button; requestLogConfig stays immediate-save
  • i18n: Added save, saving, saveSuccess, saveFailed keys (zh-CN + en-US)

How it works

  1. User changes any setting → updates local useState draft only
  2. User clicks "Save Settings" button → writes drafts to store → calls saveSettings() to persist via window.electronAPI.config.update()
  3. Toast feedback on success / failure

Closes #76

bennylii avatar Apr 29 '26 02:04 bennylii

@codex review

xiaoY233 avatar May 15 '26 09:05 xiaoY233