From 70ff9fa0ad3df3fb8a49decbf9d7743810ed18c4 Mon Sep 17 00:00:00 2001 From: MrKBear Date: Fri, 20 May 2022 14:41:52 +0800 Subject: [PATCH] Add setting option --- source/Component/CommandBar/CommandBar.tsx | 5 --- .../Component/SettingPopup/SettingPopup.scss | 2 + .../Component/SettingPopup/SettingPopup.tsx | 39 ++++++++++++++++++- source/Localization/EN-US.ts | 4 ++ source/Localization/ZH-CN.ts | 4 ++ 5 files changed, 47 insertions(+), 7 deletions(-) diff --git a/source/Component/CommandBar/CommandBar.tsx b/source/Component/CommandBar/CommandBar.tsx index cf2b39d..e32dac3 100644 --- a/source/Component/CommandBar/CommandBar.tsx +++ b/source/Component/CommandBar/CommandBar.tsx @@ -188,11 +188,6 @@ class CommandBar extends Component - -
{ } } -class SettingPopupComponent extends Component { +@useSettingWithEvent("themes", "language") +class SettingPopupComponent extends Component { public render(): ReactNode { - return + return + + { + this.props.setting?.setProps("language", data.key as any); + }} + /> + + { + this.props.setting?.setProps("themes", parseInt(data.key)); + }} + /> + } } diff --git a/source/Localization/EN-US.ts b/source/Localization/EN-US.ts index edd5f87..4fcbd3f 100644 --- a/source/Localization/EN-US.ts +++ b/source/Localization/EN-US.ts @@ -1,6 +1,10 @@ const EN_US = { + "Language": "Language", "EN_US": "English (US)", "ZH_CN": "Chinese (Simplified)", + "Themes": "Themes", + "Themes.Dark": "Dark", + "Themes.Light": "Light", "Header.Bar.Title": "Living Together | Emulator", "Header.Bar.Title.Info": "Group Behavior Research Emulator", "Header.Bar.File.Name.Info": "{file} ({status})", diff --git a/source/Localization/ZH-CN.ts b/source/Localization/ZH-CN.ts index cf32a73..fe00be8 100644 --- a/source/Localization/ZH-CN.ts +++ b/source/Localization/ZH-CN.ts @@ -1,6 +1,10 @@ const ZH_CN = { + "Language": "语言", "EN_US": "英语 (美国)", "ZH_CN": "中文 (简体)", + "Themes": "主题", + "Themes.Dark": "黑暗", + "Themes.Light": "亮色", "Header.Bar.Title": "群生共进 | 仿真器", "Header.Bar.Title.Info": "群体行为研究仿真器", "Header.Bar.File.Name.Info": "{file} ({status})",