Render phone object as phone_with_dial_code in recordview cells
This commit is contained in:
parent
6e02999d0d
commit
e58951b46e
@ -521,6 +521,11 @@ function buildPageRange(current: number, total: number): Array<number | "…"> {
|
||||
function renderCell(value: unknown, dataType: string, fieldKey: string): React.ReactNode {
|
||||
if (value == null || value === "") return <span className="text-stone-300 dark:text-zinc-700">—</span>;
|
||||
if (fieldKey === "current_state_name") return <StatusBadge value={String(value)} />;
|
||||
if (dataType === "phone" && typeof value === "object") {
|
||||
const p = value as { phone_with_dial_code?: string; phone?: string; dial_code?: string };
|
||||
const text = p.phone_with_dial_code || (p.dial_code && p.phone ? `${p.dial_code}${p.phone}` : p.phone || "");
|
||||
return text ? <span className="tabular-nums">{text}</span> : <span className="text-stone-300 dark:text-zinc-700">—</span>;
|
||||
}
|
||||
if (dataType === "number") {
|
||||
const n = Number(value);
|
||||
if (fieldKey.includes("amount") || fieldKey.includes("Amount") || fieldKey.includes("tax") || fieldKey.includes("price"))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user