From 4546f649028087326b9c69e3ccc6e617354a88b9 Mon Sep 17 00:00:00 2001 From: John Hopkins Date: Wed, 28 Nov 2018 16:59:17 -0800 Subject: [PATCH 1/5] wip edits settingspage and desktopsettings to provide option for ipfs implementation. Also adds a select component for reuse --- src/components/select/Select.css | 23 ++++++++++++++++++ src/components/select/Select.js | 40 ++++++++++++++++++++++++++++++++ src/settings/DesktopSettings.js | 17 ++++++++++++++ src/settings/SettingsPage.js | 2 +- 4 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 src/components/select/Select.css create mode 100644 src/components/select/Select.js diff --git a/src/components/select/Select.css b/src/components/select/Select.css new file mode 100644 index 000000000..c999d2d85 --- /dev/null +++ b/src/components/select/Select.css @@ -0,0 +1,23 @@ +.Select span:first-of-type { + background-color: #DDE6EB; + box-shadow: inset 0 1px 1px 0px rgba(0,0,0,0.18), 0 1px 0 0px rgba(255,255,255,0.75); +} + +.Select input { + left: -99999px; + top: 10px; +} + +.Select input:checked ~ span:first-of-type svg{ + opacity: 1; +} + +.Select input:disabled ~ span:first-of-type { + cursor: not-allowed; + opacity: 0.5; +} + +.Select input:focus ~ span:first-of-type, +.Select input:checked ~ span:first-of-type { + background-color: #BBE4E8; +} diff --git a/src/components/select/Select.js b/src/components/select/Select.js new file mode 100644 index 000000000..c110ad380 --- /dev/null +++ b/src/components/select/Select.js @@ -0,0 +1,40 @@ +import React from 'react' +import SelectReact from 'react-select'; +import PropTypes from 'prop-types' +import './Select.css' + +const Select = ({ className, label, disabled, value, onChange, options, ...props }) => { + className = `Select dib sans-serif ${className}` + + return ( + + ) +} + +Select.propTypes = { + className: PropTypes.string, + label: PropTypes.string, + disabled: PropTypes.bool, + value: PropTypes.string, + onChange: PropTypes.func +} + +Select.defaultProps = { + className: '', + label: '', + disabled: false, + value: null, + onChange: () => {} +} + +export default Select diff --git a/src/settings/DesktopSettings.js b/src/settings/DesktopSettings.js index 919d55904..f1b67070e 100644 --- a/src/settings/DesktopSettings.js +++ b/src/settings/DesktopSettings.js @@ -3,12 +3,18 @@ import { connect } from 'redux-bundler-react' import { translate, Trans } from 'react-i18next' import Box from '../components/box/Box' import Checkbox from '../components/checkbox/Checkbox' +import Select from '../components/select/Select' import Title from './Title' const isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0 const altKey = isMac ? '⌥ option' : 'ALT' const ctrlKey = isMac ? '⌘ command' : 'CTRL' +const ipfsBackendOptions = [ + {value: 'js', label: 'Javascript'}, + {value: 'go', label: 'GO'} +] + const CheckboxSetting = ({ children, title, ...props }) => (
@@ -28,6 +34,7 @@ const Key = ({ children }) => { chil export function DesktopSettings ({ t, doDesktopSettingsToggle, desktopSettings }) { return ( +
{t('ipfsDesktop')} @@ -57,6 +64,16 @@ export function DesktopSettings ({ t, doDesktopSettingsToggle, desktopSettings }

+ + {t('ipfsDesktop') + ' Daemon'} + doDesktopSettingsToggle('type')} - options={ipfsBackendOptions} - disabled={false} - label='IPFS implementation' /> + + doDesktopSettingsToggle('type')}> +

Enable Javascript

+
+

The javascript implementation does not yet have feature parity with the go implementation. For more info please see:

+
) From b5c2fd38cf60c68ed8876282c8090b530f44d5ed Mon Sep 17 00:00:00 2001 From: John Hopkins Date: Tue, 4 Dec 2018 10:13:23 -0800 Subject: [PATCH 3/5] deleting select component --- src/components/select/Select.css | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 src/components/select/Select.css diff --git a/src/components/select/Select.css b/src/components/select/Select.css deleted file mode 100644 index c999d2d85..000000000 --- a/src/components/select/Select.css +++ /dev/null @@ -1,23 +0,0 @@ -.Select span:first-of-type { - background-color: #DDE6EB; - box-shadow: inset 0 1px 1px 0px rgba(0,0,0,0.18), 0 1px 0 0px rgba(255,255,255,0.75); -} - -.Select input { - left: -99999px; - top: 10px; -} - -.Select input:checked ~ span:first-of-type svg{ - opacity: 1; -} - -.Select input:disabled ~ span:first-of-type { - cursor: not-allowed; - opacity: 0.5; -} - -.Select input:focus ~ span:first-of-type, -.Select input:checked ~ span:first-of-type { - background-color: #BBE4E8; -} From 0a2b2ba406af983c384eb02aa45ed28a25988646 Mon Sep 17 00:00:00 2001 From: John Hopkins Date: Tue, 4 Dec 2018 10:23:16 -0800 Subject: [PATCH 4/5] fully remomoving select --- src/components/select/Select.js | 40 --------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 src/components/select/Select.js diff --git a/src/components/select/Select.js b/src/components/select/Select.js deleted file mode 100644 index c110ad380..000000000 --- a/src/components/select/Select.js +++ /dev/null @@ -1,40 +0,0 @@ -import React from 'react' -import SelectReact from 'react-select'; -import PropTypes from 'prop-types' -import './Select.css' - -const Select = ({ className, label, disabled, value, onChange, options, ...props }) => { - className = `Select dib sans-serif ${className}` - - return ( - - ) -} - -Select.propTypes = { - className: PropTypes.string, - label: PropTypes.string, - disabled: PropTypes.bool, - value: PropTypes.string, - onChange: PropTypes.func -} - -Select.defaultProps = { - className: '', - label: '', - disabled: false, - value: null, - onChange: () => {} -} - -export default Select From 84f39f5414be616ce4da40b1f375a20ba41ddc66 Mon Sep 17 00:00:00 2001 From: John Hopkins Date: Tue, 4 Dec 2018 10:26:42 -0800 Subject: [PATCH 5/5] deleting random space --- src/settings/SettingsPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/settings/SettingsPage.js b/src/settings/SettingsPage.js index 1017d39c8..1b5ed10cc 100644 --- a/src/settings/SettingsPage.js +++ b/src/settings/SettingsPage.js @@ -26,7 +26,7 @@ export const SettingsPage = ({ { isIpfsDesktop && - + }