feat(desktop): canonical <PubKey> component — hover to view/copy full keys, owner "you" labels (#1589)

Signed-off-by: Wes <wesbillman@users.noreply.github.com>
Co-authored-by: Pinky <44b8e82baa6e0e254e0208d68f335c283c94e7b78dd1fa10d5a49d3f13dd0435@sprout-oss.stage.blox.sqprod.co>
Co-authored-by: Brain <21994759fc7a6fa6b965551d35cfd7897d262f2495467f2d78694ddcfa6a5c7e@sprout-oss.stage.blox.sqprod.co>
This commit is contained in:
Wes
2026-07-07 13:35:15 -07:00
committed by GitHub
co-authored by Pinky Brain
parent cdf982bdb3
commit 777babf393
52 changed files with 812 additions and 232 deletions
+2 -1
View File
@@ -8,8 +8,9 @@
"build": "tsc && vite build",
"typecheck": "tsc --noEmit",
"check:file-sizes": "node ./scripts/check-file-sizes.mjs",
"check:pubkey-truncation": "node ./scripts/check-pubkey-truncation.mjs",
"lint": "biome lint .",
"check": "biome check . && pnpm check:file-sizes",
"check": "biome check . && pnpm check:file-sizes && pnpm check:pubkey-truncation",
"format": "biome format --write .",
"preview": "vite preview",
"test:e2e": "pnpm build && playwright test",
+29
View File
@@ -0,0 +1,29 @@
import path from "node:path";
import { fileURLToPath } from "node:url";
import { runPubkeyTruncationCheck } from "../../scripts/check-pubkey-truncation-core.mjs";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const projectRoot = path.resolve(__dirname, "..");
const rules = [
{
root: "src",
extensions: new Set([".ts", ".tsx"]),
},
];
const overrides = new Set([
// Avatar fallback initials — two glyphs inside an avatar disc.
"src/features/repos/ui/PubkeyAvatar.tsx:29",
// Array window (first N pubkeys), not string truncation.
"src/features/repos/ui/OrgSidebar.tsx:22",
]);
await runPubkeyTruncationCheck({
projectRoot,
rules,
overrides,
allowedFiles: new Set(["src/shared/lib/pubkey.ts"]),
label: "Web",
scriptPath: "web/scripts/check-pubkey-truncation.mjs",
});
+2 -6
View File
@@ -4,13 +4,9 @@ import { Link } from "@tanstack/react-router";
import { Badge } from "@/shared/ui/badge";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/shared/ui/tooltip";
import { relativeTime } from "@/shared/lib/relative-time";
import { truncatePubkey } from "@/shared/lib/pubkey";
import type { Repo } from "../use-repos";
function truncateHex(hex: string): string {
if (hex.length <= 12) return hex;
return `${hex.slice(0, 8)}...${hex.slice(-4)}`;
}
export function RepoListItem({ repo }: { repo: Repo }) {
return (
<div className="py-6">
@@ -41,7 +37,7 @@ export function RepoListItem({ repo }: { repo: Repo }) {
<Tooltip>
<TooltipTrigger asChild>
<span className="cursor-default font-mono">
{truncateHex(repo.owner)}
{truncatePubkey(repo.owner)}
</span>
</TooltipTrigger>
<TooltipContent>{repo.owner}</TooltipContent>
+12
View File
@@ -0,0 +1,12 @@
/**
* The ONE canonical compact display form for a pubkey: `abcd1234…wxyz`.
* Mirrors desktop's `@/shared/lib/pubkey`. A truncated pubkey is a
* recognition aid, never an identity proof — security decisions need the
* full npub.
*/
export function truncatePubkey(pubkey: string): string {
if (pubkey.length <= 12) {
return pubkey;
}
return `${pubkey.slice(0, 8)}${pubkey.slice(-4)}`;
}