refactor: move placeholder comp to comp registry
So we can have placeholder pages between impl'd pages
This commit is contained in:
parent
8d709be51a
commit
0d3b9370ca
2 changed files with 39 additions and 39 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue