2024-07-20 14:16:26 +02:00
|
|
|
import "./homePage.css";
|
|
|
|
|
|
|
|
|
|
import * as React from "bloatless-react";
|
|
|
|
|
|
2024-07-22 20:02:13 +02:00
|
|
|
import ChatViewModel, { ChatPageType } 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";
|
2024-07-20 14:16:26 +02:00
|
|
|
import { translations } from "./translations";
|
|
|
|
|
|
|
|
|
|
export function ChatPage(chatViewModel: ChatViewModel) {
|
2026-04-01 08:29:39 +00:00
|
|
|
const mainContent = React.createProxyState(
|
|
|
|
|
[chatViewModel.selectedPage],
|
|
|
|
|
() => {
|
|
|
|
|
chatViewModel.closeSubPages();
|
2024-07-20 17:19:10 +02:00
|
|
|
|
2026-04-01 08:29:39 +00:00
|
|
|
switch (chatViewModel.selectedPage.value) {
|
|
|
|
|
case ChatPageType.Settings: {
|
|
|
|
|
return SettingsPage(chatViewModel.settingsPageViewModel);
|
|
|
|
|
}
|
|
|
|
|
case ChatPageType.Tasks: {
|
|
|
|
|
return TaskPage(chatViewModel.taskPageViewModel);
|
|
|
|
|
}
|
|
|
|
|
case ChatPageType.Calendar: {
|
|
|
|
|
return CalendarPage(chatViewModel.calendarViewModel);
|
|
|
|
|
}
|
|
|
|
|
default: {
|
|
|
|
|
return MessagePage(chatViewModel.messagePageViewModel);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
);
|
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"
|
|
|
|
|
aria-label={translations.chatPage.closeChatAudioLabe}
|
|
|
|
|
on:click={chatViewModel.close}
|
|
|
|
|
>
|
|
|
|
|
<span class="icon">close</span>
|
|
|
|
|
</button>
|
2026-04-01 08:38:40 +00:00
|
|
|
<button
|
|
|
|
|
class="danger"
|
|
|
|
|
aria-label={translations.general.restoreConnection}
|
|
|
|
|
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(
|
|
|
|
|
translations.chatPage.pages.calendar,
|
|
|
|
|
"calendar_month",
|
|
|
|
|
ChatPageType.Calendar,
|
|
|
|
|
chatViewModel,
|
|
|
|
|
)}
|
|
|
|
|
{ChatViewToggleButton(
|
|
|
|
|
translations.chatPage.pages.tasks,
|
|
|
|
|
"task_alt",
|
|
|
|
|
ChatPageType.Tasks,
|
|
|
|
|
chatViewModel,
|
|
|
|
|
)}
|
|
|
|
|
{ChatViewToggleButton(
|
|
|
|
|
translations.chatPage.pages.messages,
|
|
|
|
|
"forum",
|
|
|
|
|
ChatPageType.Messages,
|
|
|
|
|
chatViewModel,
|
|
|
|
|
)}
|
|
|
|
|
{ChatViewToggleButton(
|
|
|
|
|
translations.chatPage.pages.settings,
|
|
|
|
|
"settings",
|
|
|
|
|
ChatPageType.Settings,
|
|
|
|
|
chatViewModel,
|
|
|
|
|
)}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="main" children:set={mainContent}></div>
|
|
|
|
|
</div>
|
|
|
|
|
</article>
|
|
|
|
|
);
|
2024-07-20 14:16:26 +02:00
|
|
|
}
|