feat: extract timestamp formatting and text truncation into separate utility functions

This commit is contained in:
Abhimanyu Saharan
2026-02-09 00:02:43 +05:30
parent 5ea9719c13
commit 1340e00b61
9 changed files with 64 additions and 150 deletions

View File

@@ -18,22 +18,11 @@ import {
type listAgentsApiV1AgentsGetResponse,
useListAgentsApiV1AgentsGet,
} from "@/api/generated/agents/agents";
import { formatTimestamp } from "@/lib/formatters";
import { useOrganizationMembership } from "@/lib/use-organization-membership";
import { DashboardPageLayout } from "@/components/templates/DashboardPageLayout";
import { Button } from "@/components/ui/button";
const formatTimestamp = (value?: string | null) => {
if (!value) return "—";
const date = new Date(`${value}${value.endsWith("Z") ? "" : "Z"}`);
if (Number.isNaN(date.getTime())) return "—";
return date.toLocaleString(undefined, {
month: "short",
day: "numeric",
hour: "2-digit",
minute: "2-digit",
});
};
const maskToken = (value?: string | null) => {
if (!value) return "—";
if (value.length <= 8) return "••••";