Skip to content

Commit 3f0219f

Browse files
refactor: rename function from shorternNumber to shortenNumber
1 parent 84a3d94 commit 3f0219f

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

src/components/badges/RewardBadge.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Coin from "@/components/ui/Coin";
2-
import { shorternNumber } from "@/utilities";
2+
import { shortenNumber } from "@/utilities";
33
import classNames from "classnames";
44
import { ReactElement } from "react";
55

@@ -47,7 +47,7 @@ export default function RewardBadge({ reward = {}, type = "transparent", display
4747
{token && <Coin token={token} size="small" />}
4848
{amount && (
4949
<div className="font-medium pl-0 pr-2">
50-
{displayAmount && shorternNumber(amount)}
50+
{displayAmount && shortenNumber(amount)}
5151
{token}
5252
</div>
5353
)}

src/components/cards/challenge/Challenge.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import RelatedContent from "./RelatedContent";
88
import Badges from "./Badges";
99
import { useMemo } from "react";
1010
import { useTranslation } from "next-i18next";
11-
import { shorternNumber } from "@/utilities";
11+
import { shortenNumber } from "@/utilities";
1212

1313
/**
1414
* `ChallengeCard` is a function component that renders a card
@@ -60,7 +60,7 @@ export default function ChallengeCard({ data, community, isCourseEnd }: Challeng
6060
<div className="md:pl-2 max-w-max">
6161
<div className="flex text-sm text-gray-700">
6262
<span className="block font-medium">
63-
{shorternNumber(totalReward)} {reward?.token} {` ${data?.isHackathon ? `Prize pool` : ""} rewards`}
63+
{shortenNumber(totalReward)} {reward?.token} {` ${data?.isHackathon ? `Prize pool` : ""} rewards`}
6464
</span>
6565
</div>
6666
<div className="text-gray-400 text-xs font-normal">{data?.isHackathon ? "Top projects win money prizes" : "For submission and feedback"}</div>

src/components/cards/challenge/Overview.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useTranslation } from "next-i18next";
44
import DateManager from "@/utilities/DateManager";
55
import Certificate from "@/components/ui/Certificate";
66
import { Community } from "@/types/community";
7-
import { shorternNumber } from "@/utilities";
7+
import { shortenNumber } from "@/utilities";
88

99
interface Props {
1010
challenge: Challenge;
@@ -54,15 +54,15 @@ export default function Overview({ challenge, community }: Props) {
5454
<Coin size="medium" token={reward?.token} />
5555
<div className="text-sm md:pl-2 max-w-max">
5656
<div className="flex gap-1 text-gray-700 font-medium">
57-
<span>{shorternNumber(reward.amount)}</span>
57+
<span>{shortenNumber(reward.amount)}</span>
5858
<span>{reward?.token}</span>
5959
<span>{t("communities.overview.challenge.rewards")}</span>
6060
</div>
6161
<div className="text-gray-400 text-xs font-medium leading-3 mt-1 flex">
6262
{challenge.rewards.map((reward, index) => (
6363
<span key={`reward-${index}`}>
6464
{index > 0 && "\u003B "}
65-
{shorternNumber(reward.amount)} {reward.token}/{formatToken(reward.type)}
65+
{shortenNumber(reward.amount)} {reward.token}/{formatToken(reward.type)}
6666
</span>
6767
))}
6868
</div>

src/components/sections/challenges/_partials/HackathonPrize.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import { Distribution, Reward } from "@/types/course";
2-
import { shorternNumber } from "@/utilities";
2+
import { shortenNumber } from "@/utilities";
33

44
export default function HackathonPrize({ reward, description }: { reward: Reward; description: string }) {
55
const { first, second, third } = reward?.distribution || ({} as Distribution);
66
return (
77
<>
88
<div className="flex gap-1 text-gray-700 font-medium">
9-
<span>{`${shorternNumber(reward?.amount)} ${reward.token} Prize Pool`}</span>
9+
<span>{`${shortenNumber(reward?.amount)} ${reward.token} Prize Pool`}</span>
1010
<span>{description}</span>
1111
</div>
1212
<div className="text-gray-400 text-xs font-medium leading-3 mt-1 flex">
13-
<span>{`1st Place ${shorternNumber(first)}; 2nd Place $${shorternNumber(second)}; 3rd Place $${shorternNumber(third)}`}</span>
13+
<span>{`1st Place ${shortenNumber(first)}; 2nd Place $${shortenNumber(second)}; 3rd Place $${shortenNumber(third)}`}</span>
1414
</div>
1515
</>
1616
);

src/components/ui/Reward.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Coin from "../ui/Coin";
22
import { useTranslation } from "next-i18next";
33
import { Reward } from "@/types/course";
4-
import { shorternNumber } from "@/utilities";
4+
import { shortenNumber } from "@/utilities";
55

66
interface OverviewRewardsProps {
77
reward: Reward;
@@ -19,7 +19,7 @@ export default function OverviewRewards({ reward, category, size }: OverviewRewa
1919
<Coin token={reward.token} className="flex-none" />
2020
<div className="text-base lg:pl-2 lg:pr-3 md:px-2 max-w-max">
2121
<div className="flex">
22-
<span className="block font-medium text-base pr-1">{shorternNumber(reward.amount)}</span>
22+
<span className="block font-medium text-base pr-1">{shortenNumber(reward.amount)}</span>
2323
<span className="block font-medium text-base">{reward.token}</span>
2424
</div>
2525
<div className="flex">

src/utilities/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function sleep(ms: number): Promise<unknown> {
1313
* Convert a number to K ex : 7000 -> 7K, 2510 -> 2.5K
1414
* @date 12/7/2023 - 6:50:18 PM
1515
*/
16-
export const shorternNumber = (amount: number) => {
16+
export const shortenNumber = (amount: number) => {
1717
const abbrevObject = [
1818
{ value: 1000000000, abbreviation: "B" },
1919
{ value: 1000000, abbreviation: "M" },

0 commit comments

Comments
 (0)