feat(mobx): refactor and remove (react-)redux

This commit is contained in:
Paul
2021-12-23 21:43:11 +00:00
parent c5f9fc2873
commit 0591d44a31
55 changed files with 249 additions and 1522 deletions

View File

@@ -12,6 +12,11 @@ export interface Data {
openSections?: Record<string, boolean>;
}
export const SIDEBAR_MEMBERS = "sidebar_members";
export const SIDEBAR_CHANNELS = "sidebar_channels";
export const SECTION_MENTION = "mention";
export const SECTION_NSFW = "nsfw";
/**
* Keeps track of the last open channels, tabs, etc.
* Handles providing good UX experience on navigating
@@ -165,4 +170,13 @@ export default class Layout implements Store, Persistent<Data> {
this.openSections.set(id, value);
}
}
/**
* Toggle state of a section.
* @param id Section ID
* @param def Default state value
*/
@action toggleSectionState(id: string, def?: boolean) {
this.setSectionState(id, !this.getSectionState(id, def));
}
}