Skip to content

Commit 72a080d

Browse files
committed
fix lint
1 parent 684d267 commit 72a080d

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

apps/dashboard/app/(main)/billing/utils/feature-usage.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import relativeTime from "dayjs/plugin/relativeTime";
44

55
dayjs.extend(relativeTime);
66

7-
export interface FeatureUsage {
7+
export type FeatureUsage = {
88
id: string;
99
name: string;
1010
used: number;
@@ -18,7 +18,7 @@ export interface FeatureUsage {
1818
resetAt: number | null;
1919
resetDateFormatted: string | null;
2020
resetRelative: string | null;
21-
}
21+
};
2222

2323
export function calculateFeatureUsage(feature: CustomerFeature): FeatureUsage {
2424
const includedUsage = feature.included_usage ?? 0;
@@ -68,16 +68,25 @@ export function calculateFeatureUsage(feature: CustomerFeature): FeatureUsage {
6868
export function calculateAllFeatureUsage(
6969
features: Record<string, CustomerFeature> | undefined
7070
): FeatureUsage[] {
71-
if (!features) return [];
71+
if (!features) {
72+
return [];
73+
}
7274
return Object.values(features).map(calculateFeatureUsage);
7375
}
7476

7577
export function formatCompactNumber(num: number): string {
76-
if (num >= 1_000_000_000_000)
78+
if (num >= 1_000_000_000_000) {
7779
return `${(num / 1_000_000_000_000).toFixed(1)}T`;
78-
if (num >= 1_000_000_000) return `${(num / 1_000_000_000).toFixed(1)}B`;
79-
if (num >= 1_000_000) return `${(num / 1_000_000).toFixed(1)}M`;
80-
if (num >= 10_000) return `${(num / 1000).toFixed(0)}K`;
80+
}
81+
if (num >= 1_000_000_000) {
82+
return `${(num / 1_000_000_000).toFixed(1)}B`;
83+
}
84+
if (num >= 1_000_000) {
85+
return `${(num / 1_000_000).toFixed(1)}M`;
86+
}
87+
if (num >= 10_000) {
88+
return `${(num / 1000).toFixed(0)}K`;
89+
}
8190
return num.toLocaleString();
8291
}
8392

0 commit comments

Comments
 (0)