mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 22:04:56 +00:00
191 files reformatted across views, components, widgets, hybrid, contexts. New components: CCreateSchemaDialog, CAddFieldDialog, CAdminContentPanel. JS helpers: connBadgeStatus/Text, adminStats, exampleLabels, onLevelClicked. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
81 lines
2.4 KiB
QML
81 lines
2.4 KiB
QML
import QtQuick
|
|
import QtQuick.Layouts
|
|
import QmlComponents 1.0
|
|
|
|
Rectangle {
|
|
id: root
|
|
required property var modelData
|
|
required property int index
|
|
signal editClicked(int uid)
|
|
signal deleteClicked(int uid)
|
|
|
|
function roleColor(role) {
|
|
if (role === "supergod") return "#e040fb"
|
|
if (role === "god") return "#ff9800"
|
|
if (role === "admin") return "#2196f3"
|
|
return "#4caf50"
|
|
}
|
|
function statusString(s) { return s === "active" ? "success" : "warning" }
|
|
|
|
height: 56
|
|
color: index % 2 === 0
|
|
? "transparent"
|
|
: Qt.rgba(Theme.surface.r, Theme.surface.g, Theme.surface.b, 0.3)
|
|
|
|
RowLayout {
|
|
anchors.fill: parent
|
|
anchors.leftMargin: 12; anchors.rightMargin: 12
|
|
spacing: 8
|
|
|
|
Item {
|
|
Layout.preferredWidth: 56; Layout.preferredHeight: 40
|
|
CAvatar {
|
|
anchors.centerIn: parent
|
|
initials: modelData.username.substring(0, 2).toUpperCase()
|
|
}
|
|
}
|
|
CText {
|
|
variant: "body1"; text: modelData.username
|
|
Layout.preferredWidth: 120; elide: Text.ElideRight
|
|
}
|
|
CText {
|
|
variant: "body2"; text: modelData.email
|
|
Layout.fillWidth: true; elide: Text.ElideRight
|
|
}
|
|
Item {
|
|
Layout.preferredWidth: 100; Layout.preferredHeight: 40
|
|
CBadge {
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
text: modelData.role; badgeColor: root.roleColor(modelData.role)
|
|
}
|
|
}
|
|
CText {
|
|
variant: "body2"; text: "L" + modelData.level
|
|
Layout.preferredWidth: 50
|
|
}
|
|
Item {
|
|
Layout.preferredWidth: 90; Layout.preferredHeight: 40
|
|
CStatusBadge {
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
status: root.statusString(modelData.status)
|
|
text: modelData.status
|
|
}
|
|
}
|
|
CText {
|
|
variant: "caption"; text: modelData.created
|
|
Layout.preferredWidth: 100
|
|
}
|
|
FlexRow {
|
|
Layout.preferredWidth: 140; spacing: 6
|
|
CButton {
|
|
text: "Edit"; variant: "ghost"; size: "sm"
|
|
onClicked: root.editClicked(modelData.uid)
|
|
}
|
|
CButton {
|
|
text: "Delete"; variant: "danger"; size: "sm"
|
|
onClicked: root.deleteClicked(modelData.uid)
|
|
}
|
|
}
|
|
}
|
|
}
|