From fbccb319602d723c5c1630de3bffe2996858cc7d Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Thu, 13 Oct 2022 16:56:25 -0400 Subject: [PATCH] chore(@storybook): add language & currency settings view to storybook chore(@storybook): add language & currency settings view to storybook chore(@storybook): add language & currency settings view to storybook fix storybook menu remove qsTr --- storybook/main.qml | 15 +-- .../pages/LanguageCurrencySettingsPage.qml | 113 ++++++++++++++++++ ui/app/AppLayouts/Profile/stores/qmldir | 1 + ui/app/AppLayouts/Profile/views/qmldir | 1 + 4 files changed, 118 insertions(+), 12 deletions(-) create mode 100644 storybook/pages/LanguageCurrencySettingsPage.qml create mode 100644 ui/app/AppLayouts/Profile/stores/qmldir diff --git a/storybook/main.qml b/storybook/main.qml index 540e690cb7..671a872eb7 100644 --- a/storybook/main.qml +++ b/storybook/main.qml @@ -44,6 +44,9 @@ ApplicationWindow { ListElement { title: "AboutView" } + ListElement { + title: "LanguageCurrencySettings" + } } SplitView { @@ -97,18 +100,6 @@ ApplicationWindow { onPageSelected: root.currentPage = page } - - StatusNavigationListItem { - title: "AboutView" - selected: viewLoader.source.toString().includes(title) - onClicked: mainPageView.page(title); - } - - StatusNavigationListItem { - title: "AboutView" - selected: viewLoader.source.toString().includes(title) - onClicked: mainPageView.page(title); - } } } diff --git a/storybook/pages/LanguageCurrencySettingsPage.qml b/storybook/pages/LanguageCurrencySettingsPage.qml new file mode 100644 index 0000000000..9b2cecc2af --- /dev/null +++ b/storybook/pages/LanguageCurrencySettingsPage.qml @@ -0,0 +1,113 @@ +import QtQuick 2.14 +import QtQuick.Controls 2.14 +import QtQuick.Layouts 1.14 + +import AppLayouts.Profile.views 1.0 +import AppLayouts.Profile.stores 1.0 + +import Storybook 1.0 + +import utils 1.0 + +SplitView { + Logs { id: logs } + + SplitView { + orientation: Qt.Vertical + SplitView.fillWidth: true + + LanguageView { + SplitView.fillWidth: true + SplitView.fillHeight: true + contentWidth: parent.width + + languageStore: LanguageStore { + readonly property string currentLanguage: "en" + + readonly property ListModel languageModel: ListModel { + ListElement { + locale: "ar" + name: "Arabic" + shortName: "العربية" + flag: "🇸🇦" + state: 0 + } + ListElement { + locale: "en" + name: "English" + shortName: "English" + flag: "🏴󠁧󠁢󠁥󠁮󠁧󠁿" + state: 2 + } + } + + function changeLanguage(locale) { + logs.logEvent("languageStore::changeLanguage", ["locale"], arguments) + } + + function setIsDDMMYYDateFormat(isDDMMYYDateFormat) { + logs.logEvent("languageStore::setIsDDMMYYDateFormat", ["isDDMMYYDateFormat"], arguments) + } + + function setIs24hTimeFormat(is24hTimeFormat) { + logs.logEvent("languageStore::setIs24hTimeFormat", ["is24hTimeFormat"], arguments) + } + } + + currencyStore: QtObject { + property string currentCurrency: "usd" + property string currentCurrencySymbol: "usd" + + readonly property ListModel currenciesModel: ListModel { + ListElement { + key: "usd" + shortName: "USD" + name: "US Dollars" + symbol: "$" + category: "" + imageSource: "../../../../imports/shared/assets/twemoji/svg/1f1fa-1f1f8.svg" + selected: false + } + + ListElement { + key: "gbp" + shortName: "GBP" + name: "British Pound" + symbol: "£" + category: "" + imageSource: "../../../../imports/shared/assets/twemoji/svg/1f1ec-1f1e7.svg" + selected: false + } + } + + function updateCurrenciesModel() { + logs.logEvent("currencyStore::updateCurrenciesModel") + } + + function updateCurrency(currencyKey) { + logs.logEvent("currencyStore::updateCurrency", ["currencyKey"], 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/ui/app/AppLayouts/Profile/stores/qmldir b/ui/app/AppLayouts/Profile/stores/qmldir new file mode 100644 index 0000000000..1706f015b4 --- /dev/null +++ b/ui/app/AppLayouts/Profile/stores/qmldir @@ -0,0 +1 @@ +LanguageStore 1.0 LanguageStore.qml diff --git a/ui/app/AppLayouts/Profile/views/qmldir b/ui/app/AppLayouts/Profile/views/qmldir index ce2f61e94e..63ef164a4e 100644 --- a/ui/app/AppLayouts/Profile/views/qmldir +++ b/ui/app/AppLayouts/Profile/views/qmldir @@ -1 +1,2 @@ AboutView 1.0 AboutView.qml +LanguageView 1.0 LanguageView.qml