feat(ui): symmetric Connect button + clear error feedback for both sides#68
Merged
feat(ui): symmetric Connect button + clear error feedback for both sides#68
Conversation
Two complaints from the v0.4.0 live test:
1. Local-token field had no Connect button — user had to press Enter
and hope. Peer side has a button. Asymmetric and confusing.
2. Both sides silently swallowed connect failures. Wrong token? Wrong
URL? Down peer? Mistyped port? UI just said "disconnected" / "no
peer" forever, no hint about what went wrong.
Fix:
- Local token field gets the same "Connect" button the peer side has.
Enter still works for power users; click works for everyone else.
Both forward to the same connectLocal() entry point. The legacy
applyLocalToken() / checkLocal() names are kept as aliases so any
bookmarked URL / external integration that called them still works.
- Both sides now track a 4-state status (idle / connecting / ok /
error) and a localError / peerError string. The status pill flips
through the states; the error string lands inline next to it (with
full text in the title attribute for hover, ellipsis in the chip).
- Error messages classified:
* 401 → "401 — invalid token"
* 403 → "403 — forbidden"
* 404 → "404 — endpoint not found (check URL points at NetCopy)"
* 5xx → "5xx — peer server error"
* fetch reject → "unreachable (host down, wrong port, or http/https
mismatch)" — browsers don't surface concrete TCP errors so the
message points at the most likely causes.
- Connect button is disabled while a request is in flight; its label
becomes "…" so the user knows something's happening even on a slow
network.
Pure client-side: app.js + index.html + style.css. No API changes.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two complaints from the v0.4.0 live test:
Fix
Symmetric Connect button
Local token field gets the same Connect button the peer side has. Enter still works for power users; click works for everyone else. Both forward to the same
connectLocal()entry point. The legacyapplyLocalToken()/checkLocal()names are kept as aliases so any external code that called them still works.4-state status + inline error
Both sides now track a
idle / connecting / ok / errorstatus and alocalError/peerErrorstring. The status pill cycles through these; the error string sits inline next to it (full text in the title attribute, ellipsis in the chip).idleconnectingok.okerror.badClassified error messages
401 — invalid token403 — forbidden404 — endpoint not found (check URL points at NetCopy)5xx — peer server errorunreachable (host down, wrong port, or http/https mismatch)The fetch-reject hint covers the common causes browsers refuse to disclose concretely (CORS / scheme mismatch / unreachable / refused all surface as the same opaque "TypeError: Failed to fetch").
Misc
…so the user knows something's happening on slow networks.Test plan
mvn compileclean; ArchUnit 8/8.401 — invalid token.http://nonexistent:9999→ "error" +unreachable (host down, …).http://google.com→ "error" +404 — endpoint not found ….🤖 Generated with Claude Code