Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions desktop/src/features/agents/ui/VerifyReceiptDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ShieldCheck, ShieldX } from "lucide-react";

import { verifyWorkReceipt } from "@/shared/api/tauriTrustLedger";
import type { ReceiptVerification } from "@/shared/api/types";
import { truncateNpub } from "@/shared/lib/pubkey";
import { Badge } from "@/shared/ui/badge";
import { Button } from "@/shared/ui/button";
import {
Expand All @@ -19,12 +20,6 @@ const LEVEL_LABEL: Record<string, string> = {
autonomous: "Autonomous",
};

function shortKey(pubkey: string): string {
return pubkey.length > 16
? `${pubkey.slice(0, 8)}…${pubkey.slice(-6)}`
: pubkey;
}

function formatIssued(unixSeconds: number): string {
return new Date(unixSeconds * 1_000).toLocaleString(undefined, {
month: "short",
Expand Down Expand Up @@ -125,11 +120,11 @@ export function VerifyReceiptDialog({
<dl className="mt-3 grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-sm">
<dt className="text-muted-foreground">Issuer</dt>
<dd className="font-mono text-xs">
{shortKey(result.issuerPubkey ?? "")}
{truncateNpub(result.issuerPubkey ?? "")}
</dd>
<dt className="text-muted-foreground">Agent</dt>
<dd className="font-mono text-xs">
{shortKey(result.summary.agentPubkey)}
{truncateNpub(result.summary.agentPubkey)}
</dd>
<dt className="text-muted-foreground">Issued</dt>
<dd>{formatIssued(result.issuedAt ?? 0)}</dd>
Expand Down
8 changes: 2 additions & 6 deletions desktop/src/features/time-machine/ui/TimeMachineScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import { getOrgTimeline } from "@/shared/api/tauriTimeMachine";
import type { TimelineEvent } from "@/shared/api/types";
import { cn } from "@/shared/lib/cn";
import { normalizePubkey } from "@/shared/lib/pubkey";
import { normalizePubkey, truncateNpub } from "@/shared/lib/pubkey";
import { Badge } from "@/shared/ui/badge";
import { Button } from "@/shared/ui/button";
import { UserAvatar } from "@/shared/ui/UserAvatar";
Expand All @@ -32,10 +32,6 @@ const FEED_ROWS = 40;

type Named = { name: string; avatarUrl: string | null };

function shortKey(pubkey: string): string {
return `${pubkey.slice(0, 6)}…${pubkey.slice(-4)}`;
}

function formatInstant(unixSeconds: number): string {
return new Date(unixSeconds * 1_000).toLocaleString(undefined, {
weekday: "short",
Expand Down Expand Up @@ -133,7 +129,7 @@ export function TimeMachineScreen(): React.ReactElement {
}, [channels]);
const nameOf = (pubkey: string): Named =>
agentNames.get(normalizePubkey(pubkey)) ?? {
name: shortKey(pubkey),
name: truncateNpub(pubkey),
avatarUrl: null,
};
const channelOf = (channelId: string | null): string | null =>
Expand Down
Loading