Add quick server switcher - #260
Merged
Merged
Conversation
Lets you switch servers from the torrents screen instead of going Settings → Disconnect → Torrents → Connect. A compact server badge in the header opens ServerSwitcherModal, which lists saved servers, marks the connected one, and switches directly to whichever other one is tapped via the existing connectToServer.
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
Fixes #249
Switching servers today means Settings → Disconnect → Torrents → Connect. This adds a quick switcher directly on the Torrents screen, per the direction settled in the issue thread (a popup/sheet reusing the QuickConnectPanel look, not a new tab, Transfer tab untouched):
components/ServerSwitcherModal.tsx— a themed sheet listing every saved server (ServerIconBadge+ name + address, mirroringQuickConnectPanel's row treatment), marks the currently-connected server with a checkmark pill, and switches directly to whichever other server is tapped by calling the existingconnectToServer(no manual disconnect-then-connect — that's already handled byconnectMutation.onMutate). Owns its own transient switching-id/inline-error state, so a failed switch shows a per-row error without needing the global toast (which an RN<Modal>would otherwise cover — see AGENTS.md'sToastContextnote). A footer row links to Settings → Servers for full management.app/(tabs)/(torrents)/index.tsx— a compact server badge + name in the header (left of the search bar) opens the sheet. Broadened the existing saved-serversuseFocusEffectto also fetch while connected (previously gated to the disconnected-only QuickConnectPanel), so the switcher's list stays current. BumpedlistContent's top padding to make room for the new header row.switchServer,manageServers,currentServer) added to all six locales.AGENTS.mdFile Index updated with the new component.Test plan
npx tsc --noEmit— exit 0npm test— 80 suites / 1158 tests passing (includes newtests/rn/components/ServerSwitcherModal.test.tsx, 9 cases: list rendering, current-server marking, switch on tap, close-on-current-tap, close-on-success, inline error on failure, manage-servers link, backdrop close)npm run lint— 0 errors, 37 warnings (repo baseline)npm run format🤖 Generated with Claude Code