2024-07-20 14:16:26 +02:00
|
|
|
import "./homePage.css";
|
|
|
|
|
|
|
|
|
|
import * as React from "bloatless-react";
|
|
|
|
|
|
2026-04-08 14:02:12 +00:00
|
|
|
import ChatViewModel, { ChatPageTypes } from "../ViewModel/Chat/chatViewModel";
|
2024-07-20 16:28:00 +02:00
|
|
|
|
2024-07-25 19:32:46 +02:00
|
|
|
import { CalendarPage } from "./ChatPages/calendarPage";
|
2024-07-20 16:28:00 +02:00
|
|
|
import { ChatViewToggleButton } from "./Components/chatViewToggleButton";
|
2024-07-20 17:19:10 +02:00
|
|
|
import { MessagePage } from "./ChatPages/messagePage";
|
|
|
|
|
import { SettingsPage } from "./ChatPages/settingsPage";
|
2024-07-22 13:17:21 +02:00
|
|
|
import { TaskPage } from "./ChatPages/taskPage";
|
2026-04-09 16:48:22 +00:00
|
|
|
import CoreViewModel from "../ViewModel/Global/coreViewModel";
|
2026-04-14 13:15:38 +00:00
|
|
|
import { ViewController } from "./viewController";
|
2024-07-20 14:16:26 +02:00
|
|
|
|
2026-04-09 16:48:22 +00:00
|
|
|
export function ChatPage(
|
|
|
|
|
coreViewModel: CoreViewModel,
|
|
|
|
|
chatViewModel: ChatViewModel,
|
|
|
|
|
) {
|
2026-04-14 13:15:38 +00:00
|
|
|
ViewController.chatPages.items = React.createProxyState(
|
2026-04-01 08:29:39 +00:00
|
|
|
[chatViewModel.selectedPage],
|
|
|
|
|
() => {
|
|
|
|
|
switch (chatViewModel.selectedPage.value) {
|
2026-04-08 14:02:12 +00:00
|
|
|
case ChatPageTypes.Settings: {
|
2026-04-09 16:48:22 +00:00
|
|
|
return SettingsPage(
|
|
|
|
|
coreViewModel,
|
|
|
|
|
chatViewModel.settingsPageViewModel,
|
|
|
|
|
);
|
2026-04-01 08:29:39 +00:00
|
|
|
}
|
2026-04-08 14:02:12 +00:00
|
|
|
case ChatPageTypes.Tasks: {
|
2026-04-09 16:48:22 +00:00
|
|
|
return TaskPage(
|
|
|
|
|
coreViewModel,
|
|
|
|
|
chatViewModel.taskPageViewModel,
|
|
|
|
|
);
|
2026-04-01 08:29:39 +00:00
|
|
|
}
|
2026-04-08 14:02:12 +00:00
|
|
|
case ChatPageTypes.Calendar: {
|
2026-04-09 16:48:22 +00:00
|
|
|
return CalendarPage(
|
|
|
|
|
coreViewModel,
|
|
|
|
|
chatViewModel.calendarViewModel,
|
|
|
|
|
);
|
2026-04-01 08:29:39 +00:00
|
|
|
}
|
|
|
|
|
default: {
|
2026-04-09 16:48:22 +00:00
|
|
|
return MessagePage(
|
|
|
|
|
coreViewModel,
|
|
|
|
|
chatViewModel.messagePageViewModel,
|
|
|
|
|
);
|
2026-04-01 08:29:39 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
);
|
2024-07-20 17:19:10 +02:00
|
|
|
|
2026-04-01 19:00:16 +00:00
|
|
|
const marqueeContent = React.createProxyState(
|
|
|
|
|
[chatViewModel.notificationViewModel.marquee],
|
|
|
|
|
() => {
|
|
|
|
|
const value = chatViewModel.notificationViewModel.marquee.value;
|
|
|
|
|
if (value == undefined) return <span></span>;
|
|
|
|
|
return (
|
2026-04-02 19:22:10 +00:00
|
|
|
<span
|
|
|
|
|
on:click={
|
|
|
|
|
chatViewModel.notificationViewModel.openNotification
|
|
|
|
|
}
|
|
|
|
|
>
|
2026-04-01 19:00:16 +00:00
|
|
|
<b>{value.sender}</b>
|
|
|
|
|
<span class="secondary">{value.chat}: </span>
|
|
|
|
|
<span>{value.body}</span>
|
|
|
|
|
</span>
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
2026-04-01 08:29:39 +00:00
|
|
|
return (
|
|
|
|
|
<article
|
|
|
|
|
id="chat-page"
|
|
|
|
|
set:color={chatViewModel.displayedColor}
|
|
|
|
|
class="subtle-background"
|
|
|
|
|
>
|
|
|
|
|
<div>
|
|
|
|
|
<div id="ribbon">
|
|
|
|
|
<button
|
|
|
|
|
class="ghost"
|
2026-04-09 16:48:22 +00:00
|
|
|
aria-label={
|
|
|
|
|
coreViewModel.translations.chatPage
|
|
|
|
|
.closeChatAudioLabe
|
|
|
|
|
}
|
2026-04-01 08:29:39 +00:00
|
|
|
on:click={chatViewModel.close}
|
|
|
|
|
>
|
|
|
|
|
<span class="icon">close</span>
|
|
|
|
|
</button>
|
2026-04-01 08:38:40 +00:00
|
|
|
<button
|
|
|
|
|
class="danger"
|
2026-04-09 16:48:22 +00:00
|
|
|
aria-label={
|
|
|
|
|
coreViewModel.translations.general.restoreConnection
|
|
|
|
|
}
|
2026-04-01 08:38:40 +00:00
|
|
|
on:click={
|
|
|
|
|
chatViewModel.connectionViewModel
|
|
|
|
|
.showConnectionModal
|
|
|
|
|
}
|
|
|
|
|
toggle:hidden={
|
|
|
|
|
chatViewModel.connectionViewModel.isConnected
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
<span class="icon">signal_disconnected</span>
|
|
|
|
|
</button>
|
2024-07-20 16:28:00 +02:00
|
|
|
|
2026-04-01 19:00:16 +00:00
|
|
|
<span class="marquee" children:set={marqueeContent}></span>
|
|
|
|
|
|
|
|
|
|
<span class="navigation-buttons">
|
2026-04-01 08:29:39 +00:00
|
|
|
{ChatViewToggleButton(
|
2026-04-09 16:48:22 +00:00
|
|
|
coreViewModel.translations.chatPage.pages.calendar,
|
2026-04-01 08:29:39 +00:00
|
|
|
"calendar_month",
|
2026-04-08 14:02:12 +00:00
|
|
|
ChatPageTypes.Calendar,
|
2026-04-01 08:29:39 +00:00
|
|
|
chatViewModel,
|
|
|
|
|
)}
|
|
|
|
|
{ChatViewToggleButton(
|
2026-04-09 16:48:22 +00:00
|
|
|
coreViewModel.translations.chatPage.pages.tasks,
|
2026-04-01 08:29:39 +00:00
|
|
|
"task_alt",
|
2026-04-08 14:02:12 +00:00
|
|
|
ChatPageTypes.Tasks,
|
2026-04-01 08:29:39 +00:00
|
|
|
chatViewModel,
|
|
|
|
|
)}
|
|
|
|
|
{ChatViewToggleButton(
|
2026-04-09 16:48:22 +00:00
|
|
|
coreViewModel.translations.chatPage.pages.messages,
|
2026-04-01 08:29:39 +00:00
|
|
|
"forum",
|
2026-04-08 14:02:12 +00:00
|
|
|
ChatPageTypes.Messages,
|
2026-04-01 08:29:39 +00:00
|
|
|
chatViewModel,
|
|
|
|
|
)}
|
|
|
|
|
{ChatViewToggleButton(
|
2026-04-09 16:48:22 +00:00
|
|
|
coreViewModel.translations.chatPage.pages.settings,
|
2026-04-01 08:29:39 +00:00
|
|
|
"settings",
|
2026-04-08 14:02:12 +00:00
|
|
|
ChatPageTypes.Settings,
|
2026-04-01 08:29:39 +00:00
|
|
|
chatViewModel,
|
|
|
|
|
)}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
2026-04-14 09:20:44 +00:00
|
|
|
<div
|
|
|
|
|
id="main"
|
2026-04-14 13:15:38 +00:00
|
|
|
children:set={ViewController.chatPages.items}
|
2026-04-14 09:20:44 +00:00
|
|
|
></div>
|
2026-04-01 08:29:39 +00:00
|
|
|
</div>
|
|
|
|
|
</article>
|
|
|
|
|
);
|
2024-07-20 14:16:26 +02:00
|
|
|
}
|