implement board sorting
This commit is contained in:
@@ -12,14 +12,16 @@ export default class ChatListViewModel {
|
||||
storageModel: StorageModel;
|
||||
settingsViewModel: SettingsViewModel;
|
||||
|
||||
// state
|
||||
newChatPrimaryChannel: React.State<string> = new React.State("");
|
||||
chatViewModels: React.ListState<ChatViewModel> = new React.ListState();
|
||||
indexManager: IndexManager<ChatViewModel> = new IndexManager(
|
||||
// data
|
||||
chatIndexManager: IndexManager<ChatViewModel> = new IndexManager(
|
||||
(chatViewModel: ChatViewModel) =>
|
||||
chatViewModel.settingsPageViewModel.primaryChannel.value
|
||||
);
|
||||
|
||||
// state
|
||||
newChatPrimaryChannel: React.State<string> = new React.State("");
|
||||
chatViewModels: React.ListState<ChatViewModel> = new React.ListState();
|
||||
|
||||
selectedChat: React.State<ChatViewModel | undefined> = new React.State<
|
||||
ChatViewModel | undefined
|
||||
>(undefined);
|
||||
@@ -61,7 +63,7 @@ export default class ChatListViewModel {
|
||||
};
|
||||
|
||||
updateIndices = (): void => {
|
||||
this.indexManager.update([...this.chatViewModels.value.values()]);
|
||||
this.chatIndexManager.update([...this.chatViewModels.value.values()]);
|
||||
for (const chatViewModel of this.chatViewModels.value) {
|
||||
chatViewModel.updateIndex();
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ export default class ChatViewModel {
|
||||
};
|
||||
|
||||
updateIndex = (): void => {
|
||||
const index: number = this.chatListViewModel.indexManager.getIndex(this);
|
||||
const index: number = this.chatListViewModel.chatIndexManager.getIndex(this);
|
||||
this.index.value = index;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user