Skip to content

Commit 6c3b97f

Browse files
jason-rlclaude
andcommitted
Add Copy Name keybind to all detail screens
Add `y` keybind to copy resource name (in addition to existing `c` for Copy ID) on all detail screens via ResourceDetailPage. Enhanced clipboard feedback shows "ID copied!" or "Name copied!" instead of generic message. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b58ce55 commit 6c3b97f

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/components/ResourceDetailPage.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ export function ResourceDetailPage<T>({
167167
const [copyStatus, setCopyStatus] = React.useState<string | null>(null);
168168

169169
// Copy to clipboard with status feedback
170-
const handleCopy = React.useCallback(async (text: string) => {
170+
const handleCopy = React.useCallback(async (text: string, label?: string) => {
171171
const status = await copyToClipboard(text);
172-
setCopyStatus(status);
172+
setCopyStatus(label ? `${label} copied!` : status);
173173
setTimeout(() => setCopyStatus(null), 2000);
174174
}, []);
175175

@@ -393,7 +393,8 @@ export function ResourceDetailPage<T>({
393393
bindings: {
394394
q: onBack,
395395
escape: onBack,
396-
c: () => handleCopy(getId(resource)),
396+
c: () => handleCopy(getId(resource), "ID"),
397+
y: () => handleCopy(getDisplayName(resource), "Name"),
397398
...(buildDetailLines
398399
? {
399400
i: () => {
@@ -452,6 +453,7 @@ export function ResourceDetailPage<T>({
452453
operationsStartIndex,
453454
onOperation,
454455
getId,
456+
getDisplayName,
455457
],
456458
);
457459

@@ -808,6 +810,7 @@ export function ResourceDetailPage<T>({
808810
: "Execute",
809811
},
810812
{ key: "c", label: "Copy ID" },
813+
{ key: "y", label: "Copy Name" },
811814
{ key: "i", label: "Full Details", condition: !!buildDetailLines },
812815
{ key: "o", label: "Browser", condition: !!getUrl },
813816
{ key: "q/Ctrl+C", label: "Back/Quit" },

0 commit comments

Comments
 (0)