From 3143788d19472b470e441f4196e56918c116a6d7 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Mon, 15 May 2023 15:53:29 -0400 Subject: [PATCH] Changing all bigints to numbers --- package.json | 2 +- src/shared/components/app/navbar.tsx | 18 +++---- .../components/comment/comment-node.tsx | 40 +++++++-------- src/shared/components/common/paginator.tsx | 10 ++-- .../components/community/communities.tsx | 8 +-- src/shared/components/community/community.tsx | 14 ++---- src/shared/components/community/sidebar.tsx | 2 +- src/shared/components/home/emojis-form.tsx | 49 ++++++++----------- src/shared/components/home/home.tsx | 18 +++---- src/shared/components/home/site-sidebar.tsx | 2 +- src/shared/components/modlog.tsx | 10 ++-- src/shared/components/person/inbox.tsx | 24 ++++----- .../components/person/person-details.tsx | 10 ++-- src/shared/components/person/profile.tsx | 8 +-- .../person/registration-applications.tsx | 12 ++--- src/shared/components/person/reports.tsx | 24 ++++----- src/shared/components/post/post-form.tsx | 4 +- src/shared/components/post/post-listing.tsx | 40 +++++++-------- src/shared/components/post/post-report.tsx | 2 +- src/shared/components/post/post.tsx | 2 +- src/shared/components/search.tsx | 18 +++---- src/shared/services/UserService.ts | 12 ++--- src/shared/utils.ts | 32 ++++++------ yarn.lock | 8 +-- 24 files changed, 175 insertions(+), 194 deletions(-) diff --git a/package.json b/package.json index c9a19c2..2f16b8d 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "inferno-server": "^8.1.1", "isomorphic-cookie": "^1.2.4", "jwt-decode": "^3.1.2", - "lemmy-js-client": "0.17.2-rc.16", + "lemmy-js-client": "0.17.2-rc.17", "markdown-it": "^13.0.1", "markdown-it-container": "^3.0.0", "markdown-it-emoji": "^2.0.2", diff --git a/src/shared/components/app/navbar.tsx b/src/shared/components/app/navbar.tsx index 448e92c..128d402 100644 --- a/src/shared/components/app/navbar.tsx +++ b/src/shared/components/app/navbar.tsx @@ -40,9 +40,9 @@ interface NavbarProps { interface NavbarState { expanded: boolean; - unreadInboxCount: bigint; - unreadReportCount: bigint; - unreadApplicationCount: bigint; + unreadInboxCount: number; + unreadReportCount: number; + unreadApplicationCount: number; showDropdown: boolean; onSiteBanner?(url: string): any; } @@ -54,9 +54,9 @@ export class Navbar extends Component { private unreadReportCountSub: Subscription; private unreadApplicationCountSub: Subscription; state: NavbarState = { - unreadInboxCount: 0n, - unreadReportCount: 0n, - unreadApplicationCount: 0n, + unreadInboxCount: 0, + unreadReportCount: 0, + unreadApplicationCount: 0, expanded: false, showDropdown: false, }; @@ -512,7 +512,7 @@ export class Navbar extends Component { unreadReportCount: data.post_reports + data.comment_reports + - (data.private_message_reports ?? 0n), + (data.private_message_reports ?? 0), }); this.sendReportUnread(); } else if (op == UserOperation.GetUnreadRegistrationApplicationCount) { @@ -528,7 +528,7 @@ export class Navbar extends Component { data.recipient_ids.includes(mui.local_user_view.local_user.id) ) { this.setState({ - unreadInboxCount: this.state.unreadInboxCount + 1n, + unreadInboxCount: this.state.unreadInboxCount + 1, }); this.sendUnreadCount(); notifyComment(data.comment_view, this.context.router); @@ -541,7 +541,7 @@ export class Navbar extends Component { UserService.Instance.myUserInfo?.local_user_view.person.id ) { this.setState({ - unreadInboxCount: this.state.unreadInboxCount + 1n, + unreadInboxCount: this.state.unreadInboxCount + 1, }); this.sendUnreadCount(); notifyPrivateMessage(data.private_message_view, this.context.router); diff --git a/src/shared/components/comment/comment-node.tsx b/src/shared/components/comment/comment-node.tsx index d6fe086..d68c5b3 100644 --- a/src/shared/components/comment/comment-node.tsx +++ b/src/shared/components/comment/comment-node.tsx @@ -84,9 +84,9 @@ interface CommentNodeState { showReportDialog: boolean; reportReason?: string; my_vote?: number; - score: bigint; - upvotes: bigint; - downvotes: bigint; + score: number; + upvotes: number; + downvotes: number; readLoading: boolean; saveLoading: boolean; } @@ -833,9 +833,7 @@ export class CommentNode extends Component { > {i18n.t("x_more_replies", { count: node.comment_view.counts.child_count, - formattedCount: numToSI( - BigInt(node.comment_view.counts.child_count) - ), + formattedCount: numToSI(node.comment_view.counts.child_count), })}{" "} ➔ @@ -1152,19 +1150,19 @@ export class CommentNode extends Component { if (myVote == 1) { this.setState({ - score: this.state.score - 1n, - upvotes: this.state.upvotes - 1n, + score: this.state.score - 1, + upvotes: this.state.upvotes - 1, }); } else if (myVote == -1) { this.setState({ - downvotes: this.state.downvotes - 1n, - upvotes: this.state.upvotes + 1n, - score: this.state.score + 2n, + downvotes: this.state.downvotes - 1, + upvotes: this.state.upvotes + 1, + score: this.state.score + 2, }); } else { this.setState({ - score: this.state.score + 1n, - upvotes: this.state.upvotes + 1n, + score: this.state.score + 1, + upvotes: this.state.upvotes + 1, }); } @@ -1189,19 +1187,19 @@ export class CommentNode extends Component { if (myVote == 1) { this.setState({ - downvotes: this.state.downvotes + 1n, - upvotes: this.state.upvotes - 1n, - score: this.state.score - 2n, + downvotes: this.state.downvotes + 1, + upvotes: this.state.upvotes - 1, + score: this.state.score - 2, }); } else if (myVote == -1) { this.setState({ - downvotes: this.state.downvotes - 1n, - score: this.state.score + 1n, + downvotes: this.state.downvotes - 1, + score: this.state.score + 1, }); } else { this.setState({ - downvotes: this.state.downvotes + 1n, - score: this.state.score - 1n, + downvotes: this.state.downvotes + 1, + score: this.state.score - 1, }); } @@ -1542,7 +1540,7 @@ export class CommentNode extends Component { post_id: i.props.node.comment_view.post.id, parent_id: i.props.node.comment_view.comment.id, max_depth: commentTreeMaxDepth, - limit: 999n, // TODO + limit: 999, // TODO type_: "All", saved_only: false, auth: myAuth(false), diff --git a/src/shared/components/common/paginator.tsx b/src/shared/components/common/paginator.tsx index 2c87757..75acde3 100644 --- a/src/shared/components/common/paginator.tsx +++ b/src/shared/components/common/paginator.tsx @@ -2,8 +2,8 @@ import { Component, linkEvent } from "inferno"; import { i18n } from "../../i18next"; interface PaginatorProps { - page: bigint; - onChange(val: bigint): any; + page: number; + onChange(val: number): any; } export class Paginator extends Component { @@ -15,7 +15,7 @@ export class Paginator extends Component {