mirror of
https://github.com/koodiklinikka/koodiklinikka.fi.git
synced 2026-03-14 17:04:01 +00:00
first version of working feed
This commit is contained in:
@@ -8,6 +8,7 @@ var transformers = require('../util');
|
|||||||
|
|
||||||
function throwError(err) {
|
function throwError(err) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
console.log(err.stack);
|
||||||
throw err;
|
throw err;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -29,7 +30,7 @@ module.exports = React.createClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
messages: messages
|
messages: _(messages).sortBy('timestamp').reverse().value()
|
||||||
});
|
});
|
||||||
}).catch(throwError);
|
}).catch(throwError);
|
||||||
},
|
},
|
||||||
@@ -59,18 +60,3 @@ module.exports = React.createClass({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// <div className="message">
|
|
||||||
// <img className="message__image" src={message.image} />
|
|
||||||
// <div className="message__content">
|
|
||||||
// <div className="message__body">{message.body}</div>
|
|
||||||
// <div className="message__icon">
|
|
||||||
// <i className={`fa fa-${message.type}`}></i>
|
|
||||||
// </div>
|
|
||||||
// <div className="message__details">
|
|
||||||
// <span className="message__timestamp">
|
|
||||||
// {require('timeago')(message.timestamp)}
|
|
||||||
// </span>
|
|
||||||
// <span className="message__meta">{message.meta}</span>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
|
|||||||
@@ -1,19 +1,35 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
var _ = require('lodash');
|
||||||
var githubEvent = require('parse-github-event');
|
var githubEvent = require('parse-github-event');
|
||||||
var twitterText = require('twitter-text');
|
var twitterText = require('twitter-text');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
github(item) {
|
github(item) {
|
||||||
var message = githubEvent.parse(item);
|
|
||||||
console.log(item);
|
_.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
|
||||||
console.log(message.data);
|
|
||||||
|
var template = _.template(githubEvent.parse(item).text);
|
||||||
|
|
||||||
|
var repository = `https://github.com/${item.repo.name}`;
|
||||||
|
|
||||||
|
var branch;
|
||||||
|
if(item.payload.ref) {
|
||||||
|
branch = item.payload.ref.replace('refs/heads/', '');
|
||||||
|
}
|
||||||
|
|
||||||
|
var message = template({
|
||||||
|
repository: `<a target="_blank" href="${repository}">${item.repo.name}</a>`,
|
||||||
|
branch: branch,
|
||||||
|
number: item.payload.number,
|
||||||
|
ref_type: item.payload.ref
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
image: item.actor.avatar_url,
|
image: item.actor.avatar_url,
|
||||||
body: `${item.actor.login} ${message.text}`,
|
body: `${item.actor.login} ${message}`,
|
||||||
timestamp: item.created_at,
|
timestamp: new Date(item.created_at),
|
||||||
url: message.url,
|
url: message.url,
|
||||||
highlights: message.data,
|
|
||||||
type: 'github'
|
type: 'github'
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -21,7 +37,7 @@ module.exports = {
|
|||||||
return {
|
return {
|
||||||
image: item.user.profile_image_url,
|
image: item.user.profile_image_url,
|
||||||
body: twitterText.autoLink(item.text),
|
body: twitterText.autoLink(item.text),
|
||||||
timestamp: item.created_at,
|
timestamp: new Date(item.created_at),
|
||||||
type: 'twitter'
|
type: 'twitter'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ section:first-child
|
|||||||
|
|
||||||
.column
|
.column
|
||||||
float left
|
float left
|
||||||
|
overflow auto
|
||||||
padding 0 1em
|
padding 0 1em
|
||||||
box-sizing border-box
|
box-sizing border-box
|
||||||
@media screen and (max-width: 700px)
|
@media screen and (max-width: 700px)
|
||||||
@@ -95,6 +96,9 @@ section:first-child
|
|||||||
width 50%
|
width 50%
|
||||||
@media screen and (max-width: 700px)
|
@media screen and (max-width: 700px)
|
||||||
width 100%
|
width 100%
|
||||||
|
margin-top 1em
|
||||||
|
&:first-child
|
||||||
|
margin-top 0
|
||||||
|
|
||||||
.invite-form
|
.invite-form
|
||||||
position relative
|
position relative
|
||||||
@@ -142,7 +146,7 @@ section:first-child
|
|||||||
|
|
||||||
.members
|
.members
|
||||||
margin-top 1em
|
margin-top 1em
|
||||||
|
margin-bottom 1em
|
||||||
.member
|
.member
|
||||||
width 57px
|
width 57px
|
||||||
vertical-align middle
|
vertical-align middle
|
||||||
@@ -158,6 +162,7 @@ footer
|
|||||||
margin 0 0.30em
|
margin 0 0.30em
|
||||||
font-size 1.5em
|
font-size 1.5em
|
||||||
color #fff
|
color #fff
|
||||||
|
|
||||||
.feed
|
.feed
|
||||||
width feedWidth
|
width feedWidth
|
||||||
height 100%
|
height 100%
|
||||||
@@ -171,11 +176,16 @@ footer
|
|||||||
&::-webkit-scrollbar
|
&::-webkit-scrollbar
|
||||||
display none
|
display none
|
||||||
|
|
||||||
|
@media screen and (max-width: 980px)
|
||||||
|
.feed
|
||||||
|
width 0
|
||||||
|
.content
|
||||||
|
padding-right 0
|
||||||
|
|
||||||
.message
|
.message
|
||||||
padding 1em
|
padding 0.5em 1em
|
||||||
padding-right 2em
|
padding-right 2em
|
||||||
padding-bottom 0.5em
|
padding-left 4.5em
|
||||||
padding-top 0.6em
|
|
||||||
|
|
||||||
border-top 1px solid #E5E5E5
|
border-top 1px solid #E5E5E5
|
||||||
position relative
|
position relative
|
||||||
@@ -186,10 +196,10 @@ footer
|
|||||||
font-size 16px
|
font-size 16px
|
||||||
|
|
||||||
.message__image
|
.message__image
|
||||||
margin-top 4px
|
width 2.5em
|
||||||
margin-right 10px
|
position absolute
|
||||||
float left
|
left 1em
|
||||||
width 50px
|
top 0.8em
|
||||||
|
|
||||||
.message__icon
|
.message__icon
|
||||||
margin 6px
|
margin 6px
|
||||||
@@ -206,9 +216,7 @@ footer
|
|||||||
|
|
||||||
.message__details
|
.message__details
|
||||||
font-size 0.8em
|
font-size 0.8em
|
||||||
margin-top 5px
|
margin-top 0.3em
|
||||||
|
|
||||||
|
|
||||||
.message__meta
|
.message__meta
|
||||||
margin-left 0.5em
|
margin-left 0.5em
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user