mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-12-22 19:01:26 +00:00
Add setting to site settings form
This commit is contained in:
parent
0413fd6c37
commit
fea5ff1297
4 changed files with 30 additions and 4 deletions
|
@ -49,6 +49,7 @@
|
|||
"prettier/prettier": "error",
|
||||
"quote-props": 0,
|
||||
"unicorn/filename-case": 0,
|
||||
"jsx-a11y/media-has-caption": 0
|
||||
"jsx-a11y/media-has-caption": 0,
|
||||
"jsx-a11y/label-has-associated-control": 0
|
||||
}
|
||||
}
|
||||
|
|
|
@ -292,5 +292,8 @@
|
|||
<line x1="16" y1="216" x2="240" y2="216" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/>
|
||||
<path d="M152,216V160a8,8,0,0,0-8-8H112a8,8,0,0,0-8,8v56" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/>
|
||||
</symbol>
|
||||
<symbol id="icon-info" fill="currentColor" viewBox="0 0 256 256">
|
||||
<path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z" />
|
||||
</symbol>
|
||||
</defs>
|
||||
</svg>
|
||||
|
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 69 KiB |
|
@ -5,9 +5,6 @@ import { tippyMixin } from "../mixins/tippy-mixin";
|
|||
import { Component, linkEvent } from "inferno";
|
||||
import { I18NextService } from "../../services/I18NextService";
|
||||
|
||||
// Need to disable this rule because ESLint flat out lies about labels not
|
||||
// having an associated control in this component
|
||||
/* eslint-disable jsx-a11y/label-has-associated-control */
|
||||
interface PostHiddenSelectProps {
|
||||
showHidden?: StringBoolean;
|
||||
onShowHiddenChange: (hidden?: StringBoolean) => void;
|
||||
|
|
|
@ -116,6 +116,8 @@ export class SiteForm extends Component<SiteFormProps, SiteFormState> {
|
|||
this.handleInstanceTextChange = this.handleInstanceTextChange.bind(this);
|
||||
|
||||
this.handleBlockedUrlsUpdate = this.handleBlockedUrlsUpdate.bind(this);
|
||||
this.handleSiteContentWarningChange =
|
||||
this.handleSiteContentWarningChange.bind(this);
|
||||
}
|
||||
|
||||
render() {
|
||||
|
@ -269,6 +271,25 @@ export class SiteForm extends Component<SiteFormProps, SiteFormState> {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{this.state.siteForm.enable_nsfw && (
|
||||
<div className="mb-3 row">
|
||||
<div className="alert small alert-info" role="alert">
|
||||
<Icon icon="info" classes="icon-inline me-2" />
|
||||
Setting a content warning will display a prompt with the content
|
||||
warning asking for their consent to continue.
|
||||
</div>
|
||||
<label className="col-12 col-form-label">Content Warning</label>
|
||||
<div className="col-12">
|
||||
<MarkdownTextArea
|
||||
initialContent={this.state.siteForm.content_warning}
|
||||
onContentChange={this.handleSiteContentWarningChange}
|
||||
hideNavigationWarnings
|
||||
allLanguages={[]}
|
||||
siteLanguages={[]}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<div className="mb-3 row">
|
||||
<div className="col-12">
|
||||
<label
|
||||
|
@ -1012,4 +1033,8 @@ export class SiteForm extends Component<SiteFormProps, SiteFormState> {
|
|||
},
|
||||
}));
|
||||
}
|
||||
|
||||
handleSiteContentWarningChange(val: string) {
|
||||
this.setState(s => ((s.siteForm.content_warning = val), s));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue