summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHaishan <[email protected]>2020-06-18 20:45:43 +0800
committerHaishan <[email protected]>2020-06-18 20:45:43 +0800
commiteb28e99f2bb117db22c6cf0396d665db9fe9c3ea (patch)
tree0fe213360889781091f2bd186cd60b30ad150296 /src
parent48acdbb5bef6c40010a8402bc0eedf8486ed0935 (diff)
fix(config): fix mode switching
Diffstat (limited to 'src')
-rw-r--r--src/components/Config.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/components/Config.js b/src/components/Config.js
index 46c480d..56ce9f9 100644
--- a/src/components/Config.js
+++ b/src/components/Config.js
@@ -20,7 +20,7 @@ import TrafficChartSample from './TrafficChartSample';
import s0 from './Config.module.css';
-const { useEffect, useState, useCallback, useRef } = React;
+const { useEffect, useState, useCallback, useRef, useMemo } = React;
const propsList = [{ id: 0 }, { id: 1 }, { id: 2 }, { id: 3 }];
@@ -172,6 +172,11 @@ function ConfigImpl({
[apiConfig, dispatch, updateAppConfig]
);
+ const mode = useMemo(() => {
+ const m = configState.mode;
+ return typeof m === 'string' && m[0].toUpperCase() + m.slice(1);
+ }, [configState.mode]);
+
return (
<div>
<ContentHeader title="Config" />
@@ -220,7 +225,7 @@ function ConfigImpl({
<ToggleSwitch
options={optionsRule}
name="mode"
- value={configState.mode}
+ value={mode}
onChange={handleInputOnChange}
/>
</div>