Commit c8834ed2 authored by Ray Schamp's avatar Ray Schamp

Add empty state for What's Happening box

parent 21b73862
var React = require('react'); var React = require('react');
var ReactIntl = require('react-intl'); var ReactIntl = require('react-intl');
var defineMessages = ReactIntl.defineMessages; var defineMessages = ReactIntl.defineMessages;
var FormattedMessage = ReactIntl.FormattedMessage;
var FormattedRelative = ReactIntl.FormattedRelative; var FormattedRelative = ReactIntl.FormattedRelative;
var injectIntl = ReactIntl.injectIntl; var injectIntl = ReactIntl.injectIntl;
...@@ -32,29 +33,44 @@ var Activity = React.createClass({ ...@@ -32,29 +33,44 @@ var Activity = React.createClass({
className="activity" className="activity"
title={formatMessage(defaultMessages.whatsHappening)}> title={formatMessage(defaultMessages.whatsHappening)}>
<ul> {this.props.items && this.props.items.length > 0 ? [
{this.props.items.map(function (item) { <ul>
var actorProfileUrl = '/users/' + item.actor.username + '/'; {this.props.items.map(function (item) {
var actionDate = new Date(item.datetime_created + 'Z'); var actorProfileUrl = '/users/' + item.actor.username + '/';
var activityMessageHTML = '<a href=' + actorProfileUrl + '>' + var actionDate = new Date(item.datetime_created + 'Z');
item.actor.username + '</a>' + item.message; var activityMessageHTML = '<a href=' + actorProfileUrl + '>' +
if (item.message.replace(/\s/g, '')) { item.actor.username + '</a>' + item.message;
return ( if (item.message.replace(/\s/g, '')) {
<li key={item.pk}> return (
<a href={actorProfileUrl}> <li key={item.pk}>
<img src={item.actor.thumbnail_url} width="34" height="34" /> <a href={actorProfileUrl}>
<p dangerouslySetInnerHTML={{__html: activityMessageHTML}}></p> <img src={item.actor.thumbnail_url} width="34" height="34" />
<p> <p dangerouslySetInnerHTML={{__html: activityMessageHTML}}></p>
<span className="stamp"> <p>
<FormattedRelative value={actionDate} /> <span className="stamp">
</span> <FormattedRelative value={actionDate} />
</p> </span>
</a> </p>
</li> </a>
); </li>
} );
})} }
</ul> })}
</ul>
] : [
<div className="empty">
<h4>
<FormattedMessage
id="activity.seeUpdates"
defaultMessage="This is where you will see updates from Scratchers you follow" />
</h4>
<a href="/studios/146521/">
<FormattedMessage
id="activity.checkOutScratchers"
defaultMessage="Check out some Scratchers you might like to follow" />
</a>
</div>
]}
</Box> </Box>
); );
} }
......
...@@ -44,4 +44,8 @@ $base-bg: $ui-white; ...@@ -44,4 +44,8 @@ $base-bg: $ui-white;
background-color: $base-bg; background-color: $base-bg;
padding: 8px 20px; padding: 8px 20px;
} }
.empty {
margin-top: 20px;
}
} }
...@@ -52,6 +52,20 @@ a:hover { ...@@ -52,6 +52,20 @@ a:hover {
width: 942px; width: 942px;
} }
.empty {
$bg-blue: #d9edf7;
$bg-blue-accent: #bce8f1;
border: 1px solid $bg-blue-accent;
border-radius: 5px;
background-color: $bg-blue;
text-align: center;
line-height: 2rem;
color: $type-gray;
h4 {
color: $type-gray;
}
}
#view { #view {
/* NOTE: Margin should match height in navigation.scss */ /* NOTE: Margin should match height in navigation.scss */
margin-top: 50px; margin-top: 50px;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment