Skip to content

Commit 1566561

Browse files
committed
No search results message
1 parent 5fe3a74 commit 1566561

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

src/js/components/notifications.js

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ var Notifications = React.createClass({
5757
render: function () {
5858
var notifications, errors;
5959
var wrapperClass = 'container-fluid main-container notifications';
60+
var notificationsEmpty = _.isEmpty(this.state.notifications);
6061

6162
if (this.state.errors) {
62-
wrapperClass += ' errored';
6363
errors = (
6464
<div>
6565
<h3>Oops something went wrong.</h3>
@@ -68,8 +68,7 @@ var Notifications = React.createClass({
6868
</div>
6969
);
7070
} else {
71-
if (_.isEmpty(this.state.notifications)) {
72-
wrapperClass += ' all-read';
71+
if (notificationsEmpty) {
7372
notifications = (
7473
<div>
7574
<h2>There are no notifications for you.</h2>
@@ -84,17 +83,31 @@ var Notifications = React.createClass({
8483
notifications = this.state.notifications;
8584
}
8685

87-
notifications = (
88-
notifications.map(function (obj) {
89-
var repoFullName = obj[0].repository.full_name;
90-
return <Repository repo={obj} repoName={repoFullName} key={repoFullName} />;
91-
})
92-
);
86+
if (notifications.length) {
87+
notifications = (
88+
notifications.map(function (obj) {
89+
var repoFullName = obj[0].repository.full_name;
90+
return <Repository repo={obj} repoName={repoFullName} key={repoFullName} />;
91+
})
92+
);
93+
} else {
94+
errors = (
95+
<div>
96+
<h3>No Search Results.</h3>
97+
<h4>No Organisations or Repositories match your search term.</h4>
98+
<img className='img-responsive emoji' src='images/all-read.png' />
99+
</div>
100+
);
101+
}
93102
}
94103
}
95104

96105
return (
97-
<div className={wrapperClass}>
106+
<div className={
107+
wrapperClass +
108+
(this.state.errors ? ' errorred' : '') +
109+
(notificationsEmpty || !notifications.length ? ' all-read' : '')
110+
}>
98111
<Loading className='loading-container' shouldShow={this.state.loading}>
99112
<div className='loading-text'>working on it</div>
100113
</Loading>

0 commit comments

Comments
 (0)