feat: draggable wallet reorder for chart layering
This commit is contained in:
20
wallets.js
20
wallets.js
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user