feat: draggable wallet reorder for chart layering

This commit is contained in:
Dione
2026-06-11 19:16:18 +00:00
parent b52da96ba0
commit d96e56bde5
2 changed files with 189 additions and 63 deletions

View File

@ -361,6 +361,26 @@ export class WalletManager {
this._persist();
return { success: true };
}
/**
* Reorder wallets to match the given address sequence.
* Addresses listed first are moved to front; remaining keep their original relative order.
* Only recognized addresses are kept in the new order.
* @param {string[]} addresses
*/
setWalletOrder(addresses) {
const addrSet = this._wallets.map(w => w.address);
const ordered = [];
for (const addr of addresses) {
if (addrSet.includes(addr)) {
const w = this._wallets.find(x => x.address === addr);
if (w) ordered.push(w);
}
}
const remaining = this._wallets.filter(w => !ordered.includes(w));
this._wallets = [...ordered, ...remaining];
this._persist();
}
}
export default WalletManager;