From 440d0a9017c68f09b871931c14f500f86132afaa Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Thu, 13 Oct 2022 15:02:40 -0400 Subject: [PATCH] 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 --- storybook/main.qml | 3 + storybook/pages/AboutViewPage.qml | 62 +++++++++++++++++++ storybook/qml.qrc | 1 + ui/app/AppLayouts/Profile/ProfileLayout.qml | 21 ++++++- ui/app/AppLayouts/Profile/views/AboutView.qml | 21 ++++--- ui/app/AppLayouts/Profile/views/qmldir | 1 + 6 files changed, 99 insertions(+), 10 deletions(-) create mode 100644 storybook/pages/AboutViewPage.qml create mode 100644 ui/app/AppLayouts/Profile/views/qmldir diff --git a/storybook/main.qml b/storybook/main.qml index f783ef4c2a..85a7a0e3b5 100644 --- a/storybook/main.qml +++ b/storybook/main.qml @@ -27,6 +27,9 @@ ApplicationWindow { ListElement { title: "LoginView" } + ListElement { + title: "AboutView" + } } SplitView { diff --git a/storybook/pages/AboutViewPage.qml b/storybook/pages/AboutViewPage.qml new file mode 100644 index 0000000000..81a74e2b60 --- /dev/null +++ b/storybook/pages/AboutViewPage.qml @@ -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 + } +} + diff --git a/storybook/qml.qrc b/storybook/qml.qrc index 44428d7dea..e0823d2e86 100644 --- a/storybook/qml.qrc +++ b/storybook/qml.qrc @@ -12,5 +12,6 @@ pages/CommunitiesPortalLayoutPage.qml pages/CommunitiesPortalModelEditor.qml pages/LoginViewPage.qml + pages/AboutViewPage.qml diff --git a/ui/app/AppLayouts/Profile/ProfileLayout.qml b/ui/app/AppLayouts/Profile/ProfileLayout.qml index 16a58b3099..cc31eb3110 100644 --- a/ui/app/AppLayouts/Profile/ProfileLayout.qml +++ b/ui/app/AppLayouts/Profile/ProfileLayout.qml @@ -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 { diff --git a/ui/app/AppLayouts/Profile/views/AboutView.qml b/ui/app/AppLayouts/Profile/views/AboutView.qml index 1e4f863aee..7c179f7db1 100644 --- a/ui/app/AppLayouts/Profile/views/AboutView.qml +++ b/ui/app/AppLayouts/Profile/views/AboutView.qml @@ -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 } diff --git a/ui/app/AppLayouts/Profile/views/qmldir b/ui/app/AppLayouts/Profile/views/qmldir new file mode 100644 index 0000000000..ce2f61e94e --- /dev/null +++ b/ui/app/AppLayouts/Profile/views/qmldir @@ -0,0 +1 @@ +AboutView 1.0 AboutView.qml