better support for opening chat in floating window

This commit is contained in:
2026-08-28 14:15:57 +02:00
parent 8a66c3b064
commit 327270f3fa
14 changed files with 419 additions and 168 deletions
@@ -18,45 +18,35 @@ Item {
Component.onCompleted: {
if (ChatState.inChat) {
stackLoader.item?.push(chatList);
stackLoader.item?.push(chatContent, {
stack.push(chatList);
stack.push(chatContent, {
"chatData": ChatState.chatSession
});
} else
stackLoader.item?.push(chatList);
stack.push(chatList);
}
Loader {
id: stackLoader
active: !ChatState.isWindow || root.width <= (ChatState.screen.width / 4)
StackView {
id: stack
anchors.fill: parent
}
sourceComponent: StackView {
id: stack
IconButton {
anchors.left: parent.left
anchors.bottom: parent.bottom
icon: "open_in_new"
anchors.margins: Tokens.padding.small
isRound: true
padding: 8
font.pointSize: Math.round(18 * 1.2)
visible: !ChatState.isWindow
onClicked: {
Detach.create();
Visibilities.getForActive().sidebar = false;
}
}
Loader {
id: sidebarViewLoader
active: ChatState.isWindow && root.width > (ChatState.screen.width / 4)
anchors.fill: parent
sourceComponent: SidebarView {}
}
// IconButton {
// anchors.right: parent.right
// icon: "close"
// visible: !ChatState.isWindow
//
// onClicked: {
// Detach.create();
// Visibilities.getForActive().sidebar = false;
// }
// }
Component {
id: chatList
@@ -68,8 +58,8 @@ Item {
onDeleteChatRequest: chat => {
Chat.chats.remove(chat);
}
onLoadChatRequest: chat => {
stackLoader.item?.push(chatContent, {
onLoadChatRequest: (chat, index) => {
stack.push(chatContent, {
"chatData": chat
});
ChatState.inChat = true;
@@ -77,7 +67,7 @@ Item {
}
onNewChatRequest: {
const data = Chat.chats.insert();
stackLoader.item?.push(chatContent, {
stack.push(chatContent, {
"chatData": data
});
ChatState.inChat = true;
@@ -91,7 +81,7 @@ Item {
ChatContent {
onRequestClose: {
stackLoader.item?.pop();
stack.pop();
ChatState.inChat = false;
}
}