From 2d8be72b33bf058048f8e1054a8b822a6373ca4b Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sat, 17 Jul 2021 16:21:31 -0400 Subject: [PATCH] Fixing too many large spinners (#337) --- src/assets/css/main.css | 2 +- src/shared/components/admin-settings.tsx | 11 ++++-- src/shared/components/communities.tsx | 2 +- src/shared/components/community.tsx | 6 +-- src/shared/components/create-community.tsx | 2 +- src/shared/components/create-post.tsx | 2 +- .../components/create-private-message.tsx | 7 ++-- src/shared/components/icon.tsx | 13 ++++++- src/shared/components/inbox.tsx | 2 +- src/shared/components/main.tsx | 2 +- src/shared/components/modlog.tsx | 2 +- src/shared/components/person.tsx | 39 +++++++++---------- src/shared/components/post.tsx | 2 +- 13 files changed, 51 insertions(+), 41 deletions(-) diff --git a/src/assets/css/main.css b/src/assets/css/main.css index 45b34ce..80eb20b 100644 --- a/src/assets/css/main.css +++ b/src/assets/css/main.css @@ -132,7 +132,7 @@ margin-bottom: 2px; } -.icon-spinner { +.spinner-large { width: 4em; height: 4em; } diff --git a/src/shared/components/admin-settings.tsx b/src/shared/components/admin-settings.tsx index 19856f3..d9aa74b 100644 --- a/src/shared/components/admin-settings.tsx +++ b/src/shared/components/admin-settings.tsx @@ -65,7 +65,8 @@ export class AdminSettings extends Component { // Only fetch the data if coming from another route if (this.isoData.path == this.context.router.route.match.url) { this.state.siteConfigRes = this.isoData.routeData[0]; - this.state.siteConfigForm.config_hjson = this.state.siteConfigRes.config_hjson; + this.state.siteConfigForm.config_hjson = + this.state.siteConfigRes.config_hjson; this.state.siteConfigLoading = false; this.state.loading = false; } else { @@ -110,7 +111,7 @@ export class AdminSettings extends Component { /> {this.state.loading ? (
- +
) : (
@@ -228,14 +229,16 @@ export class AdminSettings extends Component { let data = wsJsonToRes(msg).data; this.state.siteConfigRes = data; this.state.loading = false; - this.state.siteConfigForm.config_hjson = this.state.siteConfigRes.config_hjson; + this.state.siteConfigForm.config_hjson = + this.state.siteConfigRes.config_hjson; this.setState(this.state); var textarea: any = document.getElementById(this.siteConfigTextAreaId); autosize(textarea); } else if (op == UserOperation.SaveSiteConfig) { let data = wsJsonToRes(msg).data; this.state.siteConfigRes = data; - this.state.siteConfigForm.config_hjson = this.state.siteConfigRes.config_hjson; + this.state.siteConfigForm.config_hjson = + this.state.siteConfigRes.config_hjson; this.state.siteConfigLoading = false; toast(i18n.t("site_saved")); this.setState(this.state); diff --git a/src/shared/components/communities.tsx b/src/shared/components/communities.tsx index 1004da5..875ceea 100644 --- a/src/shared/components/communities.tsx +++ b/src/shared/components/communities.tsx @@ -105,7 +105,7 @@ export class Communities extends Component { /> {this.state.loading ? (
- +
) : (
diff --git a/src/shared/components/community.tsx b/src/shared/components/community.tsx index 8852b67..4a82da6 100644 --- a/src/shared/components/community.tsx +++ b/src/shared/components/community.tsx @@ -243,7 +243,7 @@ export class Community extends Component {
{this.state.communityLoading ? (
- +
) : (
@@ -282,7 +282,7 @@ export class Community extends Component { return this.state.dataType == DataType.Post ? ( this.state.postsLoading ? (
- +
) : ( { ) ) : this.state.commentsLoading ? (
- +
) : ( { /> {this.state.loading ? (
- +
) : (
diff --git a/src/shared/components/create-post.tsx b/src/shared/components/create-post.tsx index 72d8170..756dd9b 100644 --- a/src/shared/components/create-post.tsx +++ b/src/shared/components/create-post.tsx @@ -111,7 +111,7 @@ export class CreatePost extends Component { /> {this.state.loading ? (
- +
) : (
diff --git a/src/shared/components/create-private-message.tsx b/src/shared/components/create-private-message.tsx index aceba6b..0796d3e 100644 --- a/src/shared/components/create-private-message.tsx +++ b/src/shared/components/create-private-message.tsx @@ -48,9 +48,8 @@ export class CreatePrivateMessage extends Component< constructor(props: any, context: any) { super(props, context); this.state = this.emptyState; - this.handlePrivateMessageCreate = this.handlePrivateMessageCreate.bind( - this - ); + this.handlePrivateMessageCreate = + this.handlePrivateMessageCreate.bind(this); this.parseMessage = this.parseMessage.bind(this); this.subscription = wsSubscribe(this.parseMessage); @@ -111,7 +110,7 @@ export class CreatePrivateMessage extends Component< /> {this.state.loading ? (
- +
) : (
diff --git a/src/shared/components/icon.tsx b/src/shared/components/icon.tsx index 5c61d9d..3d103c7 100644 --- a/src/shared/components/icon.tsx +++ b/src/shared/components/icon.tsx @@ -22,12 +22,21 @@ export class Icon extends Component { } } -export class Spinner extends Component { +interface SpinnerProps { + large?: boolean; +} + +export class Spinner extends Component { constructor(props: any, context: any) { super(props, context); } render() { - return ; + return ( + + ); } } diff --git a/src/shared/components/inbox.tsx b/src/shared/components/inbox.tsx index 86d7487..674c664 100644 --- a/src/shared/components/inbox.tsx +++ b/src/shared/components/inbox.tsx @@ -140,7 +140,7 @@ export class Inbox extends Component {
{this.state.loading ? (
- +
) : (
diff --git a/src/shared/components/main.tsx b/src/shared/components/main.tsx index 99c52fe..0e781ef 100644 --- a/src/shared/components/main.tsx +++ b/src/shared/components/main.tsx @@ -550,7 +550,7 @@ export class Main extends Component {
{this.state.loading ? (
- +
) : (
diff --git a/src/shared/components/modlog.tsx b/src/shared/components/modlog.tsx index 65c31ee..47fda24 100644 --- a/src/shared/components/modlog.tsx +++ b/src/shared/components/modlog.tsx @@ -407,7 +407,7 @@ export class Modlog extends Component { /> {this.state.loading ? (
- +
) : (
diff --git a/src/shared/components/person.tsx b/src/shared/components/person.tsx index 5ded454..8c04632 100644 --- a/src/shared/components/person.tsx +++ b/src/shared/components/person.tsx @@ -133,16 +133,13 @@ export class Person extends Component { this.state = this.emptyState; this.handleSortChange = this.handleSortChange.bind(this); - this.handleUserSettingsSortTypeChange = this.handleUserSettingsSortTypeChange.bind( - this - ); - this.handleUserSettingsListingTypeChange = this.handleUserSettingsListingTypeChange.bind( - this - ); + this.handleUserSettingsSortTypeChange = + this.handleUserSettingsSortTypeChange.bind(this); + this.handleUserSettingsListingTypeChange = + this.handleUserSettingsListingTypeChange.bind(this); this.handlePageChange = this.handlePageChange.bind(this); - this.handleUserSettingsBioChange = this.handleUserSettingsBioChange.bind( - this - ); + this.handleUserSettingsBioChange = + this.handleUserSettingsBioChange.bind(this); this.handleAvatarUpload = this.handleAvatarUpload.bind(this); this.handleAvatarRemove = this.handleAvatarRemove.bind(this); @@ -276,7 +273,7 @@ export class Person extends Component {
{this.state.loading ? (
- +
) : (
@@ -1052,16 +1049,14 @@ export class Person extends Component { } handleUserSettingsSortTypeChange(val: SortType) { - this.state.saveUserSettingsForm.default_sort_type = Object.keys( - SortType - ).indexOf(val); + this.state.saveUserSettingsForm.default_sort_type = + Object.keys(SortType).indexOf(val); this.setState(this.state); } handleUserSettingsListingTypeChange(val: ListingType) { - this.state.saveUserSettingsForm.default_listing_type = Object.keys( - ListingType - ).indexOf(val); + this.state.saveUserSettingsForm.default_listing_type = + Object.keys(ListingType).indexOf(val); this.setState(this.state); } @@ -1252,10 +1247,14 @@ export class Person extends Component { } else if (op == UserOperation.SaveUserSettings) { let data = wsJsonToRes(msg).data; UserService.Instance.login(data); - this.state.personRes.person_view.person.bio = this.state.saveUserSettingsForm.bio; - this.state.personRes.person_view.person.display_name = this.state.saveUserSettingsForm.display_name; - this.state.personRes.person_view.person.banner = this.state.saveUserSettingsForm.banner; - this.state.personRes.person_view.person.avatar = this.state.saveUserSettingsForm.avatar; + this.state.personRes.person_view.person.bio = + this.state.saveUserSettingsForm.bio; + this.state.personRes.person_view.person.display_name = + this.state.saveUserSettingsForm.display_name; + this.state.personRes.person_view.person.banner = + this.state.saveUserSettingsForm.banner; + this.state.personRes.person_view.person.avatar = + this.state.saveUserSettingsForm.avatar; this.state.saveUserSettingsLoading = false; this.setState(this.state); diff --git a/src/shared/components/post.tsx b/src/shared/components/post.tsx index f66b94e..b8aa0c3 100644 --- a/src/shared/components/post.tsx +++ b/src/shared/components/post.tsx @@ -252,7 +252,7 @@ export class Post extends Component {
{this.state.loading ? (
- +
) : (
-- 2.44.1