Verified Giphy

This commit is contained in:
Ayushya Amitabh
2020-04-28 23:27:17 -04:00
parent a169fde183
commit 2e6d943b9e
7 changed files with 28 additions and 174 deletions
+5 -7
View File
@@ -28,7 +28,7 @@ import { goTo } from 'route-lite';
import Create from './Create';
import VideoListener from './VideoListener';
const giphyFetch = new GiphyFetch('meKO7qbULHC9Q26DRGt2yZguIn3LB6z7');
const giphyFetch = new GiphyFetch('ojJbIMUN6XRMn4mHiFFav3rMCpXUg8sq');
export default class Chat extends Component {
constructor(props) {
super(props);
@@ -180,7 +180,7 @@ export default class Chat extends Component {
name: window.localStorage.getItem('watchPartyUserName'),
uid: window.localStorage.getItem('watchPartyUserUid'),
text: message,
time: new Date().toISOString(),
time: new Date(),
type: '',
};
if (this.state.gif === true) data.type = 'giphy';
@@ -190,7 +190,7 @@ export default class Chat extends Component {
});
}
sendMessageInvoker(overrideMessage) {
if (overrideMessage) this.sendMessage(overrideMessage);
if (overrideMessage) console.log(overrideMessage);
else {
const trim = this.state.newMessage.replace(/^\s+|\s+$/g, '');
if (trim !== '') this.sendMessage(trim);
@@ -199,7 +199,7 @@ export default class Chat extends Component {
}
gifClick(iGif, ev) {
ev.preventDefault();
this.sendMessageInvoker(iGif.images.original.url);
this.sendMessageInvoker(iGif);
}
getCarousel() {
const trendingFetch = (offset) => giphyFetch.trending({ offset, limit: 5 });
@@ -242,9 +242,7 @@ export default class Chat extends Component {
</ButtonGroup>
</div>
<div className="thread-container">
<Thread
messages={messages.sort((a, b) => new Date(b).getTime() - new Date(a).getTime())}
/>
<Thread messages={messages} />
</div>
<TextField
multiline