From ffd2325f8fbac0cacf803c5d854e6949c306088e Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Mon, 22 Nov 2021 13:50:33 +0400 Subject: [PATCH] [SSE mobile] Added themes controller and correct icons --- apps/presentationeditor/mobile/locale/en.json | 3 ++- .../src/view/settings/ApplicationSettings.jsx | 2 +- apps/spreadsheeteditor/mobile/locale/en.json | 3 ++- .../settings/ApplicationSettings.jsx | 18 +----------------- .../mobile/src/less/icons-ios.less | 4 ++-- .../mobile/src/less/icons-material.less | 5 ++--- .../src/view/settings/ApplicationSettings.jsx | 7 ++++--- 7 files changed, 14 insertions(+), 28 deletions(-) diff --git a/apps/presentationeditor/mobile/locale/en.json b/apps/presentationeditor/mobile/locale/en.json index 34c5d95b1..6c99b9b46 100644 --- a/apps/presentationeditor/mobile/locale/en.json +++ b/apps/presentationeditor/mobile/locale/en.json @@ -465,7 +465,8 @@ "txtScheme6": "Concourse", "txtScheme7": "Equity", "txtScheme8": "Flow", - "txtScheme9": "Foundry" + "txtScheme9": "Foundry", + "textDarkTheme": "Dark Theme" } } } \ No newline at end of file diff --git a/apps/presentationeditor/mobile/src/view/settings/ApplicationSettings.jsx b/apps/presentationeditor/mobile/src/view/settings/ApplicationSettings.jsx index 30a98fc67..9a929743d 100644 --- a/apps/presentationeditor/mobile/src/view/settings/ApplicationSettings.jsx +++ b/apps/presentationeditor/mobile/src/view/settings/ApplicationSettings.jsx @@ -46,7 +46,7 @@ const PageApplicationSettings = props => { }} /> - + {Themes.switchDarkTheme(!toggle), setIsThemeDark(!toggle)}}> diff --git a/apps/spreadsheeteditor/mobile/locale/en.json b/apps/spreadsheeteditor/mobile/locale/en.json index c0fa31b41..d4fb31ed5 100644 --- a/apps/spreadsheeteditor/mobile/locale/en.json +++ b/apps/spreadsheeteditor/mobile/locale/en.json @@ -652,7 +652,8 @@ "txtSemicolon": "Semicolon", "txtSpace": "Space", "txtTab": "Tab", - "warnDownloadAs": "If you continue saving in this format all features except the text will be lost.
Are you sure you want to continue?" + "warnDownloadAs": "If you continue saving in this format all features except the text will be lost.
Are you sure you want to continue?", + "textDarkTheme": "Dark Theme" } } } \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/src/controller/settings/ApplicationSettings.jsx b/apps/spreadsheeteditor/mobile/src/controller/settings/ApplicationSettings.jsx index 24c9068bb..e3f2fa1dd 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/settings/ApplicationSettings.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/settings/ApplicationSettings.jsx @@ -87,20 +87,6 @@ class ApplicationSettingsController extends Component { if (regCode!==null) api.asc_setLocale(+regCode); } - switchDarkTheme(value) { - const theme = value ? {id:'theme-dark', type:'dark'} : {id:'theme-light', type:'light'}; - LocalStorage.setItem("ui-theme", JSON.stringify(theme)); - - const $body = $$('body'); - $body.attr('class') && $body.attr('class', $body.attr('class').replace(/\s?theme-type-(?:dark|light)/, '')); - $body.addClass(`theme-type-${theme.type}`); - } - - isThemeDark() { - const obj = LocalStorage.getItem("ui-theme"); - return !!obj ? JSON.parse(obj).type === 'dark' : false; - } - render() { return ( ) } diff --git a/apps/spreadsheeteditor/mobile/src/less/icons-ios.less b/apps/spreadsheeteditor/mobile/src/less/icons-ios.less index e998c8f86..142989494 100644 --- a/apps/spreadsheeteditor/mobile/src/less/icons-ios.less +++ b/apps/spreadsheeteditor/mobile/src/less/icons-ios.less @@ -322,7 +322,7 @@ &.icon-format-xltx { width: 30px; height: 30px; - .encoded-svg-mask(''); + .encoded-svg-mask(''); } &.icon-format-ods { width: 30px; @@ -332,7 +332,7 @@ &.icon-format-ots { width: 30px; height: 30px; - .encoded-svg-mask(''); + .encoded-svg-mask(''); } &.icon-format-csv { width: 24px; diff --git a/apps/spreadsheeteditor/mobile/src/less/icons-material.less b/apps/spreadsheeteditor/mobile/src/less/icons-material.less index d9ae959f7..70a6e5c9d 100644 --- a/apps/spreadsheeteditor/mobile/src/less/icons-material.less +++ b/apps/spreadsheeteditor/mobile/src/less/icons-material.less @@ -306,8 +306,7 @@ &.icon-format-xltx { width: 30px; height: 30px; - // - .encoded-svg-mask(''); + .encoded-svg-mask(''); } &.icon-format-ods { width: 30px; @@ -317,7 +316,7 @@ &.icon-format-ots { width: 30px; height: 30px; - .encoded-svg-mask(''); + .encoded-svg-mask(''); } &.icon-format-csv { width: 24px; diff --git a/apps/spreadsheeteditor/mobile/src/view/settings/ApplicationSettings.jsx b/apps/spreadsheeteditor/mobile/src/view/settings/ApplicationSettings.jsx index 7ddb7b230..52e08bb5d 100644 --- a/apps/spreadsheeteditor/mobile/src/view/settings/ApplicationSettings.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/settings/ApplicationSettings.jsx @@ -2,6 +2,7 @@ import React, {Fragment, useState} from "react"; import { observer, inject } from "mobx-react"; import { Page, Navbar, List, ListItem, BlockTitle, Toggle, Icon } from "framework7-react"; import { useTranslation } from "react-i18next"; +import { Themes } from '../../../../../common/mobile/lib/controller/Themes.js'; const PageApplicationSettings = props => { const { t } = useTranslation(); @@ -20,7 +21,7 @@ const PageApplicationSettings = props => { const isRefStyle = storeApplicationSettings.isRefStyle; const isComments = storeApplicationSettings.isComments; const isResolvedComments = storeApplicationSettings.isResolvedComments; - const [isThemeDark, setIsThemeDark] = useState(props.isThemeDark); + const [isThemeDark, setIsThemeDark] = useState(Themes.isCurrentDark); const changeMeasureSettings = value => { storeApplicationSettings.changeUnitMeasurement(value); @@ -93,9 +94,9 @@ const PageApplicationSettings = props => { }} />
- + {props.switchDarkTheme(!toggle), setIsThemeDark(!toggle)}}> + onToggleChange={toggle => {Themes.switchDarkTheme(!toggle), setIsThemeDark(!toggle)}}>