mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
- Fix CCard content nesting (no anchors.fill inside CCard) - chipColor/badgeColor string→Theme color fixes - anchors-in-layout warnings resolved - Tonal surfaces, proper MD3 spacing - CButton replaces hand-rolled Rectangle buttons - All 6 views preserved with full functionality Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
195 lines
7.3 KiB
QML
195 lines
7.3 KiB
QML
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
import QmlComponents 1.0
|
|
import "qmllib/dbal"
|
|
|
|
Rectangle {
|
|
id: dashRoot
|
|
color: Theme.background
|
|
|
|
// ── DBAL connection ──────────────────────────────────────────
|
|
DBALProvider { id: dbal }
|
|
|
|
property var healthData: ({})
|
|
property bool dbalOnline: dbal.connected
|
|
|
|
// ── MD3 palette ──────────────────────────────────────────────
|
|
readonly property bool isDark: Theme.mode === "dark"
|
|
readonly property color surfaceContainer: isDark ? Qt.rgba(1, 1, 1, 0.05) : Qt.rgba(0.31, 0.31, 0.44, 0.06)
|
|
readonly property color surfaceContainerHigh: isDark ? Qt.rgba(1, 1, 1, 0.08) : Qt.rgba(0.31, 0.31, 0.44, 0.10)
|
|
readonly property color onSurface: Theme.text
|
|
readonly property color onSurfaceVariant: Theme.textSecondary
|
|
|
|
function refreshDBAL() {
|
|
dbal.ping(function(success, error) {
|
|
if (success) {
|
|
dbal.execute("health", {}, function(result, err) {
|
|
if (result) healthData = result;
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
Component.onCompleted: refreshDBAL()
|
|
|
|
ScrollView {
|
|
anchors.fill: parent
|
|
clip: true
|
|
contentWidth: availableWidth
|
|
|
|
ColumnLayout {
|
|
width: parent.width
|
|
spacing: 0
|
|
|
|
Item { Layout.preferredHeight: 24 }
|
|
|
|
// ── Welcome header ───────────────────────────────────
|
|
CCard {
|
|
Layout.fillWidth: true
|
|
Layout.leftMargin: 24
|
|
Layout.rightMargin: 24
|
|
variant: "filled"
|
|
|
|
CText {
|
|
Layout.fillWidth: true
|
|
variant: "h3"
|
|
text: "Welcome back, " + appWindow.currentUser
|
|
}
|
|
|
|
Item { Layout.preferredHeight: 4 }
|
|
|
|
CText {
|
|
Layout.fillWidth: true
|
|
variant: "body1"
|
|
text: "Level " + appWindow.currentLevel + " \u00b7 " + appWindow.currentRole + " access"
|
|
color: onSurfaceVariant
|
|
}
|
|
|
|
Item { Layout.preferredHeight: 12 }
|
|
|
|
CButton {
|
|
text: dbal.loading ? "Refreshing..." : "Refresh"
|
|
variant: "ghost"
|
|
size: "sm"
|
|
enabled: !dbal.loading
|
|
onClicked: refreshDBAL()
|
|
}
|
|
}
|
|
|
|
Item { Layout.preferredHeight: 16 }
|
|
|
|
// ── Stats row ────────────────────────────────────────
|
|
FlexRow {
|
|
Layout.fillWidth: true
|
|
Layout.leftMargin: 24
|
|
Layout.rightMargin: 24
|
|
spacing: 16
|
|
|
|
Repeater {
|
|
model: [
|
|
{ title: "DBAL Status", value: dbalOnline ? "Healthy" : "Offline", status: dbalOnline ? "success" : "error" },
|
|
{ title: "Packages", value: "20", status: "info" },
|
|
{ title: "Active Users", value: "4", status: "info" },
|
|
{ title: "Uptime", value: "99.9%", status: "success" }
|
|
]
|
|
delegate: CCard {
|
|
Layout.fillWidth: true
|
|
variant: "outlined"
|
|
|
|
CText {
|
|
Layout.fillWidth: true
|
|
variant: "caption"
|
|
text: modelData.title
|
|
color: onSurfaceVariant
|
|
}
|
|
|
|
Item { Layout.preferredHeight: 4 }
|
|
|
|
CText {
|
|
Layout.fillWidth: true
|
|
variant: "h3"
|
|
text: modelData.value
|
|
}
|
|
|
|
Item { Layout.preferredHeight: 8 }
|
|
|
|
CStatusBadge {
|
|
status: modelData.status
|
|
text: modelData.status === "success" ? "Online" : "Active"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Item { Layout.preferredHeight: 16 }
|
|
|
|
// ── Recent activity ──────────────────────────────────
|
|
CCard {
|
|
Layout.fillWidth: true
|
|
Layout.leftMargin: 24
|
|
Layout.rightMargin: 24
|
|
variant: "filled"
|
|
|
|
CText {
|
|
Layout.fillWidth: true
|
|
variant: "h4"
|
|
text: "Recent Activity"
|
|
}
|
|
|
|
Item { Layout.preferredHeight: 8 }
|
|
|
|
CDivider { Layout.fillWidth: true }
|
|
|
|
Item { Layout.preferredHeight: 8 }
|
|
|
|
Repeater {
|
|
model: [
|
|
{ action: "Package installed", detail: "material_ui v2.1.0", time: "2 min ago" },
|
|
{ action: "User logged in", detail: "admin", time: "5 min ago" },
|
|
{ action: "Workflow executed", detail: "on_user_created", time: "12 min ago" },
|
|
{ action: "Schema updated", detail: "forum entity", time: "1 hr ago" },
|
|
{ action: "Seed data loaded", detail: "5 namespaces", time: "2 hr ago" }
|
|
]
|
|
delegate: CListItem {
|
|
Layout.fillWidth: true
|
|
title: modelData.action
|
|
subtitle: modelData.detail + " \u00b7 " + modelData.time
|
|
}
|
|
}
|
|
}
|
|
|
|
Item { Layout.preferredHeight: 16 }
|
|
|
|
// ── Quick actions ────────────────────────────────────
|
|
CCard {
|
|
Layout.fillWidth: true
|
|
Layout.leftMargin: 24
|
|
Layout.rightMargin: 24
|
|
variant: "filled"
|
|
|
|
CText {
|
|
Layout.fillWidth: true
|
|
variant: "h4"
|
|
text: "Quick Actions"
|
|
}
|
|
|
|
Item { Layout.preferredHeight: 12 }
|
|
|
|
FlexRow {
|
|
Layout.fillWidth: true
|
|
spacing: 10
|
|
CButton { text: "Forum"; variant: "default"; onClicked: appWindow.currentView = "forum" }
|
|
CButton { text: "Gallery"; variant: "default"; onClicked: appWindow.currentView = "gallery" }
|
|
CButton { text: "Guestbook"; variant: "default"; onClicked: appWindow.currentView = "guestbook" }
|
|
CButton { text: "Blog"; variant: "default"; onClicked: appWindow.currentView = "blog" }
|
|
CButton { text: "Profile"; variant: "ghost"; onClicked: appWindow.currentView = "profile" }
|
|
}
|
|
}
|
|
|
|
// Bottom spacer
|
|
Item { Layout.preferredHeight: 24 }
|
|
}
|
|
}
|
|
}
|