Skip to content

Commit

Permalink
Merge pull request #291 from surpassinggoogle/feature/ulog-subtags
Browse files Browse the repository at this point in the history
add generic ulog caption to right side bar for empty ulog subtags
  • Loading branch information
eastmaels committed May 14, 2019
2 parents 0183330 + 13f4957 commit 2bb78cb
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 8 deletions.
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;

0 comments on commit 2bb78cb

Please sign in to comment.