From a67a69f95e268a679a6c42722240628019355790 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 6 Mar 2020 14:57:52 -0500 Subject: [PATCH] Ask for confirmation on leaving pages with incomplete forms. Fixes #529 --- ui/src/components/comment-form.tsx | 5 + ui/src/components/community-form.tsx | 220 ++++++++++---------- ui/src/components/post-form.tsx | 10 + ui/src/components/private-message-form.tsx | 5 + ui/src/components/site-form.tsx | 228 +++++++++++---------- ui/translations/en.json | 3 +- 6 files changed, 260 insertions(+), 211 deletions(-) diff --git a/ui/src/components/comment-form.tsx b/ui/src/components/comment-form.tsx index aa8e651d..f3009d34 100644 --- a/ui/src/components/comment-form.tsx +++ b/ui/src/components/comment-form.tsx @@ -1,4 +1,5 @@ import { Component, linkEvent } from 'inferno'; +import { Prompt } from 'inferno-router'; import { CommentNode as CommentNodeI, CommentForm as CommentFormI, @@ -87,6 +88,10 @@ export class CommentForm extends Component { render() { return (
+
diff --git a/ui/src/components/community-form.tsx b/ui/src/components/community-form.tsx index aaa3e6c4..eedc2003 100644 --- a/ui/src/components/community-form.tsx +++ b/ui/src/components/community-form.tsx @@ -1,4 +1,5 @@ import { Component, linkEvent } from 'inferno'; +import { Prompt } from 'inferno-router'; import { Subscription } from 'rxjs'; import { retryWhen, delay, take } from 'rxjs/operators'; import { @@ -105,120 +106,131 @@ export class CommunityForm extends Component< render() { return ( - -
- -
- + <> + + +
+ +
+ +
-
-
- -
- -
-
-
- -
-