From 2e6f56c4e7de1d375eb91e188c3697383b31638f Mon Sep 17 00:00:00 2001
From: Matthew Shao <me@matshao.com>
Date: Sun, 2 Jul 2017 12:19:32 +0800
Subject: [web] Try toggle options in option modal.

---
 web/src/js/components/Modal/OptionModal.jsx | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'web/src/js/components/Modal/OptionModal.jsx')

diff --git a/web/src/js/components/Modal/OptionModal.jsx b/web/src/js/components/Modal/OptionModal.jsx
index 500495c4..c9a56d09 100644
--- a/web/src/js/components/Modal/OptionModal.jsx
+++ b/web/src/js/components/Modal/OptionModal.jsx
@@ -1,6 +1,8 @@
 import React, { Component } from 'react'
 import { connect } from 'react-redux'
 import * as modalAction from '../../ducks/ui/modal'
+import { SettingsToggle } from '../Header/MenuToggle'
+import { OptionsToggle } from './OptionTypes'
 
 class PureOptionModal extends Component {
 
@@ -26,7 +28,9 @@ class PureOptionModal extends Component {
                 </div>
 
                 <div className="modal-body">
-                    ...
+                    <OptionsToggle option="http2">HTTP/2.0</OptionsToggle>
+                    <OptionsToggle option="anticache">Anticache</OptionsToggle>
+                    <OptionsToggle option="anticomp">Anticomp</OptionsToggle>
                 </div>
 
                 <div className="modal-footer">
-- 
cgit v1.2.3


From d889892ba570297047eb4ada342ddf5584b0e43d Mon Sep 17 00:00:00 2001
From: Matthew Shao <me@matshao.com>
Date: Wed, 5 Jul 2017 08:45:31 +0800
Subject: [web] List all options in option modal.

---
 web/src/js/components/Modal/OptionModal.jsx | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

(limited to 'web/src/js/components/Modal/OptionModal.jsx')

diff --git a/web/src/js/components/Modal/OptionModal.jsx b/web/src/js/components/Modal/OptionModal.jsx
index c9a56d09..582ac55f 100644
--- a/web/src/js/components/Modal/OptionModal.jsx
+++ b/web/src/js/components/Modal/OptionModal.jsx
@@ -1,18 +1,17 @@
 import React, { Component } from 'react'
 import { connect } from 'react-redux'
 import * as modalAction from '../../ducks/ui/modal'
-import { SettingsToggle } from '../Header/MenuToggle'
-import { OptionsToggle } from './OptionTypes'
+import Option from './OptionMaster'
 
 class PureOptionModal extends Component {
 
     constructor(props, context) {
         super(props, context)
-        this.state = { title: 'Options',  }
+        this.state = { title: 'Options' }
     }
 
     render() {
-        const { hideModal } = this.props
+        const { hideModal, options } = this.props
         const { title } = this.state
         return (
             <div>
@@ -28,9 +27,11 @@ class PureOptionModal extends Component {
                 </div>
 
                 <div className="modal-body">
-                    <OptionsToggle option="http2">HTTP/2.0</OptionsToggle>
-                    <OptionsToggle option="anticache">Anticache</OptionsToggle>
-                    <OptionsToggle option="anticomp">Anticomp</OptionsToggle>
+                    {
+                        Object.keys(options).sort().map((key) => (
+                            <Option option={key}/>
+                        ))
+                    }
                 </div>
 
                 <div className="modal-footer">
@@ -43,7 +44,7 @@ class PureOptionModal extends Component {
 
 export default connect(
     state => ({
-
+        options: state.options
     }),
     { hideModal: modalAction.hideModal }
 )(PureOptionModal)
-- 
cgit v1.2.3


From 7516f706b41de0c10c2bf9b88278afb6e3edcd4a Mon Sep 17 00:00:00 2001
From: Matthew Shao <me@matshao.com>
Date: Wed, 5 Jul 2017 18:55:56 +0800
Subject: [web] Update Option Modal UI and its tests.

---
 web/src/js/components/Modal/OptionModal.jsx | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

(limited to 'web/src/js/components/Modal/OptionModal.jsx')

diff --git a/web/src/js/components/Modal/OptionModal.jsx b/web/src/js/components/Modal/OptionModal.jsx
index 582ac55f..ef3a224a 100644
--- a/web/src/js/components/Modal/OptionModal.jsx
+++ b/web/src/js/components/Modal/OptionModal.jsx
@@ -1,6 +1,7 @@
 import React, { Component } from 'react'
 import { connect } from 'react-redux'
 import * as modalAction from '../../ducks/ui/modal'
+import { update as updateOptions } from '../../ducks/options'
 import Option from './OptionMaster'
 
 class PureOptionModal extends Component {
@@ -28,9 +29,17 @@ class PureOptionModal extends Component {
 
                 <div className="modal-body">
                     {
-                        Object.keys(options).sort().map((key) => (
-                            <Option option={key}/>
-                        ))
+                        Object.keys(options).sort()
+                            .map((key, index) => {
+                                let option = options[key];
+                                return (
+                                    <Option
+                                        key={index}
+                                        name={key}
+                                        updateOptions={updateOptions}
+                                        option={option}
+                                    />)
+                            })
                     }
                 </div>
 
@@ -46,5 +55,8 @@ export default connect(
     state => ({
         options: state.options
     }),
-    { hideModal: modalAction.hideModal }
+    {
+        hideModal: modalAction.hideModal,
+        updateOptions: updateOptions,
+    }
 )(PureOptionModal)
-- 
cgit v1.2.3

