chore(@storybook): add about view to storybook, refactor about view to use calls from store instead of global

chore(@storybook): add about view to storybook, refactor about view to use calls from store instead of global

fix storybook menu
This commit is contained in:
Iuri Matias 2022-10-13 15:02:40 -04:00
parent 7a407662e2
commit 440d0a9017
6 changed files with 99 additions and 10 deletions

View File

@ -27,6 +27,9 @@ ApplicationWindow {
ListElement {
title: "LoginView"
}
ListElement {
title: "AboutView"
}
}
SplitView {

View File

@ -0,0 +1,62 @@
import QtQuick 2.14
import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14
import AppLayouts.Profile.views 1.0
import Storybook 1.0
import utils 1.0
SplitView {
Logs { id: logs }
SplitView {
orientation: Qt.Vertical
SplitView.fillWidth: true
AboutView {
SplitView.fillWidth: true
SplitView.fillHeight: true
contentWidth: parent.width
store: QtObject {
function checkForUpdates() {
logs.logEvent("store::checkForUpdates")
}
function getCurrentVersion() {
return "storybook-version"
}
function getReleaseNotes() {
logs.logEvent("store::getReleaseNotes")
}
function openLink(url) {
logs.logEvent("store::openLink", ["url"], arguments)
}
}
}
LogsAndControlsPanel {
id: logsAndControlsPanel
SplitView.minimumHeight: 100
SplitView.preferredHeight: 200
logsView.logText: logs.logText
}
}
Control {
SplitView.minimumWidth: 300
SplitView.preferredWidth: 300
font.pixelSize: 13
// model editor will go here
}
}

View File

@ -12,5 +12,6 @@
<file>pages/CommunitiesPortalLayoutPage.qml</file>
<file>pages/CommunitiesPortalModelEditor.qml</file>
<file>pages/LoginViewPage.qml</file>
<file>pages/AboutViewPage.qml</file>
</qresource>
</RCC>

View File

@ -211,11 +211,26 @@ StatusSectionLayout {
AboutView {
implicitWidth: parent.width
implicitHeight: parent.height
store: root.store
globalStore: root.globalStore
sectionTitle: root.store.getNameForSubsection(Constants.settingsSubsection.about)
contentWidth: d.contentWidth
store: QtObject {
function checkForUpdates() {
return root.store.checkForUpdates()
}
function getCurrentVersion() {
return root.store.getCurrentVersion()
}
function getReleaseNotes() {
console.log("TODO: getReleaseNotes")
}
function openLink(url) {
Global.openLink(url)
}
}
}
CommunitiesView {

View File

@ -7,7 +7,6 @@ import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
import StatusQ.Components 0.1
import utils 1.0
import shared 1.0
import shared.status 1.0
@ -16,7 +15,6 @@ SettingsContentBase {
id: root
property var store
property var globalStore
titleRowComponentLoader.sourceComponent: StatusButton {
size: StatusBaseButton.Size.Small
@ -65,6 +63,9 @@ SettingsContentBase {
size: StatusBaseButton.Size.Small
icon.name: "info"
text: qsTr("Release Notes")
onClicked: {
root.store.getReleaseNotes()
}
}
} // Column
@ -99,7 +100,7 @@ SettingsContentBase {
text: qsTr("Status Desktop")
icon.width: 0
onClicked: {
Global.openLink("https://github.com/status-im/status-desktop")
root.store.openLink("https://github.com/status-im/status-desktop")
}
}
@ -110,7 +111,7 @@ SettingsContentBase {
text: qsTr("Status Go")
icon.width: 0
onClicked: {
Global.openLink("https://github.com/status-im/status-go")
root.store.openLink("https://github.com/status-im/status-go")
}
}
@ -121,7 +122,7 @@ SettingsContentBase {
text: qsTr("StatusQ")
icon.width: 0
onClicked: {
Global.openLink("https://github.com/status-im/statusq")
root.store.openLink("https://github.com/status-im/statusq")
}
}
@ -132,7 +133,7 @@ SettingsContentBase {
text: qsTr("go-waku")
icon.width: 0
onClicked: {
Global.openLink("https://github.com/status-im/go-waku")
root.store.openLink("https://github.com/status-im/go-waku")
}
}
}
@ -154,6 +155,9 @@ SettingsContentBase {
rightPadding: Style.current.padding
text: qsTr("Terms of Use")
icon.width: 0
onClicked: {
root.store.openLink("https://status.im/terms-of-use/")
}
}
StatusFlatButton {
@ -163,7 +167,7 @@ SettingsContentBase {
text: qsTr("Privacy Policy")
icon.width: 0
onClicked: {
Global.openLink("https://status.im/privacy-policy/")
root.store.openLink("https://status.im/privacy-policy/")
}
}
@ -173,6 +177,9 @@ SettingsContentBase {
rightPadding: Style.current.padding
text: qsTr("Software License")
icon.width: 0
onClicked: {
root.store.openLink("https://github.com/status-im/status-desktop/blob/master/LICENSE.md")
}
}
} // Column
}

View File

@ -0,0 +1 @@
AboutView 1.0 AboutView.qml