From ca9e93fe4778ad822f71efa8b59e574a7bdcd4ba Mon Sep 17 00:00:00 2001 From: Ian Philips Date: Wed, 18 May 2022 10:08:31 -0600 Subject: [PATCH] Show loading indicator on comment submit --- web/components/feed/feed-comments.tsx | 9 ++++++--- web/components/loading-indicator.tsx | 12 +++++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/web/components/feed/feed-comments.tsx b/web/components/feed/feed-comments.tsx index 6b8c7e21..f27bf999 100644 --- a/web/components/feed/feed-comments.tsx +++ b/web/components/feed/feed-comments.tsx @@ -23,6 +23,7 @@ import { SiteLink } from 'web/components/site-link' import { BetStatusText } from 'web/components/feed/feed-bets' import { Col } from 'web/components/layout/col' import { getOutcomeProbability } from 'common/calculate' +import { LoadingIndicator } from 'web/components/loading-indicator' export function FeedCommentThread(props: { contract: Contract @@ -372,14 +373,13 @@ export function CommentInput(props: { Sign in to Comment )} - {user && ( + {user && !isSubmitting && ( )} + {isSubmitting && ( + + )} diff --git a/web/components/loading-indicator.tsx b/web/components/loading-indicator.tsx index ba0c129b..a29e906f 100644 --- a/web/components/loading-indicator.tsx +++ b/web/components/loading-indicator.tsx @@ -1,12 +1,18 @@ import clsx from 'clsx' -export function LoadingIndicator(props: { className?: string }) { - const { className } = props +export function LoadingIndicator(props: { + className?: string + spinnerClassName?: string +}) { + const { className, spinnerClassName } = props return (