compact.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import React from 'react';
  2. import Category from 'misago/components/threads-list/thread/category'; // jshint ignore:line
  3. export default class extends React.Component {
  4. getPath() {
  5. let top = this.props.categories[this.props.thread.top_category];
  6. let bottom = this.props.categories[this.props.thread.category];
  7. if (top && bottom && top.id !== bottom.id) {
  8. /* jshint ignore:start */
  9. return <li className="thread-path">
  10. <Category category={bottom} list={this.props.list} />
  11. </li>;
  12. /* jshint ignore:end */
  13. } else if (top) {
  14. /* jshint ignore:start */
  15. return <li className="thread-path">
  16. <Category category={top} list={this.props.list} />
  17. </li>;
  18. /* jshint ignore:end */
  19. } else {
  20. return null;
  21. }
  22. }
  23. getRepliesCount() {
  24. /* jshint ignore:start */
  25. return <li className="thread-replies-count">
  26. <span className="material-icon">
  27. forum
  28. </span>
  29. <span className="icon-legend">
  30. {this.props.thread.replies}
  31. </span>
  32. </li>;
  33. /* jshint ignore:end */
  34. }
  35. getLastReply() {
  36. /* jshint ignore:start */
  37. return <li className="thread-last-reply-clock">
  38. <span className="material-icon">
  39. schedule
  40. </span>
  41. <span className="icon-legend">
  42. {this.props.thread.last_post_on.fromNow()}
  43. </span>
  44. </li>;
  45. /* jshint ignore:end */
  46. }
  47. render () {
  48. /* jshint ignore:start */
  49. return <ul className="thread-details-compact list-inline">
  50. {this.getPath()}
  51. {this.getRepliesCount()}
  52. {this.getLastReply()}
  53. </ul>;
  54. /* jshint ignore:end */
  55. }
  56. }