diff --git a/README.md b/README.md index d3d84f0..7883680 100755 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ The demo application can be configured and run in two ways: * Cloning this repo and running locally * Remember to copy the `.env.example` file to `.env` and replace the variables values with the ones from your account. By default `NODE_ENV` is set to `production`. + * Need to run `index.js` as a separate node server to get onConversationAdded webhook to work. # Replacing the Access Token diff --git a/index.js b/index.js index d1e749c..92cd933 100755 --- a/index.js +++ b/index.js @@ -66,7 +66,8 @@ app.use((error, req, res, next) => { var ngrokOptions = { proto: 'http', - addr: config.port + addr: config.port, + configPath: '' }; if (config.ngrokSubdomain) { diff --git a/src/App.js b/src/App.js index ba8e499..2e905ad 100644 --- a/src/App.js +++ b/src/App.js @@ -1,8 +1,7 @@ import React, { Component } from 'react'; import ConversationsApp from './ConversationsApp'; import './assets/App.css'; -import 'antd/dist/antd.css'; - +import 'antd/dist/reset.css'; class App extends Component { constructor(props) { diff --git a/src/Conversation.js b/src/Conversation.js index 16248f2..7b433a4 100644 --- a/src/Conversation.js +++ b/src/Conversation.js @@ -3,7 +3,8 @@ import './assets/Conversation.css'; import MessageBubble from './MessageBubble' import Dropzone from 'react-dropzone'; import styles from './assets/Conversation.module.css' -import {Button, Form, Icon, Input} from "antd"; +import {Button, Form, Input} from "antd"; +import Icon from '@ant-design/icons'; import ConversationsMessages from "./ConversationsMessages"; import PropTypes from "prop-types"; @@ -122,7 +123,7 @@ class Conversation extends Component { messages={this.state.messages}/>
-
+ -
diff --git a/src/ConversationsApp.js b/src/ConversationsApp.js index c28a7be..32a036c 100644 --- a/src/ConversationsApp.js +++ b/src/ConversationsApp.js @@ -1,5 +1,6 @@ import React from "react"; -import { Badge, Icon, Layout, Spin, Typography } from "antd"; +import { Badge, Layout, Spin, Typography } from "antd"; +import Icon from '@ant-design/icons'; import { Client as ConversationsClient } from "@twilio/conversations"; import "./assets/Conversation.css"; diff --git a/src/LoginPage.jsx b/src/LoginPage.jsx index b7e63b3..0d288f3 100644 --- a/src/LoginPage.jsx +++ b/src/LoginPage.jsx @@ -1,62 +1,55 @@ import React from 'react'; -import { Layout, Button, Input, Icon, Form, Row, Col, Card } from 'antd'; +import { Layout, Button, Input, Form, Row, Col, Card } from 'antd'; +import Icon from '@ant-design/icons'; import { ReactComponent as Logo } from './assets/twilio-mark-red.svg'; const { Content } = Layout; -export class LoginPage extends React.Component { - handleSubmit = e => { - e.preventDefault(); +const LoginPage = ({onSubmit}) => { + const [form] = Form.useForm(); - const { form, onSubmit } = this.props; + const handleSubmit = e => { + e.preventDefault(); - form.validateFields((err, values) => { - if (!err) { + form.validateFields() + .then(values => { const { username } = values; onSubmit(username); - } - }); + }) + .catch(err => { + // Handle form validation errors + }); }; - render() { - const { getFieldDecorator } = this.props.form; - - const usernameFieldDecorator = getFieldDecorator('username', { - rules: [{ required: true, message: 'Please input your username!' }], - }); - - return ( - - - - - - - - - -
- - {usernameFieldDecorator( - } - placeholder="Username" - />, - )} - - - - -
-
- -
-
-
- ) - } -} - -export default Form.create({ name: 'login' })(LoginPage); + return ( + + + + + + + + + +
+ + } placeholder="Username" /> + + + + +
+
+ +
+
+
+ ); +}; + +export default LoginPage; \ No newline at end of file diff --git a/src/MessageBubble.js b/src/MessageBubble.js index 551c622..667f0ec 100644 --- a/src/MessageBubble.js +++ b/src/MessageBubble.js @@ -1,7 +1,8 @@ import React, { Component, PureComponent } from "react"; import styles from "./assets/MessageBubble.module.css"; import PropTypes from "prop-types"; -import { Spin, Modal, Icon } from "antd"; +import { Spin, Modal } from "antd"; +import Icon from '@ant-design/icons'; import WhatsappIcon from "./WhatsappIcon"; import ChatIcon from "./ChatIcon";