From 3b82f4887b7ed8737748ceed26f655e7771a275b 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 | 230 +++++++++++---------- ui/src/components/post-form.tsx | 10 + ui/src/components/private-message-form.tsx | 5 + ui/src/components/site-form.tsx | 230 +++++++++++---------- ui/translations/en.json | 3 +- 6 files changed, 266 insertions(+), 217 deletions(-) diff --git a/ui/src/components/comment-form.tsx b/ui/src/components/comment-form.tsx index aa8e651..f3009d3 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 aaa3e6c..eedc200 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 ( - -
- -
- -
-
- -
- -
- -
-
-
- -
-