Skip to content

Commit affa9fa

Browse files
feat(sample-app): click-to-copy on status bar values
Click any status value (endpoint, IDs, cookies) to copy to clipboard. Brief green flash as feedback. Skips placeholder dashes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent edb7436 commit affa9fa

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

packages/audience/sdk-sample-app/sample-app.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,17 @@ h1 {
126126
.status-value {
127127
color: var(--text);
128128
word-break: break-all;
129+
cursor: pointer;
129130
}
130131

131132
.status-value.dim {
132133
color: var(--text-dim);
133134
}
134135

136+
.status-value.copied {
137+
color: var(--ok);
138+
}
139+
135140
.panel {
136141
padding: 16px 20px;
137142
margin-bottom: 16px;

packages/audience/sdk-sample-app/sample-app.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,16 @@
565565
$(id).addEventListener('input', syncAliasButton);
566566
});
567567
$('btn-clear-cookies').addEventListener('click', clearSdkCookies);
568+
document.querySelector('.status-bar').addEventListener('click', function (e) {
569+
var val = e.target.closest('.status-value');
570+
if (!val || val.textContent === '—') return;
571+
var original = val.textContent;
572+
navigator.clipboard.writeText(original).then(function () {
573+
val.textContent = 'Copied';
574+
val.classList.add('copied');
575+
setTimeout(function () { val.textContent = original; val.classList.remove('copied'); }, 800);
576+
}).catch(function () {});
577+
});
568578

569579
$('btn-copy-log').addEventListener('click', function () {
570580
var s = logEntries.map(function (e) {

0 commit comments

Comments
 (0)