Skip to content

Commit d8626ad

Browse files
Merge pull request #4 from cometchat-pro/widget-config
v1.0.6
2 parents 6f8fab4 + 14aa97f commit d8626ad

File tree

17 files changed

+272
-271
lines changed

17 files changed

+272
-271
lines changed

CometChat/components/CometChatConversationList/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,10 @@ class CometChatConversationList extends React.Component {
137137
const conversationList = this.state.conversationlist.map((conversation, key) => {
138138
return (
139139
<div id={key} onClick={() => this.handleClick(conversation)} key={key} className="clearfix">
140-
<ConversationView key={conversation.conversationId} conversation={conversation}></ConversationView>
140+
<ConversationView
141+
config={this.props.config}
142+
key={conversation.conversationId}
143+
conversation={conversation} />
141144
</div>
142145
);
143146

CometChat/components/CometChatMessageListScreen/MessageComposer/index.js

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ import { CometChat } from "@cometchat-pro/chat"
77

88
import roundedPlus from "./resources/rounded-plus-grey-icon.svg";
99
import sendBlue from "./resources/send-blue-icon.svg";
10-
import imageUpload from "./resources/images_upload_icon.svg";
11-
import audioUpload from "./resources/audio_upload_icon.svg";
12-
import videoUpload from "./resources/video_upload_icon.svg";
13-
import docUpload from "./resources/document_upload_icon.svg";
1410

1511
class MessageComposer extends React.PureComponent {
1612

@@ -171,35 +167,32 @@ class MessageComposer extends React.PureComponent {
171167
return (
172168

173169
<div className="cc1-chat-win-inpt-ext-wrap">
174-
<div className={filePickerClassName}>
175-
<div className="cc1-chat-win-file-type-list">
176-
<span className="cc1-chat-win-file-type-listitem" onClick={() => { this.openFileDialogue("video") }}>
177-
<input onChange={(e) => this.onVideoChange(e, "video")} accept="video/*" type="file" ref={this.videoUploaderRef} />
178-
<img src={videoUpload} alt="Choose a file to upload" />
179-
</span>
180-
<span className="cc1-chat-win-file-type-listitem" onClick={() => { this.openFileDialogue("audio") }}>
181-
<input onChange={(e) => this.onAudioChange(e, "audio")} accept="audio/*" type="file" ref={this.audioUploaderRef} />
182-
<img src={audioUpload} alt="Choose an file to upload" />
183-
</span>
184-
<span className="cc1-chat-win-file-type-listitem" onClick={() => { this.openFileDialogue("image") }}>
185-
<input onChange={(e) => this.onImageChange(e, "image")} accept="image/*" type="file" ref={this.imageUploaderRef} />
186-
<img src={imageUpload} alt="Choose an file to upload" />
187-
</span>
188-
<span className="cc1-chat-win-file-type-listitem" onClick={() => { this.openFileDialogue("file") }}>
189-
<input onChange={(e) => this.onFileChange(e, "file")} type="file" id="file" ref={this.fileUploaderRef} />
190-
<img src={docUpload} alt="Choose a file to upload" />
191-
</span>
192-
</div>
193-
</div>
170+
194171
<div className="cc1-chat-win-inpt-int-wrap">
195172
<div className="cc1-chat-win-inpt-attach" onClick={this.toggleFilePicker}>
196173
<span><img src={roundedPlus} alt="Click to upload a file" /></span>
197174
</div>
175+
<div className={filePickerClassName}>
176+
<div className="cc1-chat-win-file-type-list">
177+
<span className="cc1-chat-win-file-type-listitem video" onClick={() => { this.openFileDialogue("video") }}>
178+
<input onChange={(e) => this.onVideoChange(e, "video")} accept="video/*" type="file" ref={this.videoUploaderRef} />
179+
</span>
180+
<span className="cc1-chat-win-file-type-listitem audio" onClick={() => { this.openFileDialogue("audio") }}>
181+
<input onChange={(e) => this.onAudioChange(e, "audio")} accept="audio/*" type="file" ref={this.audioUploaderRef} />
182+
</span>
183+
<span className="cc1-chat-win-file-type-listitem image" onClick={() => { this.openFileDialogue("image") }}>
184+
<input onChange={(e) => this.onImageChange(e, "image")} accept="image/*" type="file" ref={this.imageUploaderRef} />
185+
</span>
186+
<span className="cc1-chat-win-file-type-listitem file" onClick={() => { this.openFileDialogue("file") }}>
187+
<input onChange={(e) => this.onFileChange(e, "file")} type="file" id="file" ref={this.fileUploaderRef} />
188+
</span>
189+
</div>
190+
</div>
198191
<div className="cc1-chat-win-inpt-wrap">
199192
<input
200193
type="text"
201-
className="cc1-chat-win-inpt-box font-15"
202-
placeholder="Type Message"
194+
className="cc1-chat-win-inpt-box"
195+
placeholder="Enter your message here"
203196
autoComplete="off"
204197
disabled={disabled}
205198
onChange={this.changeHandler}
Lines changed: 1 addition & 27 deletions
Loading
Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 1 addition & 29 deletions
Loading
Lines changed: 48 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,77 @@
11
@import '../../../resources/core';
22

33
.cc1-chat-win-file-popup {
4-
position:absolute;
5-
left:10px;
6-
bottom:62px;
7-
width:260px;
4+
left:0;
5+
bottom:0;
6+
position:relative;
7+
width: 0;
88
border-radius:8px;
99
overflow:hidden;
1010
z-index:1;
1111
text-align:center;
12-
13-
visibility: hidden;
1412
opacity: 0;
15-
transition: visibility 0s linear 0.33s, opacity 0.33s linear;
13+
transition: width 0.5s linear;
14+
15+
.cc1-chat-win-file-type-list {
16+
width: 100%;
17+
display: flex;
18+
flex-direction: row;
19+
align-items: center;
20+
justify-content: space-around;
21+
margin-top: 5px;
22+
}
1623

1724
.cc1-chat-win-file-type-listitem {
18-
padding: 5px;
19-
width: 60px;
20-
opacity: 0;
2125

22-
animation: slideIn ease forwards;
26+
width: 24px;
27+
height: 24px;
28+
background-color: $secondary;
29+
cursor: pointer;
2330

2431
input {
2532
display: none;
2633
}
27-
28-
img {
29-
display:inherit;
30-
cursor: pointer;
31-
}
3234
}
33-
}
34-
35-
.cc1-chat-win-file-popup.active {
36-
visibility: visible;
37-
opacity: 1;
38-
transition-delay: 0s;
39-
}
4035

41-
@keyframes slideIn {
42-
0% {
43-
opacity: 0;
36+
.cc1-chat-win-file-type-listitem.video {
37+
-webkit-mask: url(./resources/video_upload_icon.svg) no-repeat 100% 100%;
38+
mask: url(./resources/video_upload_icon.svg) no-repeat 100% 100%;
39+
-webkit-mask-size: cover;
40+
mask-size: cover;
4441
}
45-
25% {
46-
opacity: 0.25;
42+
43+
.cc1-chat-win-file-type-listitem.audio {
44+
-webkit-mask: url(./resources/audio_upload_icon.svg) no-repeat 100% 100%;
45+
mask: url(./resources/audio_upload_icon.svg) no-repeat 100% 100%;
46+
-webkit-mask-size: cover;
47+
mask-size: cover;
4748
}
48-
50% {
49-
opacity: 0.5;
49+
50+
.cc1-chat-win-file-type-listitem.image {
51+
-webkit-mask: url(./resources/images_upload_icon.svg) no-repeat 100% 100%;
52+
mask: url(./resources/images_upload_icon.svg) no-repeat 100% 100%;
53+
-webkit-mask-size: cover;
54+
mask-size: cover;
5055
}
51-
100% {
52-
opacity: 1;
56+
57+
.cc1-chat-win-file-type-listitem.file {
58+
-webkit-mask: url(./resources/document_upload_icon.svg) no-repeat 100% 100%;
59+
mask: url(./resources/document_upload_icon.svg) no-repeat 100% 100%;
60+
-webkit-mask-size: cover;
61+
mask-size: cover;
5362
}
5463
}
5564

65+
.cc1-chat-win-file-popup.active {
66+
width: 150px;
67+
opacity: 1;
68+
}
5669

5770
.cc1-chat-win-inpt-int-wrap {
5871
display:flex;
5972

6073
.cc1-chat-win-inpt-attach {
61-
width:60px;
74+
width: 50px;
6275
text-align:center;
6376

6477
span {
@@ -89,6 +102,7 @@
89102
letter-spacing:-.1px;
90103
line-height:20px;
91104
padding:6px 36px 6px 12px;
105+
@include font-15;
92106
}
93107

94108
.cc1-chat-win-inpt-box.height {
@@ -118,86 +132,4 @@
118132
box-shadow:$light-grey 0 0 0 1px inset;
119133
color:#fff;
120134
}
121-
}
122-
123-
124-
// @import '../../../resources/mixins';
125-
// @import '../../../resources/colors';
126-
127-
// .cp-message-composer {
128-
// .cp-show-media{
129-
// display: block;
130-
// position: absolute;
131-
// bottom: 45px;
132-
// left: 17px;
133-
// background-color: $light-background;
134-
// button{
135-
// background: none;
136-
// border: none;
137-
// img{
138-
// width: 40px;
139-
// }
140-
// }
141-
// }
142-
// .cp-hide-media{
143-
// display: None;
144-
// }
145-
// .cp-media-button{
146-
// display: inline-block;
147-
// button{
148-
// background: none;
149-
// border: none;
150-
// img{
151-
// width: 20px;
152-
// }
153-
// }
154-
// }
155-
// .cp-send-button{
156-
// display: inline-block;
157-
// button{
158-
// background: none;
159-
// border: none;
160-
// padding: 3px 10px;
161-
// img{
162-
// width: 30px;
163-
// }
164-
// }
165-
// }
166-
// width: 100%;
167-
// bottom: 12px;
168-
// input{
169-
// width: 85%;
170-
// background-color: $gray-lighten-more-more;
171-
// border: 1px solid #e8e8e8;
172-
// border-radius: 5px;
173-
// padding-left: 10px;
174-
// padding-right: 10px;
175-
// height: 34px;
176-
// font-size: 18px;
177-
// }
178-
// }
179-
180-
// @media screen and (min-width: 768px) and (max-width : 992px){
181-
// .cp-message-composer{
182-
// input{
183-
// width: 80%;
184-
// }
185-
// }
186-
// }
187-
188-
189-
// .dark{
190-
// .cp-show-media{
191-
// background-color: $dark-background;
192-
// p{
193-
// color:$light-background;
194-
// }
195-
// }
196-
// }
197-
198-
199-
// .light{
200-
// .cp-show-media{
201-
// background-color: $light-background;
202-
// }
203-
// }
135+
}

CometChat/components/CometChatMessageListScreen/MessageHeader/index.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,34 @@ import React from "react";
22
import "./style.scss";
33

44
import Avatar from "../../Avatar";
5+
import { SvgAvatar } from '../../../util/svgavatar';
56

67
const messageheader = (props) => {
78

89
let status, image;
910
if(props.type === "user") {
11+
12+
if(!props.item.avatar) {
13+
14+
const uid = props.item.getUid();
15+
const char = props.item.getName().charAt(0).toUpperCase();
16+
17+
props.item.setAvatar(SvgAvatar.getAvatar(uid, char));
18+
}
19+
1020
status = props.item.status;
1121
image = props.item.avatar;
22+
1223
} else {
24+
25+
if(!props.item.icon) {
26+
27+
const guid = props.item.getGuid();
28+
const char = props.item.getName().charAt(0).toUpperCase();
29+
30+
props.item.setIcon(SvgAvatar.getAvatar(guid, char))
31+
}
32+
1333
status = props.item.type;
1434
image = props.item.icon;
1535
}

0 commit comments

Comments
 (0)