From 0d3b9370cae0804412735fcca9f68b1f3652f1c0 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sun, 7 Jun 2026 17:15:05 +1000 Subject: [PATCH] refactor: move placeholder comp to comp registry So we can have placeholder pages between impl'd pages --- modules/nexus/PageCompRegistry.qml | 38 ++++++++++++++++++++++++++++ modules/nexus/Pages.qml | 40 +----------------------------- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/modules/nexus/PageCompRegistry.qml b/modules/nexus/PageCompRegistry.qml index a4292df2..c5614a61 100644 --- a/modules/nexus/PageCompRegistry.qml +++ b/modules/nexus/PageCompRegistry.qml @@ -1,6 +1,10 @@ pragma Singleton import QtQuick +import QtQuick.Layouts +import Caelestia.Config +import qs.components +import qs.services import qs.modules.nexus.common import qs.modules.nexus.pages import qs.modules.nexus.pages.audio @@ -65,4 +69,38 @@ QtObject { } } ] + + readonly property Component placeholderComp: Component { + PlaceholderComp {} + } + + component PlaceholderComp: Item { + property NexusState nState // To avoid the warning from non-existent property + + ColumnLayout { + anchors.centerIn: parent + spacing: Tokens.padding.extraSmall + + MaterialIcon { + Layout.alignment: Qt.AlignHCenter + text: "handyman" + color: Colours.palette.m3outlineVariant + font: Tokens.font.icon.extraLarge + } + + StyledText { + Layout.alignment: Qt.AlignHCenter + text: qsTr("Page under construction") + color: Colours.palette.m3outlineVariant + font: Tokens.font.title.large + } + + StyledText { + Layout.alignment: Qt.AlignHCenter + text: qsTr("This page will be available in a future update.") + color: Colours.palette.m3outlineVariant + font: Tokens.font.body.large + } + } + } } diff --git a/modules/nexus/Pages.qml b/modules/nexus/Pages.qml index ab30bd50..655cd9cf 100644 --- a/modules/nexus/Pages.qml +++ b/modules/nexus/Pages.qml @@ -1,10 +1,6 @@ -pragma ComponentBehavior: Bound - import QtQuick -import QtQuick.Layouts import Caelestia.Config import qs.components -import qs.services import qs.modules.nexus Item { @@ -20,7 +16,7 @@ Item { if (currentItem) currentItem.destroy(); - const comp = PageCompRegistry.pageComps[idx] ?? placeholderComp; + const comp = PageCompRegistry.pageComps[idx] ?? PageCompRegistry.placeholderComp; const incubator = comp.incubateObject(container, { nState }); @@ -96,38 +92,4 @@ Item { } } } - - Component { - id: placeholderComp - - Item { - property NexusState nState // To avoid the warning from non-existent property - - ColumnLayout { - anchors.centerIn: parent - spacing: Tokens.padding.extraSmall - - MaterialIcon { - Layout.alignment: Qt.AlignHCenter - text: "handyman" - color: Colours.palette.m3outlineVariant - font: Tokens.font.icon.extraLarge - } - - StyledText { - Layout.alignment: Qt.AlignHCenter - text: qsTr("Page under construction") - color: Colours.palette.m3outlineVariant - font: Tokens.font.title.large - } - - StyledText { - Layout.alignment: Qt.AlignHCenter - text: qsTr("This page will be available in a future update.") - color: Colours.palette.m3outlineVariant - font: Tokens.font.body.large - } - } - } - } }