diff --git a/css/base.css b/css/base.css
index ed3d3df6..f69098b0 100644
--- a/css/base.css
+++ b/css/base.css
@@ -103,6 +103,7 @@ html, body {
.label-as-badge {
border-radius: 1em;
+ margin-left: 1em;
}
.contactList {
@@ -162,6 +163,7 @@ html, body {
overflow-y: scroll;
padding-top: 0;
padding-bottom: 0;
+ background-image: url("../ignasi_pattern_s.png");
}
#messagesView {
@@ -174,6 +176,13 @@ html, body {
box-shadow: 0px -1px 2px rgba(0, 0, 0, 0.15);
}
+#dummyView {
+ display:flex;
+ align-items: center;
+ justify-content: center;
+ background-color: #E9E9FF;
+}
+
.chatBox {
list-style: none;
padding: 1.5em 0 1.5em;
@@ -200,8 +209,8 @@ html, body {
max-width: 90%;
float: right;
background-color: #EFE;
- border: 1px solid #CCC;
- border-radius: 2px;
+ border: 1px solid #CDC;
+ border-radius: 4px;
padding: 1em;
position: relative;
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.15);
@@ -233,6 +242,7 @@ html, body {
.chatBox > li.chatBox-inverted > .chatBox-panel {
background-color: #EEF;
+ border: 1px solid #CCD;
float: left;
}
diff --git a/index.html b/index.html
index 6ceb134c..61a9f04f 100644
--- a/index.html
+++ b/index.html
@@ -3,7 +3,7 @@
@@ -90,7 +108,11 @@
);
}
})
+ /* END Login */
+ /* BEGIN Contact list (list of topics) */
+
+ /*Contacts caption */
var CurrentUser = React.createClass({
render: function() {
return (
@@ -111,6 +133,7 @@
}
});
+ /* A form for initiating a new topic */
var NewTopic = React.createClass({
render: function() {
return (
@@ -131,6 +154,107 @@
{id: "usrDAVE", public: "Dave Goliaphsson", comment: "This is a comment", online: {now: false, when: "30 min ago"}, unread: 0}
];
+ /* A single topic */
+ var Contact = React.createClass({
+ handleClick: function() {
+ this.props.onSelected(this.props.public);
+ },
+ render: function() {
+ return (
+
+
+
+
+
{this.props.public}
+
{this.props.comment}
+
+
+ );
+ }
+ });
+
+ /* The counter of unread messages in the topic */
+ Contact.Unread = React.createClass({
+ render: function() {
+ var showUnreadBadge = null;
+ if (this.props.count > 0) {
+ showUnreadBadge =
{this.props.count};
+ }
+ return (
+
{showUnreadBadge}
+ );
+ }
+ })
+
+ /* Online indicator */
+ Contact.Online = React.createClass({
+ render: function() {
+ var lastOnline = '';
+ if (!this.props.online && this.props.when) {
+ lastOnline = this.props.when;
+ } else {
+ lastOnline = 'online now';
+ }
+
+ return (
+
+ ● {lastOnline}
+
+ );
+ }
+ })
+
+ /* List of comtacts/topics */
+ var ContactList = React.createClass({
+ getInitialState: function() {
+ return {selected: false};
+ },
+ onSelectionChange: function(sel) {
+ this.props.onTopicSelected(sel);
+ },
+ render: function() {
+ var contactNodes = this.props.data.map(function(c) {
+ return (
+
+ );
+ }, this);
+ return (
+
+ );
+ }
+ });
+
+ /* The panel to hold all contacts-related stuff together */
+ var ContactsView = React.createClass({
+ getInitialState: function() {
+ return {contacts: []};
+ },
+ componentDidMount: function() {
+ this.setState({contacts: contactsData});
+ },
+ render: function() {
+ return (
+
+ );
+ }
+ });
+ /* END Contact list */
+
+ /* BEGIN Conversation panel */
var messagesList = [
{
id: 1, content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam sit amet tellus interdum. \
@@ -159,88 +283,6 @@ dignissim a diam a hendrerit. Nulla vel est ut quam rhoncus pulvinar. In hac hab
{id: 7, content: "OK!", timestamp: new Date(2016, 0, 3, 18, 19, 20, 567), response: true}
];
- var Contact = React.createClass({
- render: function() {
- return (
-
-
-
-
-
{this.props.public}
-
{this.props.comment}
-
-
- );
- }
- });
-
- Contact.Unread = React.createClass({
- render: function() {
- var showUnreadBadge;
- if (this.props.count > 0) {
- showUnreadBadge =
{this.props.count};
- }
- return (
-
{showUnreadBadge}
- );
- }
- })
-
- Contact.Online = React.createClass({
- render: function() {
- var lastOnline = '';
- if (!this.props.online && this.props.when) {
- lastOnline = this.props.when;
- } else {
- lastOnline = 'online';
- }
-
- return (
-
- ● {lastOnline}
-
- );
- }
- })
-
- var ContactList = React.createClass({
- render: function() {
- var contactNodes = this.props.data.map(function(c) {
- return (
-
- );
- });
- return (
-
- );
- }
- });
-
- var ContactsView = React.createClass({
- getInitialState: function() {
- return {contacts: []};
- },
- componentDidMount: function() {
- this.setState({contacts: contactsData});
- },
- render: function() {
- return (
-
- );
- }
- });
-
var Message = React.createClass({
getInitialState: function() {
return {received: 0};
@@ -263,6 +305,7 @@ dignissim a diam a hendrerit. Nulla vel est ut quam rhoncus pulvinar. In hac hab
}
});
+ /* Received/read indicator */
Message.ReceivedMarker = React.createClass({
getInitialState: function() {
return {received: 0};
@@ -281,6 +324,7 @@ dignissim a diam a hendrerit. Nulla vel est ut quam rhoncus pulvinar. In hac hab
}
});
+ /* Send message form */
Message.Send = React.createClass({
render: function() {
return (
@@ -296,6 +340,21 @@ dignissim a diam a hendrerit. Nulla vel est ut quam rhoncus pulvinar. In hac hab
);
}
});
+
+ /* This is just a static page to show when no conversation is selected */
+ var DummyMessagesView = React.createClass({
+ render: function() {
+ return (
+
+
+

+
Tinode Demo Chat
+
+
+ );
+ }
+ });
+
var MessagesView = React.createClass({
getInitialState: function() {
return {messages: []};
@@ -310,27 +369,45 @@ dignissim a diam a hendrerit. Nulla vel est ut quam rhoncus pulvinar. In hac hab
);
});
return (
-
+
+
+
{this.props.topic}
+
+
+
+
+
+
);
}
});
+ /* END Conversation panel */
+
var AppView = React.createClass({
getInitialState: function() {
- return {loggedIn: false, chatTitle: "Bob Smith"};
+ return {loggedIn: false, selTopic: ''};
},
handleLogin: function(ok) {
this.setState({loggedIn: ok});
},
+ handleTopicSelected: function(topic) {
+ this.setState({selTopic: topic});
+ },
render: function() {
return (
@@ -338,17 +415,9 @@ dignissim a diam a hendrerit. Nulla vel est ut quam rhoncus pulvinar. In hac hab
-
-
-
{this.state.chatTitle}
-
-
-
-
-
-
-
-
+ {this.state.selTopic ?
+
:
+
}