Skip to content

Commit

Permalink
Merge pull request #24 from ful1e5/dev
Browse files Browse the repository at this point in the history
fix: unhandled exception on Download count
  • Loading branch information
ful1e5 committed Jan 21, 2024
2 parents f5d1a46 + 17e44ff commit 93dcd63
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Reusable `Marquee` Component

### Fixes

- Fixes breakage on `PRO` account link downloads

## [v1.0.1] - 12 January 2024

### What's New?
Expand Down
6 changes: 3 additions & 3 deletions src/components/DownloadButton/counts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ type Props = {
show: boolean;
};

const numberWithCommas = (x: number) => {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
const numberWithCommas = (x: number | null) => {
return x?.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
};

export const DownloadCount: React.FC<Props> = (props) => {
Expand Down Expand Up @@ -68,7 +68,7 @@ export const DownloadCount: React.FC<Props> = (props) => {
noDownloads ? 'text-red-100/[.8]' : 'text-green-100/[.8]'
} font-extrabold text-center text-sm p-1`}>
{`${numberWithCommas(data.count)}`}/
{pro ? <> &#8734;</> : numberWithCommas(data.total!)}
{pro ? <> &#8734;</> : numberWithCommas(data.total) || 0}
</p>
{!pro && (
<Tooltip
Expand Down

0 comments on commit 93dcd63

Please sign in to comment.