From c4992407aa2be8bb64afeb8decd9fb68cc21b949 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Thu, 13 Aug 2015 13:06:23 +0930 Subject: [PATCH] Reuse CommentPost component for PostsUserPage --- js/forum/src/components/PostedActivity.js | 56 ---------------- js/forum/src/components/PostsUserPage.js | 15 +++-- less/forum/ActivityPage.less | 78 ++++------------------- 3 files changed, 24 insertions(+), 125 deletions(-) delete mode 100644 js/forum/src/components/PostedActivity.js diff --git a/js/forum/src/components/PostedActivity.js b/js/forum/src/components/PostedActivity.js deleted file mode 100644 index 69891a1d2..000000000 --- a/js/forum/src/components/PostedActivity.js +++ /dev/null @@ -1,56 +0,0 @@ -import Activity from 'flarum/components/Activity'; -import listItems from 'flarum/helpers/listItems'; -import ItemList from 'flarum/utils/ItemList'; -import { truncate } from 'flarum/utils/string'; - -/** - * The `PostedActivity` component displays an activity feed item for when a user - * started or posted in a discussion. - * - * ### Props - * - * - All of the props for Activity - */ -export default class PostedActivity extends Activity { - user() { - return this.props.post.user(); - } - - time() { - return this.props.post.time(); - } - - description() { - return app.trans(this.props.post.number() === 1 ? 'core.started_a_discussion' : 'core.posted_a_reply'); - } - - content() { - const post = this.props.post; - - return ( - - -
- {m.trust(truncate(post.contentPlain(), 200))} -
-
- ); - } - - /** - * Build an item list for the header of the post preview. - * - * @return {[type]} - */ - headerItems() { - const items = new ItemList(); - - items.add('title',

{this.props.post.discussion().title()}

); - - return items; - } -} diff --git a/js/forum/src/components/PostsUserPage.js b/js/forum/src/components/PostsUserPage.js index 2349418d8..efe4e36a6 100644 --- a/js/forum/src/components/PostsUserPage.js +++ b/js/forum/src/components/PostsUserPage.js @@ -1,7 +1,7 @@ import UserPage from 'flarum/components/UserPage'; import LoadingIndicator from 'flarum/components/LoadingIndicator'; import Button from 'flarum/components/Button'; -import PostedActivity from 'flarum/components/PostedActivity'; +import CommentPost from 'flarum/components/CommentPost'; /** * The `PostsUserPage` component shows a user's activity feed inside of their @@ -61,10 +61,15 @@ export default class PostsUserPage extends UserPage { return (
-
diff --git a/less/forum/ActivityPage.less b/less/forum/ActivityPage.less index a1655d219..4fb657272 100644 --- a/less/forum/ActivityPage.less +++ b/less/forum/ActivityPage.less @@ -5,76 +5,26 @@ height: 46px; } } -.ActivityList { - border-left: 3px solid @control-bg; - list-style: none; - margin: 0 0 0 16px; - padding: 0; - - > li { - margin-bottom: 30px; - padding-left: 32px; - - @media @phone { - padding-left: 24px; - } - } -} -.Activity-avatar { - .Avatar--size(32px); - float: left; - margin-left: -50px; - .box-shadow(0 0 0 3px @body-bg); - margin-top: -5px; - - @media @phone { - margin-left: -42px; - } -} -.Activity-header { - color: @muted-color; - margin-bottom: 10px; -} -.Activity-description { - margin-right: 5px; -} -.Activity-content { - display: block; - padding: 15px; - background: @control-bg; - border-radius: @border-radius; - color: @muted-color; - - &, &:hover { - text-decoration: none; - } -} -.PostedActivity-header { - margin: 0 0 5px; +.PostsUserPage-list { + margin: 0; padding: 0; list-style: none; > li { - display: inline-block; - margin-right: 5px; - } - h3 { - font-size: 14px; - font-weight: bold; - margin: 0; - - &, & a { - color: @heading-color; - } - .Activity-content:hover & { - text-decoration: underline; - } + border-bottom: 1px solid @control-bg; } } -.PostedActivity-body { - color: @muted-color; +.PostsUserPage-discussion { + font-weight: bold; + margin-top: 15px; + margin-bottom: -15px; + position: relative; + z-index: 1; - & :last-child { - margin-bottom: 0; + &, a { + color: @muted-color; + } + a { + font-style: italic; } }