Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add generic ulog caption to right side bar for empty ulog subtags #291

Merged
merged 1 commit into from
May 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions src/client/app/Sidebar/RightSidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,6 @@ export default class RightSidebar extends React.Component {
}
}
const isWitnessVoted = checkVote();
const { category } = match.params;
const displayUlogCaption =
category &&
category.match(
/^(ulog-quotes|ulog-howto|ulog-diy|ulog-surpassinggoogle|teardrops|untalented|ulog-ned|ulography|ulog-gratefulvibes|ulog-resolutions|ulog-memes|ulog-blocktrades|ulog-showerthoughts|ulog-snookmademedoit|ulog-utopian|ulog-thejohalfiles|ulogifs|ulog-surfyogi|ulog-bobbylee|ulog-stellabelle|ulog-sweetsssj|ulog-dimimp|ulog-teamsteem|ulog-kusknee|ulog-papapepper|ulog-steemjet)$/,
);

return (
<div>
Expand Down
3 changes: 3 additions & 0 deletions src/client/components/Sidebar/FeedSidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import CryptoTrendingCharts from './CryptoTrendingCharts';
import ChatBar from '../../components/Sidebar/ChatBar';
import UlogGamesExchanges from '../../components/Sidebar/UlogGamesExchanges';
import UlogCaption from '../../feed/UlogCaption';
import UlogGenericCaption from '../../feed/UlogGenericCaption';

@connect(
state => ({
Expand Down Expand Up @@ -52,11 +53,13 @@ class FeedSidebar extends React.Component {
tag.match(
/^(ulog-quotes|ulog-howto|ulog-diy|ulog-surpassinggoogle|teardrops|untalented|ulog-ned|ulography|ulog-gratefulvibes|ulog-resolutions|ulog-memes|ulog-blocktrades|ulog-showerthoughts|ulog-snookmademedoit|ulog-utopian|ulog-thejohalfiles|ulogifs|ulog-surfyogi|ulog-bobbylee|ulog-stellabelle|ulog-sweetsssj|ulog-dimimp|ulog-teamsteem|ulog-kusknee|ulog-papapepper|ulog-steemjet)$/,
);
const isStartsWithUlog = tag && tag.startsWith('ulog-');
return (
<div>
{!_.isEmpty(currentCrypto) && <CryptoTrendingCharts cryptos={[currentTag]} />}
<React.Fragment>
{displayUlogCaption && <UlogCaption category={tag} />}
{(!displayUlogCaption && isStartsWithUlog) && <UlogGenericCaption category={tag} />}
<OverseeingUloggers authenticatedUser={authenticatedUser} />
<UlogGamesExchanges isFetchingFollowingList={false} />
<ChatBar isFetchingFollowingList={false} authenticated={authenticated} />
Expand Down
4 changes: 2 additions & 2 deletions src/client/feed/Page.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ class Page extends React.Component {
) : (
<HeroBannerContainer />
)}
{displayUlogCaption && <UlogsBanner category={category} />}
{(!displayUlogCaption && isStartsWithUlog) && <UlogsBanner category={category} />}
{(authenticated && displayUlogCaption) && <UlogsBanner category={category} />}
{(authenticated && !displayUlogCaption && isStartsWithUlog) && <UlogsBanner category={category} />}
<MainMenu />
<div className="shifted">
<div className="feed-layout container">
Expand Down
52 changes: 52 additions & 0 deletions src/client/feed/UlogGenericCaption.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/* eslint-disable react/no-unescaped-entities */

import React from 'react';
import PropTypes from 'prop-types';
import { Collapse, Button, Icon } from 'antd';
import { injectIntl, FormattedMessage } from 'react-intl';
import ReactMarkdown from 'react-markdown';
import { generic } from '../helpers/ulogCaptions';

@injectIntl
class UlogGenericCaption extends React.Component {
static propTypes = {
category: PropTypes.string.isRequired,
};

constructor(props) {
super(props);
}

render() {
const category = this.props.category;
const about = `About #${category}`;

return (
<div className="ulog-quotes">
<Collapse defaultActiveKey={['1']}>
<Collapse.Panel header={about} key="1">
<ReactMarkdown source={generic} />
<div
style={{
width: '100%',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
marginTop: '10px',
}}
>
<Button
type={'primary'}
href='/main-editor'
>
<FormattedMessage id="post_now" defaultMessage="Post now" />
</Button>
</div>
</Collapse.Panel>
</Collapse>
</div>
);
}
}

export default UlogGenericCaption;
7 changes: 7 additions & 0 deletions src/client/helpers/ulogCaptions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

export const generic = `This is an empty #ulog-community. &nbsp;
Would you like to create a community with it? &nbsp;
&nbsp;
Click on **Post Now** below!`;

export default null;