Keep TabList sorted
This commit is contained in:
parent
7160db9614
commit
6624a97ce7
4 changed files with 46 additions and 23 deletions
|
@ -1,10 +1,22 @@
|
|||
import { Set, Map } from 'immutable';
|
||||
import { createSelector } from 'reselect';
|
||||
import createReducer from 'util/createReducer';
|
||||
import { updateSelection } from './tab';
|
||||
import * as actions from './actions';
|
||||
|
||||
export const getPrivateChats = state => state.privateChats;
|
||||
|
||||
const lowerCaseValue = v => v.toLowerCase();
|
||||
|
||||
export const getSortedPrivateChats = createSelector(
|
||||
getPrivateChats,
|
||||
privateChats => privateChats.withMutations(p =>
|
||||
p.forEach((server, address) =>
|
||||
p.update(address, chats => chats.sortBy(lowerCaseValue))
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
function open(state, server, nick) {
|
||||
return state.update(server, Set(), chats => chats.add(nick));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue