blowater/UI/app_model.ts

61 lines
1.5 KiB
TypeScript
Raw Normal View History

2023-06-30 14:05:57 +00:00
import { NavigationModel } from "./nav.tsx";
import { SearchInitModel, SearchModel } from "./search_model.ts";
import { ProfileData } from "../features/profile.ts";
2023-06-30 14:05:57 +00:00
import { RightPanelModel } from "./message-panel.tsx";
import { App } from "./app.tsx";
import { SignInModel } from "./signIn.tsx";
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 = {
app: App | undefined; // app is only available after sign-in
dm: DM_Model;
search: SearchModel;
editors: Map<string, EditorModel>;
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 {
const editors: Map<string, EditorModel> = new Map();
2023-06-30 14:05:57 +00:00
return {
app: undefined,
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
},
editors: editors,
gmEditors: new Map(),
2023-06-30 14:05:57 +00:00
newProfileField: {
key: "",
value: "",
},
navigationModel: {
activeNav: "DM",
},
rightPanelModel: {
show: false,
},
myProfile: undefined,
signIn: {
privateKey: "",
},
};
}