@@ -2,35 +2,7 @@ import React, { PropTypes, Component } from 'react';
22import  i18n  from  './i18n' ; 
33import  styles  from  './styles.scss' ; 
44import  RecipientsInput  from  '../RecipientsInput' ; 
5- 
6- function  SenderSelectInput ( props )  { 
7-   return  ( 
8-     < select 
9-       className = { props . className } 
10-       value = { props . value } 
11-       onChange = { props . onChange } > 
12-       { 
13-         props . options . map ( number  =>  ( 
14-           < option  key = { number }  value = { number } > 
15-             { props . formatPhone ( number ) } 
16-           </ option > 
17-         ) ) 
18-       } 
19-     </ select > 
20-   ) ; 
21- } 
22- 
23- SenderSelectInput . propTypes  =  { 
24-   value : PropTypes . string . isRequired , 
25-   className : PropTypes . string , 
26-   onChange : PropTypes . func . isRequired , 
27-   formatPhone : PropTypes . func . isRequired , 
28-   options : PropTypes . arrayOf ( PropTypes . string . isRequired ) . isRequired , 
29- } ; 
30- 
31- SenderSelectInput . defaultProps  =  { 
32-   className : null , 
33- } ; 
5+ import  Select  from  '../Select' ; 
346
357class  ComposeTextPanel  extends  Component  { 
368  constructor ( props )  { 
@@ -53,6 +25,9 @@ class ComposeTextPanel extends Component {
5325    this . onReceiverInputKeyDown  =  ( e )  =>  { 
5426      if  ( e . key  ===  ','  ||  e . key  ===  ';'  ||  e . key  ===  'Enter' )  { 
5527        e . preventDefault ( ) ; 
28+         if  ( this . props . typingToNumber . length  ===  0 )  { 
29+           return ; 
30+         } 
5631        this . props . addToNumber ( { 
5732          name : this . props . formatPhone ( this . props . typingToNumber ) , 
5833          phoneNumber : this . props . typingToNumber , 
@@ -88,21 +63,9 @@ class ComposeTextPanel extends Component {
8863
8964  render ( )  { 
9065    return  ( 
91-       < div > 
66+       < div   className = { styles . root } > 
9267        < form  onSubmit = { this . handleSubmit } > 
93-           < div  className = { styles . messageSenderField } > 
94-             < label > { i18n . getString ( 'sendMessageFrom' ,  this . props . currentLocale ) } </ label > 
95-             < div  className = { styles . valueInput } > 
96-               < SenderSelectInput 
97-                 className = { styles . select } 
98-                 value = { this . props . senderNumber } 
99-                 onChange = { this . onSenderChange } 
100-                 options = { this . props . senderNumbers } 
101-                 formatPhone = { this . props . formatPhone } 
102-               /> 
103-             </ div > 
104-           </ div > 
105-           < div  className = { styles . messageReceiverField } > 
68+           < div  className = { styles . receiverField } > 
10669            < label > { i18n . getString ( 'to' ,  this . props . currentLocale ) } :</ label > 
10770            < div  className = { styles . rightPanel } > 
10871              < RecipientsInput 
@@ -120,20 +83,38 @@ class ComposeTextPanel extends Component {
12083              /> 
12184            </ div > 
12285          </ div > 
123-           < div  className = { styles . messageTextField } > 
124-             < textarea 
125-               placeholder = { i18n . getString ( 'typeAnyToSend' ,  this . props . currentLocale ) } 
126-               value = { this . props . messageText } 
127-               maxLength = "1000" 
128-               onChange = { this . onTextChange } 
129-             /> 
86+           < div  className = { styles . senderField } > 
87+             < label > { i18n . getString ( 'from' ,  this . props . currentLocale ) } :</ label > 
88+             < div  className = { styles . senderInput } > 
89+               < Select 
90+                 className = { styles . senderSelect } 
91+                 value = { this . props . senderNumber } 
92+                 onChange = { this . onSenderChange } 
93+                 options = { this . props . senderNumbers } 
94+                 paddingLeft = { 0 } 
95+                 valueFunction = { option  =>  option } 
96+                 renderFunction = { this . props . formatPhone } 
97+               /> 
98+             </ div > 
99+           </ div > 
100+           < div  className = { styles . buttomField } > 
101+             < div  className = { styles . textField } > 
102+               < textarea 
103+                 placeholder = { i18n . getString ( 'typeMessage' ,  this . props . currentLocale ) } 
104+                 value = { this . props . messageText } 
105+                 maxLength = "1000" 
106+                 onChange = { this . onTextChange } 
107+               /> 
108+             </ div > 
109+             < div  className = { styles . submitField } > 
110+               < input 
111+                 type = "submit" 
112+                 value = { i18n . getString ( 'send' ,  this . props . currentLocale ) } 
113+                 className = { styles . submitButton } 
114+                 disabled = { this . props . sendButtonDisabled } 
115+               /> 
116+             </ div > 
130117          </ div > 
131-           < input 
132-             type = "submit" 
133-             value = { i18n . getString ( 'send' ,  this . props . currentLocale ) } 
134-             className = { styles . submitButton } 
135-             disabled = { this . props . sendButtonDisabled } 
136-           /> 
137118        </ form > 
138119      </ div > 
139120    ) ; 
0 commit comments