refactor(settings): rename Dock setting to system tray (showInDock → showInTray)
- compat: map legacy showInDock to showInTray when loading settings - ui(copy): clarify “system tray (menu bar)” vs Dock in SettingsModal - tauri(settings): return showInTray in get_settings; adjust default fallback - docs(comment): align comments to “system tray” terminology across code - note: no functional change yet; tray visibility toggle remains unimplemented
This commit is contained in:
@@ -19,7 +19,7 @@ interface SettingsModalProps {
|
||||
|
||||
export default function SettingsModal({ onClose }: SettingsModalProps) {
|
||||
const [settings, setSettings] = useState<Settings>({
|
||||
showInDock: true,
|
||||
showInTray: true,
|
||||
});
|
||||
const [configPath, setConfigPath] = useState<string>("");
|
||||
const [version, setVersion] = useState<string>("");
|
||||
@@ -49,8 +49,11 @@ export default function SettingsModal({ onClose }: SettingsModalProps) {
|
||||
const loadSettings = async () => {
|
||||
try {
|
||||
const loadedSettings = await window.api.getSettings();
|
||||
if (loadedSettings?.showInDock !== undefined) {
|
||||
setSettings({ showInDock: loadedSettings.showInDock });
|
||||
if ((loadedSettings as any)?.showInTray !== undefined) {
|
||||
setSettings({ showInTray: (loadedSettings as any).showInTray });
|
||||
} else if ((loadedSettings as any)?.showInDock !== undefined) {
|
||||
// 向后兼容:若历史上有 showInDock,则映射为 showInTray
|
||||
setSettings({ showInTray: (loadedSettings as any).showInDock });
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("加载设置失败:", error);
|
||||
@@ -171,20 +174,21 @@ export default function SettingsModal({ onClose }: SettingsModalProps) {
|
||||
|
||||
{/* 设置内容 */}
|
||||
<div className="px-6 py-4 space-y-6">
|
||||
{/* 显示设置 - 功能还未实现 */}
|
||||
{/* 系统托盘设置(未实现)
|
||||
说明:此开关用于控制是否在系统托盘/菜单栏显示应用图标。 */}
|
||||
{/* <div>
|
||||
<h3 className="text-sm font-medium text-gray-900 dark:text-gray-100 mb-3">
|
||||
显示设置
|
||||
显示设置(系统托盘)
|
||||
</h3>
|
||||
<label className="flex items-center justify-between">
|
||||
<span className="text-sm text-gray-500">
|
||||
在 Dock 中显示(macOS)
|
||||
在菜单栏显示图标(系统托盘)
|
||||
</span>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={settings.showInDock}
|
||||
checked={settings.showInTray}
|
||||
onChange={(e) =>
|
||||
setSettings({ ...settings, showInDock: e.target.checked })
|
||||
setSettings({ ...settings, showInTray: e.target.checked })
|
||||
}
|
||||
className="w-4 h-4 text-blue-500 rounded focus:ring-blue-500/20"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user