@empirica/chat
Advanced tools
Comparing version 2.1.1 to 2.1.2
{ | ||
"name": "@empirica/chat", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "React component of a chat lobby for the Empirica experiment platform.", | ||
@@ -5,0 +5,0 @@ "main": "./build/index.js", |
@@ -45,6 +45,9 @@ # Empirica Chat | ||
You can pass an optional `timeStamp` date prop to add the timestamp attribute on each message sent | ||
You can pass an optional `timeStamp` date prop to add the timestamp attribute on each message sent. Run this command to add mizzao timesync `meteor add mizzao:timesync`. | ||
```jsx | ||
<Chat player={player} scope={game} timeStamp={timeStamp} /> | ||
// reactive time value only updates at 1000 ms | ||
const timeStamp = new Date(TimeSync.serverTime(null, 1000)); | ||
<Chat player={player} scope={game} timeStamp={timeStamp} />; | ||
``` | ||
@@ -51,0 +54,0 @@ |
@@ -8,2 +8,7 @@ import PropTypes from "prop-types"; | ||
const minutes = new Date(timeStamp).getMinutes(); | ||
if (!hours || !minutes) { | ||
return null; | ||
} | ||
const time = `${hours | ||
@@ -39,3 +44,5 @@ .toString() | ||
<div className="text">{text}</div> | ||
{this.renderTime(timeStamp)} | ||
{timeStamp && | ||
new Date(timeStamp).getTime() > 0 && | ||
this.renderTime(timeStamp)} | ||
</div> | ||
@@ -42,0 +49,0 @@ </div> |
Sorry, the diff of this file is too big to display
801158
3177
209