Add Taglines support (#854)

* Add Taglines support

* Fix issue with deletion not rendering properly.

* Address PR comments

* Missed alllanguages

* Cleanup tagline match

* Update js client

* Move taglines to siteres

* Only show taglines editor after site setup

* Update js client
This commit is contained in:
Anon 2022-11-20 10:08:44 -06:00 committed by GitHub
parent 36c1c1f262
commit e2a29a5bad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 107 additions and 5 deletions

View file

@ -50,9 +50,11 @@ import {
getDataTypeFromProps,
getListingTypeFromProps,
getPageFromProps,
getRandomFromList,
getSortTypeFromProps,
isBrowser,
isPostBlocked,
mdToHtml,
notifyPost,
nsfwCheck,
postToCommentSortType,
@ -94,6 +96,7 @@ interface HomeState {
showSidebarMobile: boolean;
subscribedCollapsed: boolean;
loading: boolean;
tagline: Option<string>;
}
interface HomeProps {
@ -137,6 +140,7 @@ export class Home extends Component<any, HomeState> {
dataType: getDataTypeFromProps(this.props),
sort: getSortTypeFromProps(this.props),
page: getPageFromProps(this.props),
tagline: None
};
constructor(props: any, context: any) {
@ -170,10 +174,12 @@ export class Home extends Component<any, HomeState> {
wsClient.communityJoin({ community_id: 0 })
);
}
const taglines = this.state.siteRes.taglines;
this.state = {
...this.state,
trendingCommunities: trendingRes.communities,
loading: false,
tagline: taglines.map(tls => getRandomFromList(tls).content)
};
} else {
this.fetchTrendingCommunities();
@ -329,6 +335,10 @@ export class Home extends Component<any, HomeState> {
{this.state.siteRes.site_view.local_site.site_setup && (
<div className="row">
<main role="main" className="col-12 col-md-8">
{this.state.tagline.match({
some: tagline => <div id="tagline" dangerouslySetInnerHTML={mdToHtml(tagline)}></div>,
none: <></>,
})}
<div className="d-block d-md-none">{this.mobileView()}</div>
{this.posts()}
</main>