diff options
| author | Max Nanis | 2025-06-09 04:44:45 +0700 |
|---|---|---|
| committer | Max Nanis | 2025-06-09 04:44:45 +0700 |
| commit | a674d2e03de3bd048714d9c06e4bba9d9ecdb328 (patch) | |
| tree | 130a07e0cc631a81b560c847ed7794d470c25e22 /src/lib/utils.ts | |
| parent | 438585f6e6cdebc3089739ddf77382aebe09fac1 (diff) | |
| download | panel-ui-a674d2e03de3bd048714d9c06e4bba9d9ecdb328.tar.gz panel-ui-a674d2e03de3bd048714d9c06e4bba9d9ecdb328.zip | |
Offerwall page - using datatables to show the bucket contents, setting up tabs to allow overview and detail insights of buckets, formatting of height and layout, playing with iqr, connection to conditionally eligible sidebar
Diffstat (limited to 'src/lib/utils.ts')
| -rw-r--r-- | src/lib/utils.ts | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 8525468..b1cd120 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -1,5 +1,6 @@ import {type ClassValue, clsx} from "clsx" import {twMerge} from "tailwind-merge" +import React from "react"; export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)) @@ -9,4 +10,27 @@ export function assert(condition: any, msg?: string): asserts condition { if (!condition) { throw new Error(msg); } -}
\ No newline at end of file +} + +export function formatSecondsVerbose(seconds: number): string { + const mins = Math.floor(seconds / 60) + const secs = seconds % 60 + const parts = [] + if (mins > 0) parts.push(`${mins} min`) + if (secs > 0 || mins === 0) parts.push(`${secs} sec`) + return parts.join(" ") +} + +export function formatSeconds(seconds: number): string { + const mins = Math.floor(seconds / 60) + const secs = seconds % 60 + const paddedSecs = secs.toString().padStart(2, '0') + return `${mins}:${paddedSecs}` +} + +export function formatCentsToUSD(cents: number): string { + return new Intl.NumberFormat('en-US', { + style: 'currency', + currency: 'USD', + }).format(cents / 100) +} |
