Upgrade inferno v8.0.0 try2 (#790)

* Upgrade non-breaking deps.

* Upgrade to Inferno v8. Fixes #731

* Upgrading inferno-i18next-dess
This commit is contained in:
Dessalines 2022-09-22 11:03:35 -04:00 committed by GitHub
parent cc90ded31e
commit 6320357d21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
56 changed files with 2960 additions and 2641 deletions

View file

@ -157,22 +157,24 @@ export class Home extends Component<any, HomeState> {
let commentsRes = Some(this.isoData.routeData[1] as GetCommentsResponse);
let trendingRes = this.isoData.routeData[2] as ListCommunitiesResponse;
postsRes.match({
some: pvs => (this.state.posts = pvs.posts),
none: void 0,
});
commentsRes.match({
some: cvs => (this.state.comments = cvs.comments),
none: void 0,
});
this.state.trendingCommunities = trendingRes.communities;
if (postsRes.isSome()) {
this.state = { ...this.state, posts: postsRes.unwrap().posts };
}
if (commentsRes.isSome()) {
this.state = { ...this.state, comments: commentsRes.unwrap().comments };
}
if (isBrowser()) {
WebSocketService.Instance.send(
wsClient.communityJoin({ community_id: 0 })
);
}
this.state.loading = false;
this.state = {
...this.state,
trendingCommunities: trendingRes.communities,
loading: false,
};
} else {
this.fetchTrendingCommunities();
this.fetchData();
@ -317,7 +319,7 @@ export class Home extends Component<any, HomeState> {
render() {
return (
<div class="container">
<div className="container">
<HtmlTags
title={this.documentTitle}
path={this.context.router.route.match.url}
@ -325,12 +327,14 @@ export class Home extends Component<any, HomeState> {
image={None}
/>
{this.state.siteRes.site_view.isSome() && (
<div class="row">
<main role="main" class="col-12 col-md-8">
<div class="d-block d-md-none">{this.mobileView()}</div>
<div className="row">
<main role="main" className="col-12 col-md-8">
<div className="d-block d-md-none">{this.mobileView()}</div>
{this.posts()}
</main>
<aside class="d-none d-md-block col-md-4">{this.mySidebar()}</aside>
<aside className="d-none d-md-block col-md-4">
{this.mySidebar()}
</aside>
</div>
)}
</div>
@ -347,11 +351,11 @@ export class Home extends Component<any, HomeState> {
mobileView() {
let siteRes = this.state.siteRes;
return (
<div class="row">
<div class="col-12">
<div className="row">
<div className="col-12">
{this.hasFollows && (
<button
class="btn btn-secondary d-inline-block mb-2 mr-3"
className="btn btn-secondary d-inline-block mb-2 mr-3"
onClick={linkEvent(this, this.handleShowSubscribedMobile)}
>
{i18n.t("subscribed")}{" "}
@ -366,7 +370,7 @@ export class Home extends Component<any, HomeState> {
</button>
)}
<button
class="btn btn-secondary d-inline-block mb-2 mr-3"
className="btn btn-secondary d-inline-block mb-2 mr-3"
onClick={linkEvent(this, this.handleShowTrendingMobile)}
>
{i18n.t("trending")}{" "}
@ -378,7 +382,7 @@ export class Home extends Component<any, HomeState> {
/>
</button>
<button
class="btn btn-secondary d-inline-block mb-2 mr-3"
className="btn btn-secondary d-inline-block mb-2 mr-3"
onClick={linkEvent(this, this.handleShowSidebarMobile)}
>
{i18n.t("sidebar")}{" "}
@ -403,13 +407,13 @@ export class Home extends Component<any, HomeState> {
none: <></>,
})}
{this.state.showTrendingMobile && (
<div class="col-12 card border-secondary mb-3">
<div class="card-body">{this.trendingCommunities()}</div>
<div className="col-12 card border-secondary mb-3">
<div className="card-body">{this.trendingCommunities()}</div>
</div>
)}
{this.state.showSubscribedMobile && (
<div class="col-12 card border-secondary mb-3">
<div class="card-body">{this.subscribedCommunities()}</div>
<div className="col-12 card border-secondary mb-3">
<div className="card-body">{this.subscribedCommunities()}</div>
</div>
)}
</div>
@ -423,8 +427,8 @@ export class Home extends Component<any, HomeState> {
<div>
{!this.state.loading && (
<div>
<div class="card border-secondary mb-3">
<div class="card-body">
<div className="card border-secondary mb-3">
<div className="card-body">
{this.trendingCommunities()}
{this.createCommunityButton()}
{this.exploreCommunitiesButton()}
@ -443,8 +447,8 @@ export class Home extends Component<any, HomeState> {
none: <></>,
})}
{this.hasFollows && (
<div class="card border-secondary mb-3">
<div class="card-body">{this.subscribedCommunities()}</div>
<div className="card border-secondary mb-3">
<div className="card-body">{this.subscribedCommunities()}</div>
</div>
)}
</div>
@ -480,9 +484,12 @@ export class Home extends Component<any, HomeState> {
</Link>
</T>
</h5>
<ul class="list-inline mb-0">
<ul className="list-inline mb-0">
{this.state.trendingCommunities.map(cv => (
<li class="list-inline-item d-inline-block">
<li
key={cv.community.id}
className="list-inline-item d-inline-block"
>
<CommunityLink community={cv.community} />
</li>
))}
@ -502,7 +509,7 @@ export class Home extends Component<any, HomeState> {
</Link>
</T>
<button
class="btn btn-sm text-muted"
className="btn btn-sm text-muted"
onClick={linkEvent(this, this.handleCollapseSubscribe)}
aria-label={i18n.t("collapse")}
data-tippy-content={i18n.t("collapse")}
@ -515,12 +522,15 @@ export class Home extends Component<any, HomeState> {
</button>
</h5>
{!this.state.subscribedCollapsed && (
<ul class="list-inline mb-0">
<ul className="list-inline mb-0">
{UserService.Instance.myUserInfo
.map(m => m.follows)
.unwrapOr([])
.map(cfv => (
<li class="list-inline-item d-inline-block">
<li
key={cfv.community.id}
className="list-inline-item d-inline-block"
>
<CommunityLink community={cfv.community} />
</li>
))}
@ -542,7 +552,7 @@ export class Home extends Component<any, HomeState> {
posts() {
return (
<div class="main-content-wrapper">
<div className="main-content-wrapper">
{this.state.loading ? (
<h5>
<Spinner large />
@ -594,13 +604,13 @@ export class Home extends Component<any, HomeState> {
return (
<div className="mb-3">
<span class="mr-3">
<span className="mr-3">
<DataTypeSelect
type_={this.state.dataType}
onChange={this.handleDataTypeChange}
/>
</span>
<span class="mr-3">
<span className="mr-3">
<ListingTypeSelect
type_={this.state.listingType}
showLocal={showLocal(this.isoData)}
@ -608,7 +618,7 @@ export class Home extends Component<any, HomeState> {
onChange={this.handleListingTypeChange}
/>
</span>
<span class="mr-2">
<span className="mr-2">
<SortSelect sort={this.state.sort} onChange={this.handleSortChange} />
</span>
{this.state.listingType == ListingType.All && (
@ -644,23 +654,19 @@ export class Home extends Component<any, HomeState> {
}
handleShowSubscribedMobile(i: Home) {
i.state.showSubscribedMobile = !i.state.showSubscribedMobile;
i.setState(i.state);
i.setState({ showSubscribedMobile: !i.state.showSubscribedMobile });
}
handleShowTrendingMobile(i: Home) {
i.state.showTrendingMobile = !i.state.showTrendingMobile;
i.setState(i.state);
i.setState({ showTrendingMobile: !i.state.showTrendingMobile });
}
handleShowSidebarMobile(i: Home) {
i.state.showSidebarMobile = !i.state.showSidebarMobile;
i.setState(i.state);
i.setState({ showSidebarMobile: !i.state.showSidebarMobile });
}
handleCollapseSubscribe(i: Home) {
i.state.subscribedCollapsed = !i.state.subscribedCollapsed;
i.setState(i.state);
i.setState({ subscribedCollapsed: !i.state.subscribedCollapsed });
}
handlePageChange(page: number) {
@ -731,18 +737,14 @@ export class Home extends Component<any, HomeState> {
msg,
ListCommunitiesResponse
);
this.state.trendingCommunities = data.communities;
this.setState(this.state);
this.setState({ trendingCommunities: data.communities });
} else if (op == UserOperation.EditSite) {
let data = wsJsonToRes<SiteResponse>(msg, SiteResponse);
this.state.siteRes.site_view = Some(data.site_view);
this.setState(this.state);
this.setState(s => ((s.siteRes.site_view = Some(data.site_view)), s));
toast(i18n.t("site_saved"));
} else if (op == UserOperation.GetPosts) {
let data = wsJsonToRes<GetPostsResponse>(msg, GetPostsResponse);
this.state.posts = data.posts;
this.state.loading = false;
this.setState(this.state);
this.setState({ posts: data.posts, loading: false });
WebSocketService.Instance.send(
wsClient.communityJoin({ community_id: 0 })
);
@ -812,8 +814,7 @@ export class Home extends Component<any, HomeState> {
this.setState(this.state);
} else if (op == UserOperation.AddAdmin) {
let data = wsJsonToRes<AddAdminResponse>(msg, AddAdminResponse);
this.state.siteRes.admins = data.admins;
this.setState(this.state);
this.setState(s => ((s.siteRes.admins = data.admins), s));
} else if (op == UserOperation.BanPerson) {
let data = wsJsonToRes<BanPersonResponse>(msg, BanPersonResponse);
this.state.posts
@ -823,9 +824,7 @@ export class Home extends Component<any, HomeState> {
this.setState(this.state);
} else if (op == UserOperation.GetComments) {
let data = wsJsonToRes<GetCommentsResponse>(msg, GetCommentsResponse);
this.state.comments = data.comments;
this.state.loading = false;
this.setState(this.state);
this.setState({ comments: data.comments, loading: false });
} else if (
op == UserOperation.EditComment ||
op == UserOperation.DeleteComment ||