Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scratch-www
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
scratch-www
Commits
3963a15c
Commit
3963a15c
authored
Oct 24, 2015
by
Ray Schamp
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #143 from rschamp/feature/empty-activity
Add empty state for What's Happening box
parents
b9ecbae5
d6de9ffe
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
23 deletions
+63
-23
src/components/activity/activity.jsx
src/components/activity/activity.jsx
+41
-23
src/components/box/box.scss
src/components/box/box.scss
+5
-0
src/main.scss
src/main.scss
+15
-0
src/views/components/components.jsx
src/views/components/components.jsx
+2
-0
No files found.
src/components/activity/activity.jsx
View file @
3963a15c
var
React
=
require
(
'
react
'
);
var
ReactIntl
=
require
(
'
react-intl
'
);
var
defineMessages
=
ReactIntl
.
defineMessages
;
var
FormattedMessage
=
ReactIntl
.
FormattedMessage
;
var
FormattedRelative
=
ReactIntl
.
FormattedRelative
;
var
injectIntl
=
ReactIntl
.
injectIntl
;
...
...
@@ -32,29 +33,46 @@ var Activity = React.createClass({
className=
"activity"
title=
{
formatMessage
(
defaultMessages
.
whatsHappening
)
}
>
<
ul
>
{
this
.
props
.
items
.
map
(
function
(
item
)
{
var
actorProfileUrl
=
'
/users/
'
+
item
.
actor
.
username
+
'
/
'
;
var
actionDate
=
new
Date
(
item
.
datetime_created
+
'
Z
'
);
var
activityMessageHTML
=
'
<a href=
'
+
actorProfileUrl
+
'
>
'
+
item
.
actor
.
username
+
'
</a>
'
+
item
.
message
;
if
(
item
.
message
.
replace
(
/
\s
/g
,
''
))
{
return
(
<
li
key=
{
item
.
pk
}
>
<
a
href=
{
actorProfileUrl
}
>
<
img
src=
{
item
.
actor
.
thumbnail_url
}
width=
"34"
height=
"34"
/>
<
p
dangerouslySetInnerHTML=
{
{
__html
:
activityMessageHTML
}
}
></
p
>
<
p
>
<
span
className=
"stamp"
>
<
FormattedRelative
value=
{
actionDate
}
/>
</
span
>
</
p
>
</
a
>
</
li
>
);
}
})
}
</
ul
>
{
this
.
props
.
items
&&
this
.
props
.
items
.
length
>
0
?
[
<
ul
>
{
this
.
props
.
items
.
map
(
function
(
item
)
{
if
(
item
.
message
.
replace
(
/
\s
/g
,
''
))
{
var
actorProfileUrl
=
'
/users/
'
+
item
.
actor
.
username
+
'
/
'
;
var
actionDate
=
new
Date
(
item
.
datetime_created
+
'
Z
'
);
var
activityMessageHTML
=
(
'
<a href=
'
+
actorProfileUrl
+
'
>
'
+
item
.
actor
.
username
+
'
</a>
'
+
item
.
message
);
return
(
<
li
key=
{
item
.
pk
}
>
<
a
href=
{
actorProfileUrl
}
>
<
img
src=
{
item
.
actor
.
thumbnail_url
}
width=
"34"
height=
"34"
/>
<
p
dangerouslySetInnerHTML=
{
{
__html
:
activityMessageHTML
}
}
></
p
>
<
p
>
<
span
className=
"stamp"
>
<
FormattedRelative
value=
{
actionDate
}
/>
</
span
>
</
p
>
</
a
>
</
li
>
);
}
})
}
</
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
>
);
}
...
...
src/components/box/box.scss
View file @
3963a15c
...
...
@@ -6,6 +6,7 @@ $base-bg: $ui-white;
display
:
inline-block
;
border
:
1px
solid
$ui-border
;
border-radius
:
10px
10px
0
0
;
background-color
:
$ui-white
;
width
:
100%
;
.box-header
{
...
...
@@ -44,4 +45,8 @@ $base-bg: $ui-white;
background-color
:
$base-bg
;
padding
:
8px
20px
;
}
.empty
{
margin-top
:
20px
;
}
}
src/main.scss
View file @
3963a15c
...
...
@@ -52,6 +52,21 @@ a:hover {
width
:
942px
;
}
.empty
{
$bg-blue
:
#d9edf7
;
$bg-blue-accent
:
#bce8f1
;
border
:
1px
solid
$bg-blue-accent
;
border-radius
:
5px
;
background-color
:
$bg-blue
;
padding
:
10px
;
text-align
:
center
;
line-height
:
2rem
;
color
:
$type-gray
;
h4
{
color
:
$type-gray
;
}
}
#view
{
/* NOTE: Margin should match height in navigation.scss */
margin-top
:
50px
;
...
...
src/views/components/components.jsx
View file @
3963a15c
...
...
@@ -35,6 +35,8 @@ var Components = React.createClass({
</
Box
>
<
h1
>
{
'
What
\'
s Happening??
'
}
</
h1
>
<
Activity
/>
<
h1
>
{
'
Nothing!!!
'
}
</
h1
>
<
Activity
items=
{
[]
}
/>
</
div
>
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment