From 70ff6381039eba97a63035392f87056a023ea36b Mon Sep 17 00:00:00 2001 From: Dessalines Date: Mon, 8 Apr 2019 14:46:09 -0700 Subject: Loading indicators. - Fixes #10 - Adding SVG symbols component --- ui/src/components/community.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'ui/src/components/community.tsx') diff --git a/ui/src/components/community.tsx b/ui/src/components/community.tsx index ed693c55..1ca9a8af 100644 --- a/ui/src/components/community.tsx +++ b/ui/src/components/community.tsx @@ -11,6 +11,7 @@ interface State { community: CommunityI; communityId: number; moderators: Array; + loading: boolean; } export class Community extends Component { @@ -31,7 +32,8 @@ export class Community extends Component { published: null }, moderators: [], - communityId: Number(this.props.match.params.id) + communityId: Number(this.props.match.params.id), + loading: true } constructor(props: any, context: any) { @@ -40,12 +42,12 @@ export class Community extends Component { this.state = this.emptyState; this.subscription = WebSocketService.Instance.subject - .pipe(retryWhen(errors => errors.pipe(delay(3000), take(10)))) - .subscribe( - (msg) => this.parseMessage(msg), + .pipe(retryWhen(errors => errors.pipe(delay(3000), take(10)))) + .subscribe( + (msg) => this.parseMessage(msg), (err) => console.error(err), () => console.log('complete') - ); + ); WebSocketService.Instance.getCommunity(this.state.communityId); } @@ -57,6 +59,8 @@ export class Community extends Component { render() { return (
+ {this.state.loading ? +

:

/f/{this.state.community.name}

@@ -66,6 +70,7 @@ export class Community extends Component {
+ }
) } @@ -81,6 +86,7 @@ export class Community extends Component { let res: GetCommunityResponse = msg; this.state.community = res.community; this.state.moderators = res.moderators; + this.state.loading = false; this.setState(this.state); } else if (op == UserOperation.EditCommunity) { let res: CommunityResponse = msg; -- cgit v1.2.3