1
1
import React from 'react'
2
2
import { connect } from 'react-redux'
3
+ import prompt from 'electron-prompt'
3
4
4
5
import { viewChannel , joinChannel , changeUsername , changeScreen } from '../actions'
5
6
import Avatar from './avatar'
6
7
7
- var Dialogs = require ( 'smalltalk' )
8
-
9
8
const mapStateToProps = state => {
10
9
var cabal = state . cabals [ state . currentCabal ]
11
10
return {
@@ -26,7 +25,12 @@ const mapDispatchToProps = dispatch => ({
26
25
27
26
class SidebarScreen extends React . Component {
28
27
onClickNewChannel ( ) {
29
- Dialogs . prompt ( 'Create a channel' , 'New channel name:' , undefined ) . then ( ( newChannelName ) => {
28
+ prompt ( {
29
+ title : 'Create a channel' ,
30
+ label : 'New channel name' ,
31
+ value : undefined ,
32
+ type : 'input'
33
+ } ) . then ( ( newChannelName ) => {
30
34
if ( newChannelName && newChannelName . trim ( ) . length > 0 ) {
31
35
this . joinChannel ( newChannelName )
32
36
}
@@ -36,7 +40,12 @@ class SidebarScreen extends React.Component {
36
40
}
37
41
38
42
onClickUsername ( ) {
39
- Dialogs . prompt ( 'Set nickname' , 'What would you like to call yourself?' , this . props . cabal . username ) . then ( ( username ) => {
43
+ prompt ( {
44
+ title : 'Set nickname' ,
45
+ label : 'What would you like to call yourself?' ,
46
+ value : this . props . cabal . username ,
47
+ type : 'input'
48
+ } ) . then ( ( username ) => {
40
49
if ( username && username . trim ( ) . length > 0 ) {
41
50
this . props . changeUsername ( { username, addr : this . props . addr } )
42
51
}
0 commit comments