From c78c7be801898149a5bd0e6c96e67192a767aa4d Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Tue, 27 Feb 2024 21:31:28 +0100 Subject: [PATCH 1/5] [DE PE SSE mobile] Adding the ability to insert a custom logo --- apps/common/mobile/resources/less/common.less | 8 ++- apps/documenteditor/mobile/src/page/main.jsx | 49 ++++++++++------ .../mobile/src/page/main.jsx | 53 ++++++++++++------ .../mobile/src/page/main.jsx | 56 ++++++++++++------- 4 files changed, 112 insertions(+), 54 deletions(-) diff --git a/apps/common/mobile/resources/less/common.less b/apps/common/mobile/resources/less/common.less index 20e3a1046b..4f7ffa3dc6 100644 --- a/apps/common/mobile/resources/less/common.less +++ b/apps/common/mobile/resources/less/common.less @@ -28,7 +28,7 @@ .navbar-inner { display: flex; justify-content: center; - padding-top: 8px; + padding-top: 7px; } .navbar-bg { &:before, &:after { @@ -49,6 +49,12 @@ transition: padding-top .3s ease-in; } +.custom-logo-image { + width: 100px; + height: 14px; + overflow: hidden; +} + .subnavbar { .subnavbar-inner { padding: 0; diff --git a/apps/documenteditor/mobile/src/page/main.jsx b/apps/documenteditor/mobile/src/page/main.jsx index 9ada28b910..ee4a5434a2 100644 --- a/apps/documenteditor/mobile/src/page/main.jsx +++ b/apps/documenteditor/mobile/src/page/main.jsx @@ -20,7 +20,7 @@ import VersionHistoryController from '../../../../common/mobile/lib/controller/V export const MainContext = createContext(); -const MainPage = inject('storeDocumentInfo', 'users', 'storeAppOptions', 'storeVersionHistory', 'storeToolbarSettings')(observer(props => { +const MainPage = inject('storeDocumentInfo', 'users', 'storeAppOptions', 'storeVersionHistory', 'storeToolbarSettings', 'storeThemes')(observer(props => { const { t } = useTranslation(); const [state, setState] = useState({ editOptionsVisible: false, @@ -36,6 +36,8 @@ const MainPage = inject('storeDocumentInfo', 'users', 'storeAppOptions', 'storeV isOpenModal: false }); const appOptions = props.storeAppOptions; + const storeThemes = props.storeThemes; + const colorTheme = storeThemes.colorTheme; const storeVersionHistory = props.storeVersionHistory; const isVersionHistoryMode = storeVersionHistory.isVersionHistoryMode; const storeDocumentInfo = props.storeDocumentInfo; @@ -52,16 +54,29 @@ const MainPage = inject('storeDocumentInfo', 'users', 'storeAppOptions', 'storeV const typeProtection = appOptions.typeProtection; const isFabShow = isViewer && !disabledSettings && !disabledControls && !isDisconnected && isAvailableExt && isEdit && (!isProtected || typeProtection === Asc.c_oAscEDocProtect.TrackedChanges); const config = appOptions.config; - const isShowPlaceholder = !appOptions.isDocReady && (!config.customization || !(config.customization.loaderName || config.customization.loaderLogo)); + const { customization = {} } = config; + const isShowPlaceholder = !appOptions.isDocReady && (!customization || !(customization.loaderName || customization.loaderLogo)); - let isHideLogo = true, - isCustomization = true, - isBranding = true; + let isBranding = true, + isHideCustomLogo = false, + customLogoImage = '', + customLogoUrl = '', + isWithLogo = true; - if(!appOptions.isDisconnected && config?.customization) { - isCustomization = !!(config.customization.loaderName || config.customization.loaderLogo); + if(!appOptions.isDisconnected) { + const { logo } = customization; isBranding = appOptions.canBranding || appOptions.canBrandingExt; - isHideLogo = isCustomization && isBranding; + + if(logo && isBranding) { + isHideCustomLogo = logo.visible === false; + + if(logo.image || logo.imageDark) { + customLogoImage = colorTheme.type === 'dark' ? logo.imageDark ?? logo.image : logo.image ?? logo.imageDark; + customLogoUrl = logo.url; + } + } + + isWithLogo = customLogoImage && !isHideCustomLogo || !customLogoImage } useEffect(() => { @@ -221,15 +236,17 @@ const MainPage = inject('storeDocumentInfo', 'users', 'storeAppOptions', 'storeV showPanels: state.addShowOptions, isBranding }}> - - - {!isHideLogo && -
{ - window.open(`${__PUBLISHER_URL__}`, "_blank"); - }}> + + +
{ + window.open(`${customLogoImage && customLogoUrl && !isHideCustomLogo ? customLogoUrl : __PUBLISHER_URL__}`, "_blank"); + }}> + {customLogoImage && !isHideCustomLogo ? + + : isWithLogo ? -
- } + : null} +
} - + {/* Top Navbar */} - - {!isHideLogo && -
{ - window.open(`${__PUBLISHER_URL__}`, "_blank"); - }}> + +
{ + window.open(`${customLogoImage && customLogoUrl && !isHideCustomLogo ? customLogoUrl : __PUBLISHER_URL__}`, "_blank"); + }}> + {customLogoImage && !isHideCustomLogo ? + + : isWithLogo ? -
- } + : null} +
- + {/* Top Navbar */} - - {!isHideLogo && -
{ - window.open(`${__PUBLISHER_URL__}`, "_blank"); - }}> + +
{ + window.open(`${customLogoImage && customLogoUrl && !isHideCustomLogo ? customLogoUrl : __PUBLISHER_URL__}`, "_blank"); + }}> + {customLogoImage && !isHideCustomLogo ? + + : isWithLogo ? -
- } + : null} +
Date: Thu, 29 Feb 2024 11:44:09 +0100 Subject: [PATCH 2/5] Logo display edits --- apps/common/mobile/resources/less/common.less | 16 ++++++++++++---- apps/documenteditor/mobile/src/page/main.jsx | 19 ++++++++----------- .../mobile/src/page/main.jsx | 19 ++++++++----------- .../mobile/src/page/main.jsx | 19 ++++++++----------- 4 files changed, 36 insertions(+), 37 deletions(-) diff --git a/apps/common/mobile/resources/less/common.less b/apps/common/mobile/resources/less/common.less index 4f7ffa3dc6..d71185861b 100644 --- a/apps/common/mobile/resources/less/common.less +++ b/apps/common/mobile/resources/less/common.less @@ -49,10 +49,18 @@ transition: padding-top .3s ease-in; } -.custom-logo-image { - width: 100px; - height: 14px; - overflow: hidden; +.main-logo { + max-width: 100%; + width: 100%; + display: flex; + justify-content: center; + align-items: center; + + .custom-logo-image { + max-width: 100%; + height: 14px; + overflow: hidden; + } } .subnavbar { diff --git a/apps/documenteditor/mobile/src/page/main.jsx b/apps/documenteditor/mobile/src/page/main.jsx index ee4a5434a2..8cc8a09f2d 100644 --- a/apps/documenteditor/mobile/src/page/main.jsx +++ b/apps/documenteditor/mobile/src/page/main.jsx @@ -58,25 +58,22 @@ const MainPage = inject('storeDocumentInfo', 'users', 'storeAppOptions', 'storeV const isShowPlaceholder = !appOptions.isDocReady && (!customization || !(customization.loaderName || customization.loaderLogo)); let isBranding = true, - isHideCustomLogo = false, + isHideLogo = true, customLogoImage = '', - customLogoUrl = '', - isWithLogo = true; + customLogoUrl = ''; if(!appOptions.isDisconnected) { const { logo } = customization; isBranding = appOptions.canBranding || appOptions.canBrandingExt; if(logo && isBranding) { - isHideCustomLogo = logo.visible === false; + isHideLogo = logo.visible === false; if(logo.image || logo.imageDark) { customLogoImage = colorTheme.type === 'dark' ? logo.imageDark ?? logo.image : logo.image ?? logo.imageDark; customLogoUrl = logo.url; } } - - isWithLogo = customLogoImage && !isHideCustomLogo || !customLogoImage } useEffect(() => { @@ -236,14 +233,14 @@ const MainPage = inject('storeDocumentInfo', 'users', 'storeAppOptions', 'storeV showPanels: state.addShowOptions, isBranding }}> - - + +
{ - window.open(`${customLogoImage && customLogoUrl && !isHideCustomLogo ? customLogoUrl : __PUBLISHER_URL__}`, "_blank"); + window.open(`${customLogoImage && customLogoUrl && !isHideLogo ? customLogoUrl : __PUBLISHER_URL__}`, "_blank"); }}> - {customLogoImage && !isHideCustomLogo ? + {customLogoImage && !isHideLogo ? - : isWithLogo ? + : !customLogoImage ? : null}
diff --git a/apps/presentationeditor/mobile/src/page/main.jsx b/apps/presentationeditor/mobile/src/page/main.jsx index 9f82388c06..96a8bf9dca 100644 --- a/apps/presentationeditor/mobile/src/page/main.jsx +++ b/apps/presentationeditor/mobile/src/page/main.jsx @@ -129,25 +129,22 @@ class MainPage extends Component { const isShowPlaceholder = !appOptions.isDocReady && (!customization || !(customization.loaderName || customization.loaderLogo)); let isBranding = true, - isHideCustomLogo = false, + isHideLogo = true, customLogoImage = '', - customLogoUrl = '', - isWithLogo = true; + customLogoUrl = ''; if(!appOptions.isDisconnected) { const { logo } = customization; isBranding = appOptions.canBranding || appOptions.canBrandingExt; if(logo && isBranding) { - isHideCustomLogo = logo.visible === false; + isHideLogo = logo.visible === false; if(logo.image || logo.imageDark) { customLogoImage = colorTheme.type === 'dark' ? logo.imageDark ?? logo.image : logo.image ?? logo.imageDark; customLogoUrl = logo.url; } } - - isWithLogo = customLogoImage && !isHideCustomLogo || !customLogoImage } return ( @@ -161,15 +158,15 @@ class MainPage extends Component { {!this.state.previewVisible ? null : } - + {/* Top Navbar */} - +
{ - window.open(`${customLogoImage && customLogoUrl && !isHideCustomLogo ? customLogoUrl : __PUBLISHER_URL__}`, "_blank"); + window.open(`${customLogoImage && customLogoUrl && !isHideLogo ? customLogoUrl : __PUBLISHER_URL__}`, "_blank"); }}> - {customLogoImage && !isHideCustomLogo ? + {customLogoImage && !isHideLogo ? - : isWithLogo ? + : !customLogoImage ? : null}
diff --git a/apps/spreadsheeteditor/mobile/src/page/main.jsx b/apps/spreadsheeteditor/mobile/src/page/main.jsx index 5f6d9c2825..065c7a17e6 100644 --- a/apps/spreadsheeteditor/mobile/src/page/main.jsx +++ b/apps/spreadsheeteditor/mobile/src/page/main.jsx @@ -125,25 +125,22 @@ class MainPage extends Component { const isShowPlaceholder = !appOptions.isDocReady && (!customization || !(customization.loaderName || customization.loaderLogo)); let isBranding = true, - isHideCustomLogo = false, + isHideLogo = true, customLogoImage = '', - customLogoUrl = '', - isWithLogo = true; + customLogoUrl = ''; if(!appOptions.isDisconnected) { const { logo } = customization; isBranding = appOptions.canBranding || appOptions.canBrandingExt; if(logo && isBranding) { - isHideCustomLogo = logo.visible === false; + isHideLogo = logo.visible === false; if(logo.image || logo.imageDark) { customLogoImage = colorTheme.type === 'dark' ? logo.imageDark ?? logo.image : logo.image ?? logo.imageDark; customLogoUrl = logo.url; } } - - isWithLogo = customLogoImage && !isHideCustomLogo || !customLogoImage } return ( @@ -156,15 +153,15 @@ class MainPage extends Component { wsProps, isBranding }}> - + {/* Top Navbar */} - +
{ - window.open(`${customLogoImage && customLogoUrl && !isHideCustomLogo ? customLogoUrl : __PUBLISHER_URL__}`, "_blank"); + window.open(`${customLogoImage && customLogoUrl && !isHideLogo ? customLogoUrl : __PUBLISHER_URL__}`, "_blank"); }}> - {customLogoImage && !isHideCustomLogo ? + {customLogoImage && !isHideLogo ? - : isWithLogo ? + : !customLogoImage ? : null}
From 258d3357f0f9a2fa442b97dab31ccd79f6302b49 Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Wed, 6 Mar 2024 09:33:34 +0100 Subject: [PATCH 3/5] [DE PE SSE mobile] Edits for displaying and hiding the logo --- apps/documenteditor/mobile/src/page/main.jsx | 24 +++++++++++-------- .../mobile/src/page/main.jsx | 24 +++++++++++-------- .../mobile/src/page/main.jsx | 24 +++++++++++-------- 3 files changed, 42 insertions(+), 30 deletions(-) diff --git a/apps/documenteditor/mobile/src/page/main.jsx b/apps/documenteditor/mobile/src/page/main.jsx index 8cc8a09f2d..fe6644fe8c 100644 --- a/apps/documenteditor/mobile/src/page/main.jsx +++ b/apps/documenteditor/mobile/src/page/main.jsx @@ -62,7 +62,7 @@ const MainPage = inject('storeDocumentInfo', 'users', 'storeAppOptions', 'storeV customLogoImage = '', customLogoUrl = ''; - if(!appOptions.isDisconnected) { + if(!appOptions.isDisconnected && appOptions.isDocReady) { const { logo } = customization; isBranding = appOptions.canBranding || appOptions.canBrandingExt; @@ -73,6 +73,8 @@ const MainPage = inject('storeDocumentInfo', 'users', 'storeAppOptions', 'storeV customLogoImage = colorTheme.type === 'dark' ? logo.imageDark ?? logo.image : logo.image ?? logo.imageDark; customLogoUrl = logo.url; } + } else { + isHideLogo = false; } } @@ -235,15 +237,17 @@ const MainPage = inject('storeDocumentInfo', 'users', 'storeAppOptions', 'storeV }}> -
{ - window.open(`${customLogoImage && customLogoUrl && !isHideLogo ? customLogoUrl : __PUBLISHER_URL__}`, "_blank"); - }}> - {customLogoImage && !isHideLogo ? - - : !customLogoImage ? - - : null} -
+ {!isHideLogo || !isBranding ? +
{ + window.open(`${customLogoImage && customLogoUrl && !isHideLogo ? customLogoUrl : __PUBLISHER_URL__}`, "_blank"); + }}> + {customLogoImage && !isHideLogo ? + + : + + } +
+ : null} {/* Top Navbar */} -
{ - window.open(`${customLogoImage && customLogoUrl && !isHideLogo ? customLogoUrl : __PUBLISHER_URL__}`, "_blank"); - }}> - {customLogoImage && !isHideLogo ? - - : !customLogoImage ? - - : null} -
+ {!isHideLogo || !isBranding ? +
{ + window.open(`${customLogoImage && customLogoUrl && !isHideLogo ? customLogoUrl : __PUBLISHER_URL__}`, "_blank"); + }}> + {customLogoImage && !isHideLogo ? + + : + + } +
+ : null} {/* Top Navbar */} -
{ - window.open(`${customLogoImage && customLogoUrl && !isHideLogo ? customLogoUrl : __PUBLISHER_URL__}`, "_blank"); - }}> - {customLogoImage && !isHideLogo ? - - : !customLogoImage ? - - : null} -
+ {!isHideLogo || !isBranding ? +
{ + window.open(`${customLogoImage && customLogoUrl && !isHideLogo ? customLogoUrl : __PUBLISHER_URL__}`, "_blank"); + }}> + {customLogoImage && !isHideLogo ? + + : + + } +
+ : null} Date: Wed, 6 Mar 2024 15:32:05 +0100 Subject: [PATCH 4/5] [DE PE SSE mobile] Remove unnecessary checks --- apps/documenteditor/mobile/src/page/main.jsx | 10 +++++----- apps/presentationeditor/mobile/src/page/main.jsx | 10 +++++----- apps/spreadsheeteditor/mobile/src/page/main.jsx | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/apps/documenteditor/mobile/src/page/main.jsx b/apps/documenteditor/mobile/src/page/main.jsx index fe6644fe8c..56627809b0 100644 --- a/apps/documenteditor/mobile/src/page/main.jsx +++ b/apps/documenteditor/mobile/src/page/main.jsx @@ -235,13 +235,13 @@ const MainPage = inject('storeDocumentInfo', 'users', 'storeAppOptions', 'storeV showPanels: state.addShowOptions, isBranding }}> - - - {!isHideLogo || !isBranding ? + + + {!isHideLogo ?
{ - window.open(`${customLogoImage && customLogoUrl && !isHideLogo ? customLogoUrl : __PUBLISHER_URL__}`, "_blank"); + window.open(`${customLogoImage && customLogoUrl ? customLogoUrl : __PUBLISHER_URL__}`, "_blank"); }}> - {customLogoImage && !isHideLogo ? + {customLogoImage ? : diff --git a/apps/presentationeditor/mobile/src/page/main.jsx b/apps/presentationeditor/mobile/src/page/main.jsx index 0f77668e2e..0bf8d9b66e 100644 --- a/apps/presentationeditor/mobile/src/page/main.jsx +++ b/apps/presentationeditor/mobile/src/page/main.jsx @@ -160,14 +160,14 @@ class MainPage extends Component { {!this.state.previewVisible ? null : } - + {/* Top Navbar */} - - {!isHideLogo || !isBranding ? + + {!isHideLogo ?
{ - window.open(`${customLogoImage && customLogoUrl && !isHideLogo ? customLogoUrl : __PUBLISHER_URL__}`, "_blank"); + window.open(`${customLogoImage && customLogoUrl ? customLogoUrl : __PUBLISHER_URL__}`, "_blank"); }}> - {customLogoImage && !isHideLogo ? + {customLogoImage ? : diff --git a/apps/spreadsheeteditor/mobile/src/page/main.jsx b/apps/spreadsheeteditor/mobile/src/page/main.jsx index 2664cad6bb..6042f25e22 100644 --- a/apps/spreadsheeteditor/mobile/src/page/main.jsx +++ b/apps/spreadsheeteditor/mobile/src/page/main.jsx @@ -155,14 +155,14 @@ class MainPage extends Component { wsProps, isBranding }}> - + {/* Top Navbar */} - - {!isHideLogo || !isBranding ? + + {!isHideLogo ?
{ - window.open(`${customLogoImage && customLogoUrl && !isHideLogo ? customLogoUrl : __PUBLISHER_URL__}`, "_blank"); + window.open(`${customLogoImage && customLogoUrl ? customLogoUrl : __PUBLISHER_URL__}`, "_blank"); }}> - {customLogoImage && !isHideLogo ? + {customLogoImage ? : From 6e488f45cdc237000250a8b39a7ee40d9e7ea14b Mon Sep 17 00:00:00 2001 From: maxkadushkin Date: Wed, 6 Mar 2024 19:26:40 +0300 Subject: [PATCH 5/5] [mobile] refactoring --- apps/documenteditor/mobile/src/page/main.jsx | 4 ++-- apps/presentationeditor/mobile/src/page/main.jsx | 4 ++-- apps/spreadsheeteditor/mobile/src/page/main.jsx | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/documenteditor/mobile/src/page/main.jsx b/apps/documenteditor/mobile/src/page/main.jsx index 56627809b0..a9f85d356a 100644 --- a/apps/documenteditor/mobile/src/page/main.jsx +++ b/apps/documenteditor/mobile/src/page/main.jsx @@ -237,7 +237,7 @@ const MainPage = inject('storeDocumentInfo', 'users', 'storeAppOptions', 'storeV }}> - {!isHideLogo ? + {!isHideLogo &&
{ window.open(`${customLogoImage && customLogoUrl ? customLogoUrl : __PUBLISHER_URL__}`, "_blank"); }}> @@ -247,7 +247,7 @@ const MainPage = inject('storeDocumentInfo', 'users', 'storeAppOptions', 'storeV }
- : null} + } {/* Top Navbar */} - {!isHideLogo ? + {!isHideLogo &&
{ window.open(`${customLogoImage && customLogoUrl ? customLogoUrl : __PUBLISHER_URL__}`, "_blank"); }}> @@ -173,7 +173,7 @@ class MainPage extends Component { }
- : null} + } {/* Top Navbar */} - {!isHideLogo ? + {!isHideLogo &&
{ window.open(`${customLogoImage && customLogoUrl ? customLogoUrl : __PUBLISHER_URL__}`, "_blank"); }}> @@ -168,7 +168,7 @@ class MainPage extends Component { }
- : null} + }