From 90dc81797fd4dddc1ec5df345925783590b95046 Mon Sep 17 00:00:00 2001 From: case Date: 2016年2月23日 22:42:15 -0600 Subject: [PATCH 1/2] Add Key Working --- src/components/common/FullScreenCompose.js | 26 ++++++++++++++++++- src/components/common/User.js | 2 +- src/components/encrypt/EncryptCompose.js | 2 +- src/components/encrypt/EncryptKeyList.js | 11 -------- .../floating-button/FloatingButton.js | 2 +- src/containers/FullScreenComposeContainer.js | 8 ++++-- 6 files changed, 34 insertions(+), 17 deletions(-) diff --git a/src/components/common/FullScreenCompose.js b/src/components/common/FullScreenCompose.js index a1a8927..9fd438d 100644 --- a/src/components/common/FullScreenCompose.js +++ b/src/components/common/FullScreenCompose.js @@ -83,11 +83,16 @@ class FullScreenCompose extends Component { // } handleCancel = () => { - this.props.handleToggleCompose() + this.clearInput() + this.props.toggleCompose() } handleKeyDown = (e) => { + // Escape (e.keyCode === 27 && this.props.expanded) && this.handleCancel() + + // Enter + // (e.keyCode === 13) && this.handleAddKey() } handleEncrypt = () => { @@ -99,6 +104,20 @@ class FullScreenCompose extends Component { } } + handleAddKey = () => { + const text = this.refs.textarea.value + if (text) { + // get the name here or something? + this.props.addKey && this.props.addKey({ name: text }) + this.clearInput() + this.props.toggleCompose() + } + } + + clearInput = () => { + this.refs.textarea.value = '' + } + render() { let props = { 'encrypt': { @@ -121,6 +140,11 @@ class FullScreenCompose extends Component { onAccept: this.handleEncrypt, placeholder: 'Message to Verify', }, + 'add-key': { + acceptLabel: 'Add Key', + onAccept: this.handleAddKey, + placeholder: 'Public Key', + }, }[this.props.type] || {} return ( diff --git a/src/components/common/User.js b/src/components/common/User.js index 7eb8be8..c9ea249 100644 --- a/src/components/common/User.js +++ b/src/components/common/User.js @@ -27,7 +27,7 @@ class User extends Component { }, avatar: { transform: 'scale(1)', - transition: 'transform 100ms ease-in-out', + transition: 'transform 100ms linear', }, name: { flex: '1', diff --git a/src/components/encrypt/EncryptCompose.js b/src/components/encrypt/EncryptCompose.js index 64cd258..74586dc 100644 --- a/src/components/encrypt/EncryptCompose.js +++ b/src/components/encrypt/EncryptCompose.js @@ -51,7 +51,7 @@ class EncryptCompose extends Component { translateY: 0, }, { type: dynamics.spring, - duration: 500, + duration: 300, frequency: 110, friction: 200, }) diff --git a/src/components/encrypt/EncryptKeyList.js b/src/components/encrypt/EncryptKeyList.js index 232592f..6a29d28 100644 --- a/src/components/encrypt/EncryptKeyList.js +++ b/src/components/encrypt/EncryptKeyList.js @@ -17,17 +17,6 @@ class EncryptKeyList extends Component { } } - componentDidMount() { - // setInterval(() => { - // this.props.onTestAdd('Case') - // }, 5000) - this.props.onTestAdd('Medibuds') - this.props.onTestAdd('Case') - this.props.onTestAdd('Foo Bar') - this.props.onTestAdd('Middle Earth Dude') - this.props.onTestAdd('Colin') - } - render() { return (
diff --git a/src/components/floating-button/FloatingButton.js b/src/components/floating-button/FloatingButton.js index 6a3fd59..69f375c 100644 --- a/src/components/floating-button/FloatingButton.js +++ b/src/components/floating-button/FloatingButton.js @@ -45,7 +45,7 @@ class FloatingButton extends Component { { this.state.isShowingActions ?
-
+
diff --git a/src/containers/FullScreenComposeContainer.js b/src/containers/FullScreenComposeContainer.js index 1e49aee..f0745db 100644 --- a/src/containers/FullScreenComposeContainer.js +++ b/src/containers/FullScreenComposeContainer.js @@ -1,7 +1,7 @@ import _ from 'lodash' import { connect } from 'react-redux' import Immutable from 'immutable' -import { toggleCompose } from '../actions/index' +import { toggleCompose, addKey } from '../actions/index' import FullScreenCompose from '../components/common/FullScreenCompose' const mapStateToProps = (state) => { @@ -13,9 +13,13 @@ const mapStateToProps = (state) => { const mapDispatchToProps = (dispatch) => { return { - handleToggleCompose: () => { + toggleCompose: () => { dispatch(toggleCompose()) }, + + addKey: (key) => { + dispatch(addKey(key)) + }, } } From 02910f785d0afa5f0e6fb71b71b7bfc8efb8571d Mon Sep 17 00:00:00 2001 From: case Date: 2016年2月23日 23:35:47 -0600 Subject: [PATCH 2/2] Fetch Keys on `componentDidMount` --- src/components/encrypt/EncryptKeyList.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/encrypt/EncryptKeyList.js b/src/components/encrypt/EncryptKeyList.js index 6a29d28..23201b8 100644 --- a/src/components/encrypt/EncryptKeyList.js +++ b/src/components/encrypt/EncryptKeyList.js @@ -17,6 +17,10 @@ class EncryptKeyList extends Component { } } + componentDidMount() { + this.props.fetchKeys() + } + render() { return (

AltStyle によって変換されたページ (->オリジナル) /