Changed clock icon in repeat posts to simple timestamp

Этот коммит содержится в:
Reed Garmsen
2016-02-01 14:30:16 -08:00
родитель fe39f2400f
Коммит 92816619cc
6 изменённых файлов: 31 добавлений и 24 удалений

Просмотреть файл

@@ -214,6 +214,7 @@ export default class Post extends React.Component {
commentCount={commentCount} commentCount={commentCount}
handleCommentClick={this.handleCommentClick} handleCommentClick={this.handleCommentClick}
isLastComment={this.props.isLastComment} isLastComment={this.props.isLastComment}
sameUser={this.props.sameUser}
/> />
<PostBody <PostBody
post={post} post={post}

Просмотреть файл

@@ -52,6 +52,7 @@ export default class PostHeader extends React.Component {
handleCommentClick={this.props.handleCommentClick} handleCommentClick={this.props.handleCommentClick}
allowReply='true' allowReply='true'
isLastComment={this.props.isLastComment} isLastComment={this.props.isLastComment}
sameUser={this.props.sameUser}
/> />
</li> </li>
</ul> </ul>
@@ -62,11 +63,13 @@ export default class PostHeader extends React.Component {
PostHeader.defaultProps = { PostHeader.defaultProps = {
post: null, post: null,
commentCount: 0, commentCount: 0,
isLastComment: false isLastComment: false,
sameUser: false
}; };
PostHeader.propTypes = { PostHeader.propTypes = {
post: React.PropTypes.object, post: React.PropTypes.object,
commentCount: React.PropTypes.number, commentCount: React.PropTypes.number,
isLastComment: React.PropTypes.bool, isLastComment: React.PropTypes.bool,
handleCommentClick: React.PropTypes.func handleCommentClick: React.PropTypes.func,
sameUser: React.PropTypes.bool
}; };

Просмотреть файл

@@ -220,6 +220,7 @@ export default class PostInfo extends React.Component {
<li className='col'> <li className='col'>
<TimeSince <TimeSince
eventTime={post.create_at} eventTime={post.create_at}
sameUser={this.props.sameUser}
/> />
</li> </li>
<li className='col col__reply'> <li className='col col__reply'>
@@ -251,12 +252,14 @@ PostInfo.defaultProps = {
post: null, post: null,
commentCount: 0, commentCount: 0,
isLastComment: false, isLastComment: false,
allowReply: false allowReply: false,
sameUser: false
}; };
PostInfo.propTypes = { PostInfo.propTypes = {
post: React.PropTypes.object, post: React.PropTypes.object,
commentCount: React.PropTypes.number, commentCount: React.PropTypes.number,
isLastComment: React.PropTypes.bool, isLastComment: React.PropTypes.bool,
allowReply: React.PropTypes.string, allowReply: React.PropTypes.string,
handleCommentClick: React.PropTypes.func handleCommentClick: React.PropTypes.func,
sameUser: React.PropTypes.bool
}; };

Просмотреть файл

@@ -14,7 +14,7 @@ export default class TimeSince extends React.Component {
componentDidMount() { componentDidMount() {
this.intervalId = setInterval(() => { this.intervalId = setInterval(() => {
this.forceUpdate(); this.forceUpdate();
}, 30000); }, Constants.TIME_SINCE_UPDATE_INTERVAL);
} }
componentWillUnmount() { componentWillUnmount() {
clearInterval(this.intervalId); clearInterval(this.intervalId);
@@ -23,6 +23,14 @@ export default class TimeSince extends React.Component {
const displayDate = Utils.displayDate(this.props.eventTime); const displayDate = Utils.displayDate(this.props.eventTime);
const displayTime = Utils.displayTime(this.props.eventTime); const displayTime = Utils.displayTime(this.props.eventTime);
if (this.props.sameUser) {
return (
<time className='post__time'>
{Utils.displayTime(this.props.eventTime)}
</time>
);
}
const tooltip = ( const tooltip = (
<Tooltip id={'time-since-tooltip-' + this.props.eventTime}> <Tooltip id={'time-since-tooltip-' + this.props.eventTime}>
{displayDate + ' at ' + displayTime} {displayDate + ' at ' + displayTime}
@@ -42,10 +50,13 @@ export default class TimeSince extends React.Component {
); );
} }
} }
TimeSince.defaultProps = { TimeSince.defaultProps = {
eventTime: 0 eventTime: 0,
sameUser: false
}; };
TimeSince.propTypes = { TimeSince.propTypes = {
eventTime: React.PropTypes.number.isRequired eventTime: React.PropTypes.number.isRequired,
sameUser: React.PropTypes.bool
}; };

Просмотреть файл

@@ -462,5 +462,6 @@ export default {
MIN_USERNAME_LENGTH: 3, MIN_USERNAME_LENGTH: 3,
MAX_USERNAME_LENGTH: 15, MAX_USERNAME_LENGTH: 15,
MIN_PASSWORD_LENGTH: 5, MIN_PASSWORD_LENGTH: 5,
MAX_PASSWORD_LENGTH: 50 MAX_PASSWORD_LENGTH: 50,
TIME_SINCE_UPDATE_INTERVAL: 30000
}; };

Просмотреть файл

@@ -456,7 +456,7 @@ body.ios {
&:hover { &:hover {
.post__time { .post__time {
@include opacity(0.5);
} }
} }
@@ -480,27 +480,15 @@ body.ios {
} }
.post__time { .post__time {
display: inline-block; font: normal normal normal FontAwesome;
font: normal normal normal 14px/1 FontAwesome;
font-size: inherit;
text-rendering: auto; text-rendering: auto;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
font-size: 0;
position: absolute; position: absolute;
top: -3px; top: -3px;
left: 17px; left: -1.0em;
width: 30px;
height: 30px;
line-height: 37px; line-height: 37px;
@include opacity(0);
&:before {
@include opacity(0);
content: "\f017";
content: "\f017";
font-size: 19px;
}
} }
} }