refactor: overhaul UI for streamlined user experience
Redesign navigation, home overview, user portrait, and valuation pages with improved functionality and responsive design. Co-authored-by: null <4804959+fnvtk@users.noreply.github.com>
This commit is contained in:
37
lib/utils.ts
Normal file
37
lib/utils.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { type ClassValue, clsx } from "clsx"
|
||||
import { twMerge } from "tailwind-merge"
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs))
|
||||
}
|
||||
|
||||
export function formatNumber(num: number): string {
|
||||
return new Intl.NumberFormat("zh-CN").format(num)
|
||||
}
|
||||
|
||||
export function formatPercent(num: number): string {
|
||||
return new Intl.NumberFormat("zh-CN", {
|
||||
style: "percent",
|
||||
minimumFractionDigits: 1,
|
||||
maximumFractionDigits: 1,
|
||||
}).format(num / 100)
|
||||
}
|
||||
|
||||
export function formatDate(date: Date | string): string {
|
||||
if (typeof date === "string") {
|
||||
date = new Date(date)
|
||||
}
|
||||
return new Intl.DateTimeFormat("zh-CN", {
|
||||
year: "numeric",
|
||||
month: "2-digit",
|
||||
day: "2-digit",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
}).format(date)
|
||||
}
|
||||
|
||||
export function getGrowthClass(value: number): string {
|
||||
if (value > 0) return "text-green-500"
|
||||
if (value < 0) return "text-red-500"
|
||||
return "text-gray-500"
|
||||
}
|
||||
Reference in New Issue
Block a user