From 685e5018ce7d650dfa73603bf437cfc9928afbea Mon Sep 17 00:00:00 2001 From: Mia <49593536+mia-pi-git@users.noreply.github.com> Date: Thu, 16 Jul 2026 22:14:06 -0500 Subject: [PATCH] Add a toggle for syncing remote teams to device --- .../src/oldclient/client-topbar.js | 15 ++++++++++++++- play.pokemonshowdown.com/src/oldclient/storage.js | 1 + teams.pokemonshowdown.com/src/teams-view.tsx | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/play.pokemonshowdown.com/src/oldclient/client-topbar.js b/play.pokemonshowdown.com/src/oldclient/client-topbar.js index ba6cae451..59756a92e 100644 --- a/play.pokemonshowdown.com/src/oldclient/client-topbar.js +++ b/play.pokemonshowdown.com/src/oldclient/client-topbar.js @@ -472,6 +472,7 @@ 'change select[name=bg]': 'setBg', 'change select[name=timestamps-lobby]': 'setTimestampsLobby', 'change select[name=timestamps-pms]': 'setTimestampsPMs', + 'change input[name=syncteams]': 'setSyncTeams', 'change select[name=onepanel]': 'setOnePanel', 'change select[name=theme]': 'setTheme', 'change input[name=logchat]': 'setLogChat', @@ -564,7 +565,8 @@ buf += '
'; buf += ''; buf += ''; - + var syncTeams = !Storage.prefs('nosyncteams'); + buf += ''; if (window.nodewebkit) { buf += 'Desktop app
'; @@ -673,6 +675,17 @@ this.timestamps.pms = e.currentTarget.value; Storage.prefs('timestamps', this.timestamps); }, + setSyncTeams: function () { + Storage.prefs('nosyncteams', !Storage.prefs('nosyncteams')); + if (!Storage.prefs('nosyncteams')) { + Storage.loadRemoteTeams(function () { + if (app.rooms.teambuilder) { + // if they have it open, be sure to update so it doesn't show 'no teams' + app.rooms.teambuilder.update(); + } + }); + } + }, avatars: function () { app.addPopup(AvatarsPopup); }, diff --git a/play.pokemonshowdown.com/src/oldclient/storage.js b/play.pokemonshowdown.com/src/oldclient/storage.js index 2e70c7b99..70e2bd3a8 100644 --- a/play.pokemonshowdown.com/src/oldclient/storage.js +++ b/play.pokemonshowdown.com/src/oldclient/storage.js @@ -620,6 +620,7 @@ Storage.compareTeams = function (serverTeam, localTeam) { }; Storage.loadRemoteTeams = function (after) { + if (Storage.prefs('nosyncteams')) return; $.get(app.user.getActionPHP(), { act: 'getteams' }, Storage.safeJSON(function (data) { if (data.actionerror) { return app.addPopupMessage('Error loading uploaded teams: ' + data.actionerror); diff --git a/teams.pokemonshowdown.com/src/teams-view.tsx b/teams.pokemonshowdown.com/src/teams-view.tsx index 9fc010768..61e52e62f 100644 --- a/teams.pokemonshowdown.com/src/teams-view.tsx +++ b/teams.pokemonshowdown.com/src/teams-view.tsx @@ -433,7 +433,7 @@ export class TeamViewer extends preact.Component