Fix modal bug

This commit is contained in:
SleeplessOne1917 2024-04-13 20:18:20 -04:00
parent fea5ff1297
commit fb38fafd16
3 changed files with 14 additions and 10 deletions

View file

@ -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>
</>
);

View file

@ -5,7 +5,7 @@ interface AdultConsentModalProps {
contentWarning: string;
show: boolean;
onContinue: LinkedEvent<any, Event> | null;
onBack: () => void;
onBack: LinkedEvent<any, Event> | null;
}
@modalMixin

View file

@ -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">