fix build
This commit is contained in:
@@ -56,6 +56,25 @@ export function formatEnum(value?: string | null): string {
|
||||
.join(" ")
|
||||
}
|
||||
|
||||
type TaxLabelValue = {
|
||||
name?: string | null
|
||||
title?: string | null
|
||||
rate?: string | number | null
|
||||
}
|
||||
|
||||
export function formatTaxLabel(
|
||||
value?: TaxLabelValue | null,
|
||||
emptyFallback = "—",
|
||||
): string {
|
||||
const label = value?.name ?? value?.title
|
||||
const rate = value?.rate
|
||||
|
||||
if (!label) return emptyFallback
|
||||
if (rate == null || rate === "") return label
|
||||
|
||||
return `${label} (${rate}%)`
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a number with locale-aware thousand separators.
|
||||
* e.g. 150000 → "150,000"
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
export const getFullName = <T extends { first_name?: string | undefined; last_name?: string | undefined }>(user?: T) => {
|
||||
type NameLike = {
|
||||
first_name?: string | null
|
||||
last_name?: string | null
|
||||
}
|
||||
|
||||
export const getFullName = <T extends NameLike>(user?: T | null) => {
|
||||
const firstName = user?.first_name ?? ""
|
||||
const lastName = user?.last_name ?? ""
|
||||
return `${firstName} ${lastName}`.trim()
|
||||
|
||||
Reference in New Issue
Block a user