2024-07-20 14:54:52 +02:00
|
|
|
import "./base.css";
|
2024-07-20 18:10:42 +02:00
|
|
|
import "./colors.css";
|
2024-07-23 00:09:39 +02:00
|
|
|
import "./coloredTile.css";
|
2024-07-20 14:54:52 +02:00
|
|
|
|
2024-07-22 01:32:10 +02:00
|
|
|
import * as React from "bloatless-react";
|
|
|
|
|
|
2024-07-22 02:05:27 +02:00
|
|
|
import ChatListModel from "./Model/Chat/chatListModel";
|
2024-07-22 19:52:08 +02:00
|
|
|
import ChatListViewModel from "./ViewModel/Chat/chatListViewModel";
|
2024-07-20 14:16:26 +02:00
|
|
|
import { ChatPageWrapper } from "./View/chatPageWrapper";
|
2024-07-20 02:30:45 +02:00
|
|
|
import { ConnectionModal } from "./View/Modals/connectionModal";
|
2024-07-22 02:05:27 +02:00
|
|
|
import ConnectionModel from "./Model/Global/connectionModel";
|
2024-07-22 19:52:08 +02:00
|
|
|
import ConnectionViewModel from "./ViewModel/Global/connectionViewModel";
|
2024-07-25 16:02:49 +02:00
|
|
|
import CoreViewModel from "./ViewModel/Global/coreViewModel";
|
2024-07-28 00:02:17 +02:00
|
|
|
import { DataTransferModalWrapper } from "./View/Modals/dataTransferModal";
|
2024-07-27 17:03:52 +02:00
|
|
|
import FileTransferModel from "./Model/Global/fileTransferModel";
|
2024-07-27 19:13:59 +02:00
|
|
|
import FileTransferViewModel from "./ViewModel/Global/fileTransferViewModel";
|
2024-07-19 23:45:07 +02:00
|
|
|
import { HomePage } from "./View/homePage";
|
2024-07-22 02:05:27 +02:00
|
|
|
import SettingsModel from "./Model/Global/settingsModel";
|
2024-07-22 19:52:08 +02:00
|
|
|
import SettingsViewModel from "./ViewModel/Global/settingsViewModel";
|
2024-07-21 17:55:53 +02:00
|
|
|
import { StorageModal } from "./View/Modals/storageModal";
|
2024-07-22 02:05:27 +02:00
|
|
|
import StorageModel from "./Model/Global/storageModel";
|
2024-07-22 19:52:08 +02:00
|
|
|
import StorageViewModel from "./ViewModel/Global/storageViewModel";
|
2024-07-27 00:33:42 +02:00
|
|
|
import v1Upgrader from "./Upgrader/v1";
|
2024-07-19 19:23:48 +02:00
|
|
|
|
2024-07-19 23:45:07 +02:00
|
|
|
// models
|
2024-07-19 21:12:16 +02:00
|
|
|
const storageModel = new StorageModel();
|
2024-07-20 20:42:43 +02:00
|
|
|
const settingsModel = new SettingsModel(storageModel);
|
|
|
|
|
const connectionModel = new ConnectionModel(storageModel);
|
|
|
|
|
const chatListModel = new ChatListModel(
|
|
|
|
|
storageModel,
|
|
|
|
|
settingsModel,
|
|
|
|
|
connectionModel
|
|
|
|
|
);
|
2024-07-27 17:03:52 +02:00
|
|
|
const fileTransferModel = new FileTransferModel(storageModel, connectionModel);
|
2024-07-20 20:42:43 +02:00
|
|
|
|
2024-07-27 00:33:42 +02:00
|
|
|
// upgrade
|
|
|
|
|
new v1Upgrader(settingsModel, connectionModel, chatListModel);
|
|
|
|
|
|
2024-07-20 02:00:00 +02:00
|
|
|
// viewModels
|
2024-07-25 16:02:49 +02:00
|
|
|
const coreVieWModel = new CoreViewModel();
|
|
|
|
|
|
|
|
|
|
const storageViewModel = new StorageViewModel(coreVieWModel, storageModel);
|
|
|
|
|
const settingsViewModel = new SettingsViewModel(coreVieWModel, settingsModel);
|
|
|
|
|
const connectionViewModel = new ConnectionViewModel(
|
|
|
|
|
coreVieWModel,
|
|
|
|
|
connectionModel
|
|
|
|
|
);
|
2024-07-20 21:04:41 +02:00
|
|
|
const chatListViewModel = new ChatListViewModel(
|
2024-07-25 16:02:49 +02:00
|
|
|
coreVieWModel,
|
2024-07-20 21:04:41 +02:00
|
|
|
storageModel,
|
2024-07-24 01:19:44 +02:00
|
|
|
chatListModel,
|
2024-07-20 21:04:41 +02:00
|
|
|
settingsViewModel
|
|
|
|
|
);
|
2024-07-27 19:13:59 +02:00
|
|
|
const fileTransferViewModel = new FileTransferViewModel(
|
|
|
|
|
fileTransferModel,
|
|
|
|
|
chatListModel
|
|
|
|
|
);
|
2024-07-20 02:00:00 +02:00
|
|
|
|
2024-07-19 23:45:07 +02:00
|
|
|
// view
|
2024-07-20 23:20:57 +02:00
|
|
|
chatListViewModel.selectedChat.subscribe(() => {
|
|
|
|
|
document.body.toggleAttribute(
|
|
|
|
|
"showing-chat",
|
|
|
|
|
chatListViewModel.selectedChat.value != undefined
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
2024-07-21 02:49:04 +02:00
|
|
|
document.body.append(
|
|
|
|
|
<div id="background-wrapper">
|
|
|
|
|
<div id="sky"></div>
|
|
|
|
|
<div id="grass-1"></div>
|
|
|
|
|
<div id="grass-2"></div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
2024-07-20 02:18:15 +02:00
|
|
|
document
|
|
|
|
|
.querySelector("main")!
|
2024-07-20 02:30:45 +02:00
|
|
|
.append(
|
2024-07-21 17:55:53 +02:00
|
|
|
HomePage(
|
|
|
|
|
storageViewModel,
|
|
|
|
|
settingsViewModel,
|
|
|
|
|
connectionViewModel,
|
2024-07-27 19:13:59 +02:00
|
|
|
fileTransferViewModel,
|
2024-07-21 17:55:53 +02:00
|
|
|
chatListViewModel
|
|
|
|
|
),
|
2024-07-20 14:16:26 +02:00
|
|
|
ChatPageWrapper(chatListViewModel),
|
2024-07-21 17:55:53 +02:00
|
|
|
ConnectionModal(connectionViewModel),
|
2024-07-28 00:02:17 +02:00
|
|
|
DataTransferModalWrapper(fileTransferViewModel),
|
2024-07-21 17:55:53 +02:00
|
|
|
StorageModal(storageViewModel)
|
2024-07-22 13:09:33 +02:00
|
|
|
);
|