mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-12-23 03:11:25 +00:00
Fix modal bug
This commit is contained in:
parent
fea5ff1297
commit
fb38fafd16
3 changed files with 14 additions and 10 deletions
|
@ -26,6 +26,10 @@ function handleAdultConsent(i: App) {
|
|||
i.setState({ showAdultConsentModal: false });
|
||||
}
|
||||
|
||||
function handleAdultConsentGoBack(i: App) {
|
||||
i.context.router.history.back();
|
||||
}
|
||||
|
||||
export class App extends Component<any, AppState> {
|
||||
private isoData: IsoDataOptionalSite = setIsoData(this.context);
|
||||
private readonly mainContentRef: RefObject<HTMLElement>;
|
||||
|
@ -81,6 +85,14 @@ export class App extends Component<any, AppState> {
|
|||
<Theme defaultTheme={siteView.local_site.default_theme} />
|
||||
)}
|
||||
<Navbar siteRes={siteRes} />
|
||||
{siteRes?.site_view.site.content_warning && (
|
||||
<AdultConsentModal
|
||||
contentWarning={siteRes.site_view.site.content_warning}
|
||||
show={this.state.showAdultConsentModal}
|
||||
onBack={linkEvent(this, handleAdultConsentGoBack)}
|
||||
onContinue={linkEvent(this, handleAdultConsent)}
|
||||
/>
|
||||
)}
|
||||
<div className="mt-4 p-0 fl-1">
|
||||
<Switch>
|
||||
{routes.map(
|
||||
|
@ -140,14 +152,6 @@ export class App extends Component<any, AppState> {
|
|||
</div>
|
||||
<Footer site={siteRes} />
|
||||
</div>
|
||||
{siteRes?.site_view.site.content_warning && (
|
||||
<AdultConsentModal
|
||||
contentWarning={siteRes.site_view.site.content_warning}
|
||||
show={this.state.showAdultConsentModal}
|
||||
onBack={history.back}
|
||||
onContinue={linkEvent(this, handleAdultConsent)}
|
||||
/>
|
||||
)}
|
||||
</Provider>
|
||||
</>
|
||||
);
|
||||
|
|
|
@ -5,7 +5,7 @@ interface AdultConsentModalProps {
|
|||
contentWarning: string;
|
||||
show: boolean;
|
||||
onContinue: LinkedEvent<any, Event> | null;
|
||||
onBack: () => void;
|
||||
onBack: LinkedEvent<any, Event> | null;
|
||||
}
|
||||
|
||||
@modalMixin
|
||||
|
|
|
@ -276,7 +276,7 @@ export class SiteForm extends Component<SiteFormProps, SiteFormState> {
|
|||
<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.
|
||||
warning asking the user for their consent to continue.
|
||||
</div>
|
||||
<label className="col-12 col-form-label">Content Warning</label>
|
||||
<div className="col-12">
|
||||
|
|
Loading…
Reference in a new issue