Commit d547b0ad authored by Roger Jungemann's avatar Roger Jungemann
Browse files

Strip out most post-related component code

parent f0e55d74
......@@ -67,9 +67,6 @@ export default function resolveRoute(path) {
if (path === '/~witnesses') {
return { page: 'Witnesses' };
}
if (path === '/submit.html') {
return { page: 'SubmitPost' };
}
let match = path.match(routeRegex.PostsIndex);
if (match) {
if (GDPRUserList.includes(match[1].substring(1))) {
......
......@@ -41,7 +41,6 @@ describe('resolveRoute', () => {
['/waiting_list.html', { page: 'WaitingList' }],
['/market', { page: 'Market' }],
['/~witnesses', { page: 'Witnesses' }],
['/submit.html', { page: 'SubmitPost' }],
[
'/@maitland/feed',
{ page: 'PostsIndex', params: ['home', '@maitland'] },
......
......@@ -12,109 +12,56 @@ export default {
getChildRoutes(nextState, cb) {
const route = resolveRoute(nextState.location.pathname);
if (route.page === 'About') {
//require.ensure([], (require) => {
cb(null, [require('app/components/pages/About')]);
//});
} else if (route.page === 'Welcome') {
//require.ensure([], (require) => {
cb(null, [require('app/components/pages/Welcome')]);
//});
} else if (route.page === 'Faq') {
//require.ensure([], (require) => {
cb(null, [require('app/components/pages/Faq')]);
//});
} else if (route.page === 'Login') {
//require.ensure([], (require) => {
cb(null, [require('app/components/pages/Login')]);
//});
} else if (route.page === 'Privacy') {
//require.ensure([], (require) => {
cb(null, [require('app/components/pages/Privacy')]);
//});
} else if (route.page === 'Support') {
//require.ensure([], (require) => {
cb(null, [require('app/components/pages/Support')]);
//});
} else if (
route.page === 'XSSTest' &&
process.env.NODE_ENV === 'development'
) {
//require.ensure([], (require) => {
cb(null, [require('app/components/pages/XSS')]);
//});
} else if (route.page === 'Benchmark') {
//require.ensure([], (require) => {
cb(null, [require('app/components/pages/Benchmark')]);
//});
} else if (route.page === 'Tags') {
//require.ensure([], (require) => {
cb(null, [require('app/components/pages/TagsIndex')]);
//});
} else if (route.page === 'Tos') {
//require.ensure([], (require) => {
cb(null, [require('app/components/pages/Tos')]);
//});
} else if (route.page === 'ChangePassword') {
//require.ensure([], (require) => {
cb(null, [require('app/components/pages/ChangePasswordPage')]);
//});
} else if (route.page === 'PickAccount') {
//require.ensure([], (require) => {
cb(null, [require('app/components/pages/PickAccount')]);
//});
} else if (route.page === 'CreateAccount') {
//require.ensure([], (require) => {
cb(null, [require('app/components/pages/CreateAccount')]);
//});
} else if (route.page === 'Approval') {
//require.ensure([], (require) => {
cb(null, [require('app/components/pages/Approval')]);
//});
} else if (route.page === 'RecoverAccountStep1') {
//require.ensure([], (require) => {
cb(null, [require('app/components/pages/RecoverAccountStep1')]);
//});
} else if (route.page === 'RecoverAccountStep2') {
//require.ensure([], (require) => {
cb(null, [require('app/components/pages/RecoverAccountStep2')]);
//});
} else if (route.page === 'WaitingList') {
//require.ensure([], (require) => {
cb(null, [require('app/components/pages/WaitingList')]);
//});
} else if (route.page === 'Witnesses') {
//require.ensure([], (require) => {
cb(null, [require('app/components/pages/Witnesses')]);
//});
} else if (route.page === 'SubmitPost') {
if (process.env.BROWSER) {
// require.ensure([], (require) => {
cb(null, [require('app/components/pages/SubmitPost')]);
// });
} else {
cb(null, [
require('app/components/pages/SubmitPostServerRender'),
]);
}
} else if (route.page === 'UserProfile') {
//require.ensure([], (require) => {
cb(null, [require('app/components/pages/UserProfile')]);
//});
} else if (route.page === 'Market') {
require.ensure([], require => {
cb(null, [require('app/components/pages/Market')]);
});
} else if (route.page === 'PostsIndex') {
//require.ensure([], (require) => {
//cb(null, [require('app/components/pages/PostsIndex')]);
cb(null, [PostsIndex]);
//});
} else {
//require.ensure([], (require) => {
cb(process.env.BROWSER ? null : Error(404), [
require('app/components/pages/NotFound'),
]);
//});
}
},
indexRoute: {
......
......@@ -2,9 +2,6 @@
// cards
@import "./cards/MarkdownViewer";
@import "./cards/PostSummary";
@import "./cards/PostFull";
@import "./cards/PostsList";
@import "./cards/TransferHistoryRow/style";
// elements
......@@ -13,7 +10,6 @@
@import "./elements/Userpic";
@import "./elements/Voting";
@import "./elements/FormattedAsset";
@import "./elements/ReplyEditor";
@import "./elements/DropdownMenu";
@import "./elements/VerticalMenu";
@import "./elements/HorizontalMenu";
......@@ -56,7 +52,6 @@
@import "./modules/Transfer";
// pages
@import "./pages/PostsIndex";
@import "./pages/Topics";
@import "./pages/CreateAccount";
@import "./pages/Privacy";
......
This diff is collapsed.
.Post {
@include themify($themes) {
background-color: themed('moduleBackgroundColor');
}
}
.PostFull {
padding-bottom: 1rem;
padding-top: 2rem;
margin: 0 auto;
max-width: 50rem;
@include themify($themes) {
border-bottom: themed('border');
}
.button.hollow {
@include themify($themes) {
border: themed('borderAccent');
color: themed('textColorAccent');
}
}
.ReplyEditor {
margin-top: 1rem;
}
}
.PostFull__time_author_category {
font-weight: 400;
border-right: none!important;
@include themify($themes) {
border-right: themed('border');
color: themed('textColorSecondary');
}
padding-right: .6rem;
margin-right: .6rem;
> span {
white-space: nowrap;
}
}
.PostFull__time_author_category_large {
margin: 1rem 0 1rem 0;
line-height: 1.2;
@include themify($themes) {
color: themed('textColorSecondary');
}
strong, a {
@include themify($themes) {
color: themed('textColorSecondary');
}
}
font-size: 120%;
display: flex;
align-items: center;
> .Userpic {
margin-top: -4px;
float: left;
}
> .right-side {
margin-left: 12px;
position: relative;
top: -2px;
}
}
.PostFull__header, .PostFull__body {
max-width: 40rem;
margin: 0 auto;
}
.PostFull__header {
@include themify($themes) {
border-bottom: themed('border');
}
> h1 {
overflow: hidden;
font-family: $body-font-family;
font-size: 240%;
font-weight: 800;
line-height: 1.1;
.Icon {
margin: 0 0 0 0.5rem;
vertical-align: -30%;
}
}
a {
@extend .link;
@extend .link--secondary;
font-weight: 600;
}
.PostFull__time_author_category {
border-right: none;
.Icon.clock {
top: 5px;
svg {
@include themify($themes) {
fill: themed('textColorSecondary');
}
}
}
}
}
.PostFull__body {
padding: 1rem 0 2rem 0;
clear: left;
a {
@extend .link;
@extend .link--accent;
}
}
.PostFull__footer {
clear: right;
line-height: 2rem;
font-size: 94%;
svg {
@include themify($themes) {
fill: themed('textColorSecondary');
}
}
.RightShare__Menu {
@include MQ(FL) {
text-align: right;
}
}
.VerticalMenu > li > a {
@include themify($themes) {
fill: themed('textColorSecondary');
}
}
span {
white-space: normal;
}
.Reblog__button {
padding-right: .4rem;
margin-right: .4rem;
@include themify($themes) {
border-right: themed('border');
}
}
}
.PostFull__responses {
padding-right: .4rem;
}
.PostFull__views {
padding-right: .4rem;
margin-right: .4rem;
font-size: 94%;
font-weight: 600;
@include themify($themes) {
border-right: themed('border');
fill: themed('textColorSecondary');
}
}
.PostFull__reply {
padding-right: .4rem;
margin-right: .4rem;
@include themify($themes) {
border-right: themed('border');
}
a {margin: 0 0.15rem;}
}
.PostFull__lifetime {
@include themify($themes) {
fill: themed('textColorSecondary');
}
font-size: 80%;
}
.Author__dropdown {
padding: 1rem;
> a {
@include hoverUnderline;
}
}
.explore-post {
margin-right: 0px!important;
cursor: pointer;
&:hover {
svg {
fill: $color-teal;
}
}
}
input.share-box {
width: 75%!important;
display: inline;
}
.ExplorePost {
span.extlink {
vertical-align: text-bottom;
}
h5 {
margin-top: 1em;
}
.ExplorePost__copy-button {
cursor: pointer;
}
}
.chain-right {
-webkit-transform: rotate(120deg);
-moz-transform: rotate(120deg);
-ms-transform: rotate(120deg);
-o-transform: rotate(120deg);
transform: rotate(120deg);
}
/* Small only */
@media screen and (max-width: 39.9375em) {
.Post {
width: 100%;
overflow-x: hidden;
overflow-y: visible;
}
.PostFull__footer > .column {
-webkit-box-flex: 0;
-ms-flex: 0 0 100%;
flex: 0 0 100%;
}
input.share-box {
height: 2.8em;
font-size: .8em;
}
}
/* Medium only */
@media screen and (min-width: 40em) and (max-width: 63.9375em) {
input.share-box {
height: 2.8em;
font-size: .8em;
}
}
import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router';
import TimeAgoWrapper from 'app/components/elements/TimeAgoWrapper';
import Icon from 'app/components/elements/Icon';
import { connect } from 'react-redux';
import * as userActions from 'app/redux/UserReducer';
import Reblog from 'app/components/elements/Reblog';
import Voting from 'app/components/elements/Voting';
import { immutableAccessor } from 'app/utils/Accessors';
import extractContent from 'app/utils/ExtractContent';
import VotesAndComments from 'app/components/elements/VotesAndComments';
import { Map } from 'immutable';
import Author from 'app/components/elements/Author';
import TagList from 'app/components/elements/TagList';
import UserNames from 'app/components/elements/UserNames';
import tt from 'counterpart';
import ImageUserBlockList from 'app/utils/ImageUserBlockList';
import proxifyImageUrl from 'app/utils/ProxifyUrl';
import Userpic, { avatarSize } from 'app/components/elements/Userpic';
import { SIGNUP_URL } from 'shared/constants';
class PostSummary extends React.Component {
static propTypes = {
post: PropTypes.string.isRequired,
pending_payout: PropTypes.string.isRequired,
total_payout: PropTypes.string.isRequired,
content: PropTypes.object.isRequired,
thumbSize: PropTypes.string,
nsfwPref: PropTypes.string,
};
constructor() {
super();
this.state = { revealNsfw: false };
this.onRevealNsfw = this.onRevealNsfw.bind(this);
}
shouldComponentUpdate(props, state) {
return (
props.thumbSize !== this.props.thumbSize ||
props.pending_payout !== this.props.pending_payout ||
props.total_payout !== this.props.total_payout ||
props.username !== this.props.username ||
props.nsfwPref !== this.props.nsfwPref ||
props.blogmode !== this.props.blogmode ||
state.revealNsfw !== this.state.revealNsfw
);
}
onRevealNsfw(e) {
e.preventDefault();
this.setState({ revealNsfw: true });
}
render() {
const { thumbSize, ignore } = this.props;
const { post, content } = this.props;
const { account } = this.props;
if (!content) return null;
let reblogged_by;
if (
content.get('reblogged_by') &&
content.get('reblogged_by').size > 0
) {
reblogged_by = content.get('reblogged_by').toJS();
}
if (reblogged_by) {
reblogged_by = (
<div className="articles__resteem">
<p className="articles__resteem-text">
<span className="articles__resteem-icon">
<Icon name="reblog" />
</span>
<UserNames names={reblogged_by} />{' '}
{tt('postsummary_jsx.resteemed')}
</p>
</div>
);
}
// 'account' is the current blog being viewed, if applicable.
if (account && account != content.get('author')) {
reblogged_by = (
<div className="articles__resteem">
<p className="articles__resteem-text">
<span className="articles__resteem-icon">
<Icon name="reblog" />
</span>
{tt('postsummary_jsx.resteemed')}
</p>
</div>
);
}
const { gray, authorRepLog10, flagWeight, isNsfw } = content
.get('stats', Map())
.toJS();
const pinned = content.get('pinned');
const p = extractContent(immutableAccessor, content);
const desc = p.desc;
const archived = content.get('cashout_time') === '1969-12-31T23:59:59'; // TODO: audit after HF17. #1259
const full_power = content.get('percent_steem_dollars') === 0;
let post_url;
let title_text;
let comments_url;
if (content.get('depth') > 0) {
title_text = tt('g.re_to', { topic: content.get('root_title') });
post_url =
'/' +
content.get('category') +
'/@' +
content.get('author') +
'/' +
content.get('permlink');
comments_url = p.link + '#comments';
} else {
title_text = p.title;
post_url = p.link;
comments_url = post_url + '#comments';
}
const content_body = (
<div className="PostSummary__body entry-content">
<Link to={post_url}>{desc}</Link>
</div>
);
const content_title = (
<h2 className="articles__h2 entry-title">
<Link to={post_url}>
{isNsfw && <span className="nsfw-flag">nsfw</span>}
{title_text}
</Link>
</h2>
);
// author and category
const author_category = (
<span className="vcard">
<Userpic account={p.author} />
<Author
author={p.author}
authorRepLog10={authorRepLog10}
follow={false}
mute={false}
/>
{} {tt('g.in')} <TagList post={p} single />&nbsp;&nbsp;
<Link to={post_url}>
<TimeAgoWrapper date={p.created} className="updated" />
</Link>
</span>
);
// New Post Summary heading
const summary_header = (
<div className="articles__summary-header">
<div className="user">
{!isNsfw ? (
<div className="user__col user__col--left">
<a className="user__link" href={'/@' + p.author}>
<Userpic
account={p.author}
size={avatarSize.small}
/>
</a>
</div>
) : null}
<div className="user__col user__col--right">
<span className="user__name">
<Author
author={p.author}
authorRepLog10={authorRepLog10}
follow={false}
mute={false}
/>
</span>
<span className="articles__tag-link">
{tt('g.in')}&nbsp;<TagList post={p} single />&nbsp;&nbsp;
</span>
<Link className="timestamp__link" to={post_url}>
<span className="timestamp__time">
<TimeAgoWrapper
date={p.created}
className="updated"
/>
</span>
{full_power && (
<span
className="articles__icon-100"
title={tt('g.powered_up_100')}
>
<Icon name="steempower" />
</span>