From: Dessalines Date: Fri, 23 Apr 2021 22:26:36 +0000 (-0400) Subject: Adding site desc. Fixes #266 X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/%22%7B%7D/%22https:/nerdica.net/README.md?a=commitdiff_plain;h=d43f22ede55553bdf99efadd3842a28d00e22f60;p=lemmy-ui.git Adding site desc. Fixes #266 --- diff --git a/lemmy-translations b/lemmy-translations index 764d35d..12e8d61 160000 --- a/lemmy-translations +++ b/lemmy-translations @@ -1 +1 @@ -Subproject commit 764d35d913453d1fd8eeec6007f0d94f59c8b0ee +Subproject commit 12e8d61e9ba2620b0031e237d87367480452b6fb diff --git a/package.json b/package.json index 1685494..7cc904d 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "eslint-plugin-prettier": "^3.3.1", "husky": "^6.0.0", "iso-639-1": "^2.1.9", - "lemmy-js-client": "0.11.0-rc.9", + "lemmy-js-client": "0.11.0-rc.10", "lint-staged": "^10.5.4", "mini-css-extract-plugin": "^1.4.1", "node-fetch": "^2.6.1", diff --git a/src/shared/components/main.tsx b/src/shared/components/main.tsx index 5374be5..8fafeb1 100644 --- a/src/shared/components/main.tsx +++ b/src/shared/components/main.tsx @@ -398,10 +398,11 @@ export class Main extends Component { } siteInfo() { + let site = this.state.siteRes.site_view.site; return (
- {this.state.siteRes.site_view.site.description && - this.siteDescription()} + {site.description &&
{site.description}
} + {site.sidebar && this.siteSidebar()} {this.badges()} {this.admins()}
@@ -527,12 +528,12 @@ export class Main extends Component { ); } - siteDescription() { + siteSidebar() { return (
); diff --git a/src/shared/components/site-form.tsx b/src/shared/components/site-form.tsx index 1e7f0cd..f68d793 100644 --- a/src/shared/components/site-form.tsx +++ b/src/shared/components/site-form.tsx @@ -42,9 +42,7 @@ export class SiteForm extends Component { super(props, context); this.state = this.emptyState; - this.handleSiteDescriptionChange = this.handleSiteDescriptionChange.bind( - this - ); + this.handleSiteSidebarChange = this.handleSiteSidebarChange.bind(this); this.handleIconUpload = this.handleIconUpload.bind(this); this.handleIconRemove = this.handleIconRemove.bind(this); @@ -55,6 +53,7 @@ export class SiteForm extends Component { if (this.props.site) { this.state.siteForm = { name: this.props.site.name, + sidebar: this.props.site.sidebar, description: this.props.site.description, enable_downvotes: this.props.site.enable_downvotes, open_registration: this.props.site.open_registration, @@ -76,7 +75,9 @@ export class SiteForm extends Component { if ( !this.state.loading && !this.props.site && - (this.state.siteForm.name || this.state.siteForm.description) + (this.state.siteForm.name || + this.state.siteForm.sidebar || + this.state.siteForm.description) ) { window.onbeforeunload = () => true; } else { @@ -95,7 +96,9 @@ export class SiteForm extends Component { when={ !this.state.loading && !this.props.site && - (this.state.siteForm.name || this.state.siteForm.description) + (this.state.siteForm.name || + this.state.siteForm.sidebar || + this.state.siteForm.description) } message={i18n.t("block_leaving")} /> @@ -141,14 +144,29 @@ export class SiteForm extends Component { onRemove={this.handleBannerRemove} />
+
+ +
+ +
+
@@ -264,11 +282,16 @@ export class SiteForm extends Component { i.setState(i.state); } - handleSiteDescriptionChange(val: string) { - this.state.siteForm.description = val; + handleSiteSidebarChange(val: string) { + this.state.siteForm.sidebar = val; this.setState(this.state); } + handleSiteDescChange(i: SiteForm, event: any) { + i.state.siteForm.description = event.target.value; + i.setState(i.state); + } + handleSiteEnableNsfwChange(i: SiteForm, event: any) { i.state.siteForm.enable_nsfw = event.target.checked; i.setState(i.state); diff --git a/yarn.lock b/yarn.lock index 35d861a..712c0a6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5125,10 +5125,10 @@ lcid@^1.0.0: dependencies: invert-kv "^1.0.0" -lemmy-js-client@0.11.0-rc.9: - version "0.11.0-rc.9" - resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.11.0-rc.9.tgz#f8b1e3924388c6e7f719f052ba1568f4d210cabc" - integrity sha512-697hLvHPr5+ZkJkFTaXl3y7Dt1va2Dghx9uvu/kZyZQZGVk2lL10R50SDaWsThyQKFBT4kiS1JZI+R3szzZEZQ== +lemmy-js-client@0.11.0-rc.10: + version "0.11.0-rc.10" + resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.11.0-rc.10.tgz#304b5b941a00fe251fb50c81e5ae795e8bf0bd8d" + integrity sha512-bVLMnE1xm7mmmUC9gLIQ7wFNZn8HD3nmE56EhNGgqR76zdjZSSk+8ZqBYHUJ2yOikGebzIm0heMFryIsJuqwTg== levn@^0.4.1: version "0.4.1"