2024-07-20 16:28:00 +02:00
|
|
|
import * as React from "bloatless-react";
|
|
|
|
|
|
2024-07-23 15:41:03 +02:00
|
|
|
import ChatViewModel, {
|
|
|
|
|
ChatPageType,
|
|
|
|
|
} from "../../ViewModel/Chat/chatViewModel";
|
|
|
|
|
|
|
|
|
|
import { RibbonButton } from "./ribbonButton";
|
2024-07-20 16:28:00 +02:00
|
|
|
|
|
|
|
|
export function ChatViewToggleButton(
|
|
|
|
|
label: string,
|
|
|
|
|
icon: string,
|
|
|
|
|
page: ChatPageType,
|
|
|
|
|
chatViewModel: ChatViewModel
|
|
|
|
|
) {
|
|
|
|
|
function select() {
|
|
|
|
|
chatViewModel.selectedPage.value = page;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const isSelected = React.createProxyState(
|
|
|
|
|
[chatViewModel.selectedPage],
|
|
|
|
|
() => chatViewModel.selectedPage.value == page
|
|
|
|
|
);
|
|
|
|
|
|
2024-07-23 15:41:03 +02:00
|
|
|
return RibbonButton(label, icon, isSelected, select);
|
2024-07-20 16:28:00 +02:00
|
|
|
}
|