From: Dessalines Date: Mon, 15 May 2023 19:53:29 +0000 (-0400) Subject: Changing all bigints to numbers X-Git-Url: http://these/git/%7B%60%24%7BghostArchiveUrl%7D/static/%7Bpost_view.post.url%7D?a=commitdiff_plain;h=3143788d19472b470e441f4196e56918c116a6d7;p=lemmy-ui.git Changing all bigints to numbers --- 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 {