From 6626cc10592002ab9169169f314500db2e31a6fc Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Fri, 6 Nov 2020 16:25:47 -0500 Subject: [PATCH] fix floating player location on desktop --- ui/component/fileRenderFloating/view.jsx | 15 +++++++++++++-- ui/component/router/view.jsx | 1 - ui/page/settingsNotifications/index.js | 2 +- ui/page/settingsNotifications/view.jsx | 2 +- ui/scss/init/_vars.scss | 2 +- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ui/component/fileRenderFloating/view.jsx b/ui/component/fileRenderFloating/view.jsx index 1814b7d05..27492e8ad 100644 --- a/ui/component/fileRenderFloating/view.jsx +++ b/ui/component/fileRenderFloating/view.jsx @@ -16,6 +16,7 @@ import { useIsMobile } from 'effects/use-screensize'; import debounce from 'util/debounce'; import { useHistory } from 'react-router'; +const IS_DESKTOP_MAC = typeof process === 'object' ? process.platform === 'darwin' : false; const DEBOUNCE_WINDOW_RESIZE_HANDLER_MS = 60; export const INLINE_PLAYER_WRAPPER_CLASS = 'inline-player__wrapper'; @@ -153,8 +154,18 @@ export default function FileRenderFloating(props: Props) { const rect = element.getBoundingClientRect(); + // getBoundingCLientRect returns a DomRect, not an object + const objectRect = { + top: rect.top, + right: rect.right, + bottom: rect.bottom, + left: rect.left, + width: rect.width, + height: rect.height, + }; + // $FlowFixMe - setFileViewerRect(rect); + setFileViewerRect({ ...objectRect, windowOffset: window.pageYOffset }); } useEffect(() => { @@ -241,7 +252,7 @@ export default function FileRenderFloating(props: Props) { height: fileViewerRect.height, left: fileViewerRect.x, // 80px is header height in scss/init/vars.scss - top: window.pageYOffset + fileViewerRect.top - 80, + top: fileViewerRect.windowOffset + fileViewerRect.top - 80 - (IS_DESKTOP_MAC ? 24 : 0), } : {} } diff --git a/ui/component/router/view.jsx b/ui/component/router/view.jsx index b486e38fd..cdf57cc10 100644 --- a/ui/component/router/view.jsx +++ b/ui/component/router/view.jsx @@ -233,7 +233,6 @@ function AppRouter(props: Props) { - diff --git a/ui/page/settingsNotifications/index.js b/ui/page/settingsNotifications/index.js index 8e9b83743..e44e372c5 100644 --- a/ui/page/settingsNotifications/index.js +++ b/ui/page/settingsNotifications/index.js @@ -6,7 +6,7 @@ import SettingsPage from './view'; const select = state => ({ osNotificationsEnabled: selectosNotificationsEnabled(state), - isAuthenticated: selectUserVerifiedEmail(state), + isAuthenticated: Boolean(selectUserVerifiedEmail)(state), }); const perform = dispatch => ({ diff --git a/ui/page/settingsNotifications/view.jsx b/ui/page/settingsNotifications/view.jsx index bf09da856..576eabcca 100644 --- a/ui/page/settingsNotifications/view.jsx +++ b/ui/page/settingsNotifications/view.jsx @@ -89,7 +89,7 @@ export default function NotificationSettingsPage(props: Props) { }); } - if (!isAuthenticated && !verificationToken) { + if (IS_WEB && !isAuthenticated && !verificationToken) { return ; } diff --git a/ui/scss/init/_vars.scss b/ui/scss/init/_vars.scss index 6fc372c3b..e31f3dc1a 100644 --- a/ui/scss/init/_vars.scss +++ b/ui/scss/init/_vars.scss @@ -48,7 +48,7 @@ $breakpoint-large: 1600px; // Width & spacing --page-max-width: 1280px; --page-max-width--filepage: 1700px; - --mac-titlebar-height: 1.5rem; + --mac-titlebar-height: 24px; --mobile: 600px; --side-nav-width: 230px; --side-nav-width--micro: 125px;