Skip to content

sharing-pane: tighten typography, prevent name overflow, add copy button#16

Merged
melvincarvalho merged 1 commit into
gh-pagesfrom
issue-15-sharing-pane-polish
May 5, 2026
Merged

sharing-pane: tighten typography, prevent name overflow, add copy button#16
melvincarvalho merged 1 commit into
gh-pagesfrom
issue-15-sharing-pane-polish

Conversation

@melvincarvalho
Copy link
Copy Markdown
Contributor

Closes #15.

Summary

  • Drop font sizes ~1px across the Sharing pane (header, public-access card, permissions label, agent name, WebID, add-WebID form) so the layout reads less oversized on desktop.
  • Truncate the agent name with overflow:hidden;text-overflow:ellipsis;white-space:nowrap and put the full label in title=. Fixes long unbreakable identifiers (e.g. did:nostr:<64-hex>) from blowing past the card boundary on narrow viewports.
  • Add a 📋 copy button beside each WebID; clicking the URI text or the button copies the full agent string and shows a brief ✓ confirmation. Falls back to document.execCommand('copy') for non-secure contexts. Only on individual-agent rows (skipped for Everyone/Authenticated class rows since the class URI isn't useful to copy).

All three changes are scoped to panes/sharing-pane.js — no other files touched.

Test plan

  • Open /public/ (or any container with an .acl) → Sharing tab. Confirm headings, agent names, and form controls feel a touch tighter than before.
  • Add a long unbreakable agent (e.g. paste a did:nostr:<hex> WebID). Confirm the agent name truncates with and the card stays inside its parent on a 414px-wide viewport.
  • Hover the agent name → tooltip shows the full label.
  • Click the 📋 button → button briefly turns into ✓ and the full agent string is in the clipboard.
  • Click the URI text itself → same behavior.
  • Verify Everyone/Authenticated rows still render without a copy button.

…ton (#15)

- Reduce font sizes ~1px across header, public-access card, permissions
  label, agent name, WebID, and the add-WebID input/button.
- Truncate the agent name with ellipsis (and full text in title=) so long
  unbreakable identifiers like did:nostr:<hex> stay inside the card on
  narrow viewports.
- Add a copy button next to each WebID; the URI is also click-to-copy.
  Brief checkmark confirmation, with execCommand fallback for non-secure
  contexts. Only on individual-agent rows.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR polishes the Sharing pane UI (panes/sharing-pane.js) by tightening typography, preventing long agent labels from overflowing, and adding a one-click “copy WebID” affordance to individual-agent rows (per #15).

Changes:

  • Reduce font sizes/padding across header, public-access card, permissions label, agent rows, and add-WebID controls.
  • Truncate long agent display names with ellipsis and add a tooltip via title.
  • Add a clipboard copy action (clickable URI text + 📋 button) with a brief ✓ confirmation and an execCommand('copy') fallback.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread panes/sharing-pane.js
Comment on lines +187 to +189
header.innerHTML = '<h2 style="font-size:18px;font-weight:700;color:#1a1a1a;margin:0 0 6px;">\u{1F91D} Sharing</h2>'
+ '<div style="font-size:12px;color:#999;word-break:break-all;">' + resourceUrl + '</div>'
if (statusMsg) header.innerHTML += '<div style="font-size:11px;color:#7c3aed;margin-top:6px;">' + statusMsg + '</div>'
Comment thread panes/sharing-pane.js
Comment on lines 257 to +265
var uri = document.createElement('div')
uri.style.cssText = 'font-size:11px;color:#bbb;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;'
uri.style.cssText = 'font-size:10px;color:#bbb;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;cursor:pointer;'
uri.textContent = auth.agent
uri.title = auth.agent
info.appendChild(uri)
uri.title = 'Click to copy: ' + auth.agent

var copyBtn = document.createElement('button')
copyBtn.style.cssText = 'background:none;border:none;cursor:pointer;color:#bbb;font-size:11px;padding:2px 4px;flex-shrink:0;line-height:1;'
copyBtn.textContent = '\u{1F4CB}'
copyBtn.title = 'Copy WebID'
Comment thread panes/sharing-pane.js
Comment on lines +271 to +280
setTimeout(function() { copyBtn.textContent = '\u{1F4CB}'; copyBtn.style.color = '#bbb' }, 1200)
}).catch(function() {
var ta = document.createElement('textarea')
ta.value = auth.agent
ta.style.position = 'fixed'; ta.style.opacity = '0'
document.body.appendChild(ta); ta.select()
try { document.execCommand('copy') } catch (e) {}
document.body.removeChild(ta)
copyBtn.textContent = '✓'; copyBtn.style.color = '#7c3aed'
setTimeout(function() { copyBtn.textContent = '\u{1F4CB}'; copyBtn.style.color = '#bbb' }, 1200)
Comment thread panes/sharing-pane.js
Comment on lines +187 to +189
header.innerHTML = '<h2 style="font-size:18px;font-weight:700;color:#1a1a1a;margin:0 0 6px;">\u{1F91D} Sharing</h2>'
+ '<div style="font-size:12px;color:#999;word-break:break-all;">' + resourceUrl + '</div>'
if (statusMsg) header.innerHTML += '<div style="font-size:11px;color:#7c3aed;margin-top:6px;">' + statusMsg + '</div>'
@melvincarvalho
Copy link
Copy Markdown
Contributor Author

Thanks @copilot — declining all four for this PR; goal here is to keep the pane small.

  • Header 22→18 vs "~1px": intentional. The header was the visually largest offender; the wider drop is what made the pane feel right. Leaving the description as-is.
  • A11y on URI/copy button: the copy <button> is a real button (focusable). The URI div as a secondary affordance is fine here.
  • execCommand fallback ✓ regardless of return: only hits non-secure contexts; this pod runs over localhost/https in practice. Not worth the extra branching.
  • innerHTML + server-controlled statusMsg/resourceUrl: pre-existing pattern across the file, and the threat model is the user editing their own pod's ACL. Fixing it here would only address one of many sites — out of scope.

Happy to revisit any of these if it comes up in real use.

@melvincarvalho melvincarvalho merged commit 3589e5f into gh-pages May 5, 2026
4 of 5 checks passed
@melvincarvalho melvincarvalho deleted the issue-15-sharing-pane-polish branch May 5, 2026 20:36
Copilot stopped work on behalf of melvincarvalho due to an error May 5, 2026 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sharing-pane: tighten typography, prevent name overflow, add WebID copy button

2 participants