2023-06-30 14:05:57 +00:00
|
|
|
import { NavigationModel } from "./nav.tsx";
|
2023-09-15 08:58:40 +00:00
|
|
|
import { SearchInitModel, SearchModel } from "./search_model.ts";
|
2023-07-11 10:45:57 +00:00
|
|
|
import { ProfileData } from "../features/profile.ts";
|
2023-06-30 14:05:57 +00:00
|
|
|
import { RightPanelModel } from "./message-panel.tsx";
|
2023-07-11 10:45:57 +00:00
|
|
|
import { App } from "./app.tsx";
|
2023-09-07 13:11:59 +00:00
|
|
|
import { SignInModel } from "./signIn.tsx";
|
2023-10-07 10:59:06 +00:00
|
|
|
import { EditorModel } from "./editor.tsx";
|
2023-10-09 18:52:30 +00:00
|
|
|
import { DM_Model } from "./dm.tsx";
|
2023-06-30 14:05:57 +00:00
|
|
|
|
|
|
|
export type Model = {
|
2023-07-11 10:45:57 +00:00
|
|
|
app: App | undefined; // app is only available after sign-in
|
2023-09-15 08:58:40 +00:00
|
|
|
dm: DM_Model;
|
|
|
|
search: SearchModel;
|
2023-10-07 10:59:06 +00:00
|
|
|
|
2023-10-21 11:29:47 +00:00
|
|
|
dmEditors: Map<string, EditorModel>;
|
2023-10-07 10:59:06 +00:00
|
|
|
gmEditors: Map<string, EditorModel>;
|
2023-06-30 14:05:57 +00:00
|
|
|
|
|
|
|
// profile
|
|
|
|
myProfile: ProfileData | undefined;
|
|
|
|
newProfileField: {
|
|
|
|
key: string;
|
|
|
|
value: string;
|
|
|
|
};
|
|
|
|
|
|
|
|
// UI
|
|
|
|
navigationModel: NavigationModel;
|
|
|
|
rightPanelModel: RightPanelModel;
|
|
|
|
|
|
|
|
// sign in
|
|
|
|
signIn: SignInModel;
|
|
|
|
};
|
|
|
|
|
|
|
|
export function initialModel(): Model {
|
2023-10-07 10:59:06 +00:00
|
|
|
const editors: Map<string, EditorModel> = new Map();
|
2023-06-30 14:05:57 +00:00
|
|
|
return {
|
2023-07-11 10:45:57 +00:00
|
|
|
app: undefined,
|
2023-09-15 08:58:40 +00:00
|
|
|
search: SearchInitModel(),
|
2023-06-30 14:05:57 +00:00
|
|
|
dm: {
|
|
|
|
focusedContent: new Map(),
|
2023-10-07 20:40:18 +00:00
|
|
|
currentEditor: undefined,
|
2023-10-04 21:34:43 +00:00
|
|
|
isGroupMessage: false,
|
2023-06-30 14:05:57 +00:00
|
|
|
},
|
2023-10-21 11:29:47 +00:00
|
|
|
dmEditors: editors,
|
2023-10-07 10:59:06 +00:00
|
|
|
gmEditors: new Map(),
|
2023-06-30 14:05:57 +00:00
|
|
|
newProfileField: {
|
|
|
|
key: "",
|
|
|
|
value: "",
|
|
|
|
},
|
|
|
|
navigationModel: {
|
|
|
|
activeNav: "DM",
|
|
|
|
},
|
|
|
|
rightPanelModel: {
|
|
|
|
show: false,
|
|
|
|
},
|
|
|
|
myProfile: undefined,
|
|
|
|
signIn: {
|
|
|
|
privateKey: "",
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|