added settingsStore to infoPanel store and moved normalizeSelection and getItemIcon as methods
This commit is contained in:
parent
f78f4b1ce0
commit
36f233035d
@ -128,6 +128,8 @@ const profileActionsStore = new ProfileActionsStore(
|
||||
peopleStore
|
||||
);
|
||||
|
||||
authStore.infoPanelStore.setSettingsStore(settingsStore);
|
||||
|
||||
const store = {
|
||||
auth: authStore,
|
||||
payments: paymentStore,
|
||||
|
@ -1,10 +1,18 @@
|
||||
import { makeAutoObservable } from "mobx";
|
||||
|
||||
class InfoPanelStore {
|
||||
selection = null;
|
||||
isVisible = false;
|
||||
roomView = "members";
|
||||
itemView = "history";
|
||||
|
||||
selection = null;
|
||||
|
||||
currentRoomTitle = null;
|
||||
currentRoomMembers = null;
|
||||
|
||||
roomsView = "members";
|
||||
personalView = "history";
|
||||
|
||||
settingsStore = null;
|
||||
setSettingsStore = (settingsStore) => (this.settingsStore = settingsStore);
|
||||
|
||||
constructor() {
|
||||
makeAutoObservable(this);
|
||||
@ -14,6 +22,33 @@ class InfoPanelStore {
|
||||
this.selection = selection;
|
||||
};
|
||||
|
||||
getItemIcon = (item, size) => {
|
||||
return item.isRoom
|
||||
? item.logo && item.logo.big
|
||||
? item.logo.big
|
||||
: item.icon
|
||||
: item.isFolder
|
||||
? this.settingsStore.getFolderIcon(item.providerKey, size)
|
||||
: this.settingsStore.getIcon(size, item.fileExst || ".file");
|
||||
};
|
||||
|
||||
normalizeSelection = (selection) => {
|
||||
return {
|
||||
...selection,
|
||||
icon: this.getItemIcon(selection, 32),
|
||||
hasCustonThumbnail: !!selection.thumbnailUrl,
|
||||
thumbnailUrl: selection.thumbnailUrl || this.getItemIcon(selection, 96),
|
||||
};
|
||||
};
|
||||
|
||||
setCurrentRoomTitle = (currentRoomTitle) => {
|
||||
this.currentRoomTitle = currentRoomTitle;
|
||||
};
|
||||
|
||||
setCurrentRoomMembers = (currentRoomMembers) => {
|
||||
this.currentRoomMembers = currentRoomMembers;
|
||||
};
|
||||
|
||||
toggleIsVisible = () => {
|
||||
this.isVisible = !this.isVisible;
|
||||
};
|
||||
@ -27,8 +62,8 @@ class InfoPanelStore {
|
||||
};
|
||||
|
||||
setView = (view) => {
|
||||
this.roomView = view;
|
||||
this.itemView = view === "members" ? "history" : view;
|
||||
this.roomsView = view;
|
||||
this.personalView = view === "members" ? "history" : view;
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user