2026-04-18 11:55:01 +00:00
|
|
|
import "./homePage.css";
|
|
|
|
|
import { StringToOption } from "./Components/option";
|
|
|
|
|
import { HomePageButton } from "./Components/homePageButton";
|
2024-07-20 14:16:26 +02:00
|
|
|
import { ChatViewModelToChatEntry } from "./Components/chatEntry";
|
2026-09-23 00:09:09 +02:00
|
|
|
import * as React from "../react";
|
2024-07-22 19:52:08 +02:00
|
|
|
import StorageViewModel from "../ViewModel/Global/storageViewModel";
|
2026-04-18 11:55:01 +00:00
|
|
|
import SettingsViewModel from "../ViewModel/Global/settingsViewModel";
|
|
|
|
|
import FileTransferViewModel from "../ViewModel/Global/fileTransferViewModel";
|
2026-04-08 09:56:37 +00:00
|
|
|
import CoreViewModel from "../ViewModel/Global/coreViewModel";
|
2026-04-18 11:55:01 +00:00
|
|
|
import ConnectionViewModel from "../ViewModel/Global/connectionViewModel";
|
|
|
|
|
import ChatListViewModel from "../ViewModel/Chat/chatListViewModel";
|
2024-07-19 23:45:07 +02:00
|
|
|
|
2024-07-20 02:18:15 +02:00
|
|
|
export function HomePage(
|
2026-04-09 16:48:22 +00:00
|
|
|
coreViewModel: CoreViewModel,
|
2026-04-01 08:29:39 +00:00
|
|
|
storageViewModel: StorageViewModel,
|
|
|
|
|
settingsViewModel: SettingsViewModel,
|
|
|
|
|
connectionViewModel: ConnectionViewModel,
|
|
|
|
|
fileTransferViewModel: FileTransferViewModel,
|
|
|
|
|
chatListViewModel: ChatListViewModel,
|
2024-07-20 02:18:15 +02:00
|
|
|
) {
|
2026-09-30 13:40:40 +02:00
|
|
|
const greeting = React.createProxyState([settingsViewModel.username], ()=>coreViewModel.translations.homePage.greeting(settingsViewModel.username.value));
|
|
|
|
|
|
2026-04-01 08:29:39 +00:00
|
|
|
// sections
|
|
|
|
|
const overviewSection = (
|
2026-09-26 23:32:38 +02:00
|
|
|
<div id="overview-section">
|
|
|
|
|
<label class="tile flex-no">
|
|
|
|
|
<span class="icon">cell_tower</span>
|
|
|
|
|
<div>
|
|
|
|
|
<span>
|
|
|
|
|
{coreViewModel.translations.homePage.serverAddress}
|
|
|
|
|
</span>
|
|
|
|
|
<input
|
|
|
|
|
list="previous-connection-list"
|
|
|
|
|
placeholder={
|
|
|
|
|
coreViewModel.translations.homePage
|
|
|
|
|
.serverAddressPlaceholder
|
|
|
|
|
}
|
|
|
|
|
bind:value={connectionViewModel.serverAddressInput}
|
|
|
|
|
on:enter={connectionViewModel.connect}
|
|
|
|
|
></input>
|
|
|
|
|
<datalist
|
|
|
|
|
hidden
|
|
|
|
|
id="previous-connection-list"
|
|
|
|
|
children:append={[
|
|
|
|
|
connectionViewModel.previousAddresses,
|
|
|
|
|
StringToOption,
|
|
|
|
|
]}
|
|
|
|
|
></datalist>
|
|
|
|
|
</div>
|
|
|
|
|
</label>
|
2026-09-24 22:07:36 +02:00
|
|
|
|
2026-09-26 23:32:38 +02:00
|
|
|
<div class="flex-row">
|
|
|
|
|
<button
|
|
|
|
|
class="danger flex justify-center"
|
|
|
|
|
aria-label={
|
|
|
|
|
coreViewModel.translations.homePage.disconnectAudioLabel
|
|
|
|
|
}
|
|
|
|
|
on:click={connectionViewModel.disconnect}
|
|
|
|
|
toggle:disabled={connectionViewModel.cannotDisonnect}
|
2026-09-29 22:24:34 +02:00
|
|
|
ctkeystroke="x"
|
2026-09-26 23:32:38 +02:00
|
|
|
>
|
|
|
|
|
<span class="icon">link_off</span>
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
class="flex justify-center"
|
|
|
|
|
aria-label={
|
|
|
|
|
coreViewModel.translations.homePage
|
|
|
|
|
.manageConnectionsAudioLabel
|
|
|
|
|
}
|
|
|
|
|
on:click={connectionViewModel.showConnectionModal}
|
|
|
|
|
toggle:disabled={
|
|
|
|
|
connectionViewModel.hasNoPreviousConnections
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
<span class="icon">history</span>
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
class="primary flex justify-center"
|
|
|
|
|
aria-label={
|
|
|
|
|
coreViewModel.translations.homePage.connectAudioLabel
|
|
|
|
|
}
|
|
|
|
|
on:click={connectionViewModel.connect}
|
|
|
|
|
toggle:disabled={connectionViewModel.cannotConnect}
|
2026-09-29 22:24:34 +02:00
|
|
|
ctkeystroke="c"
|
2026-09-26 23:32:38 +02:00
|
|
|
>
|
|
|
|
|
<span class="icon">link</span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2026-09-24 22:07:36 +02:00
|
|
|
|
2026-09-26 23:32:38 +02:00
|
|
|
<hr></hr>
|
2026-09-24 22:07:36 +02:00
|
|
|
|
2026-09-26 23:32:38 +02:00
|
|
|
{HomePageButton(
|
|
|
|
|
settingsViewModel.showSettingsModal,
|
|
|
|
|
coreViewModel.translations.homePage.settingsButton,
|
|
|
|
|
"settings",
|
2026-09-29 22:24:34 +02:00
|
|
|
",",
|
2026-09-26 23:32:38 +02:00
|
|
|
)}
|
|
|
|
|
{HomePageButton(
|
|
|
|
|
fileTransferViewModel.showDirectionSelectionModal,
|
|
|
|
|
coreViewModel.translations.homePage.transferDataButton,
|
|
|
|
|
"sync_alt",
|
2026-09-29 22:24:34 +02:00
|
|
|
"t",
|
2026-09-26 23:32:38 +02:00
|
|
|
)}
|
|
|
|
|
{HomePageButton(
|
|
|
|
|
storageViewModel.showStorageModal,
|
|
|
|
|
coreViewModel.translations.homePage.manageStorageButton,
|
|
|
|
|
"hard_drive",
|
2026-09-29 22:24:34 +02:00
|
|
|
"e",
|
2026-09-26 23:32:38 +02:00
|
|
|
)}
|
2026-09-24 22:07:36 +02:00
|
|
|
|
2026-09-26 23:32:38 +02:00
|
|
|
<button
|
|
|
|
|
class="primary"
|
|
|
|
|
on:click={coreViewModel.update}
|
|
|
|
|
toggle:hidden={coreViewModel.noUpdateAvailable}
|
|
|
|
|
>
|
|
|
|
|
<span subscribe:innerText={coreViewModel.updateText}></span>
|
|
|
|
|
<span class="icon">update</span>
|
|
|
|
|
</button>
|
2026-09-30 13:40:40 +02:00
|
|
|
|
|
|
|
|
<hr class="mobile-only"></hr>
|
2026-09-26 23:32:38 +02:00
|
|
|
</div>
|
|
|
|
|
);
|
2026-09-24 22:07:36 +02:00
|
|
|
|
2026-09-26 23:32:38 +02:00
|
|
|
const chatSection = (
|
|
|
|
|
<div id="chat-section">
|
|
|
|
|
<div class="flex-row width-input">
|
|
|
|
|
<input
|
|
|
|
|
placeholder={
|
|
|
|
|
coreViewModel.translations.homePage.addChatPlaceholder
|
|
|
|
|
}
|
|
|
|
|
aria-label={
|
|
|
|
|
coreViewModel.translations.homePage.addChatAudioLabel
|
|
|
|
|
}
|
|
|
|
|
bind:value={chatListViewModel.newChatPrimaryChannel}
|
|
|
|
|
on:enter={chatListViewModel.createChat}
|
|
|
|
|
></input>
|
|
|
|
|
<button
|
|
|
|
|
class="primary"
|
|
|
|
|
aria-label={
|
|
|
|
|
coreViewModel.translations.homePage.addChatButton
|
|
|
|
|
}
|
|
|
|
|
on:click={chatListViewModel.createChat}
|
|
|
|
|
toggle:disabled={chatListViewModel.cannotCreateChat}
|
|
|
|
|
>
|
|
|
|
|
<span class="icon">add</span>
|
|
|
|
|
</button>
|
2026-09-30 13:40:40 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<hr></hr>
|
2026-09-24 22:07:36 +02:00
|
|
|
|
2026-09-26 23:32:38 +02:00
|
|
|
<div
|
|
|
|
|
id="chat-grid"
|
|
|
|
|
children:append={[
|
|
|
|
|
chatListViewModel.chatViewModels,
|
|
|
|
|
ChatViewModelToChatEntry,
|
|
|
|
|
]}
|
2026-09-30 13:40:40 +02:00
|
|
|
></div>
|
2026-09-26 23:32:38 +02:00
|
|
|
</div>
|
|
|
|
|
);
|
2026-09-24 22:07:36 +02:00
|
|
|
|
2026-09-26 23:32:38 +02:00
|
|
|
// final
|
|
|
|
|
return (
|
2026-09-30 13:40:40 +02:00
|
|
|
<article id="home-page">
|
|
|
|
|
<h1 subscribe:innerText={greeting}></h1>
|
2026-09-26 23:32:38 +02:00
|
|
|
<div>
|
|
|
|
|
{overviewSection}
|
|
|
|
|
{chatSection}
|
|
|
|
|
</div>
|
|
|
|
|
</article>
|
2026-04-01 08:29:39 +00:00
|
|
|
);
|
2024-07-19 23:45:07 +02:00
|
|
|
}
|