Files
z-bar-qt/Modules/Notifications/Sidebar/Chat/ChatList.qml
T

80 lines
1.5 KiB
QML

pragma ComponentBehavior: Bound
import Quickshell
import QtQuick
import QtQuick.Layouts
import ZShell.Llm
import ZShell.Config
import qs.Services
import qs.Components
Item {
id: root
property alias list: list
property alias model: list.model
signal deleteChatRequest(content: ChatSession)
signal loadChatRequest(content: ChatSession)
signal newChatRequest
CustomText {
id: header
anchors.left: parent.left
anchors.margins: Tokens.padding.extraSmall
anchors.right: parent.right
anchors.top: parent.top
color: Colors.palette.m3outline
font.family: "CaskaydiaCove NF"
font.pointSize: 13
font.weight: 500
text: qsTr("%1 Chat%2").arg(list.count).arg(list.count > 1 ? "s" : "")
}
CustomListView {
id: list
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.top: header.bottom
anchors.topMargin: Tokens.spacing.medium
cacheBuffer: height * 2
clip: true
spacing: Tokens.spacing.medium
delegate: ChatDelegate {
id: chat
implicitWidth: ListView.view.width
onClicked: content => root.loadChatRequest(content)
onRemove: content => root.deleteChatRequest(content)
}
}
IconButton {
id: newChatBtn
anchors.bottom: parent.bottom
anchors.margins: Tokens.padding.small
anchors.right: parent.right
font.pointSize: Math.round(18 * 1.2)
icon: "add"
padding: 8
radius: Tokens.rounding.full
onClicked: {
root.newChatRequest();
}
Elevation {
anchors.fill: parent
level: newChatBtn.stateLayer.containsMouse ? 4 : 3
radius: parent.radius
z: -1
}
}
}