fix floating player location on desktop
This commit is contained in:
parent
467d9b9f47
commit
6626cc1059
5 changed files with 16 additions and 6 deletions
|
@ -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),
|
||||
}
|
||||
: {}
|
||||
}
|
||||
|
|
|
@ -233,7 +233,6 @@ function AppRouter(props: Props) {
|
|||
<Route path={`/$/${PAGES.SEARCH}`} exact component={SearchPage} />
|
||||
<Route path={`/$/${PAGES.TOP}`} exact component={TopPage} />
|
||||
<Route path={`/$/${PAGES.SETTINGS}`} exact component={SettingsPage} />
|
||||
<Route path={`/$/${PAGES.SETTINGS_NOTIFICATIONS}`} exact component={SettingsNotificationsPage} />
|
||||
<Route path={`/$/${PAGES.SETTINGS_ADVANCED}`} exact component={SettingsAdvancedPage} />
|
||||
<Route path={`/$/${PAGES.INVITE}/:referrer`} exact component={InvitedPage} />
|
||||
<Route path={`/$/${PAGES.CHECKOUT}`} exact component={CheckoutPage} />
|
||||
|
|
|
@ -6,7 +6,7 @@ import SettingsPage from './view';
|
|||
|
||||
const select = state => ({
|
||||
osNotificationsEnabled: selectosNotificationsEnabled(state),
|
||||
isAuthenticated: selectUserVerifiedEmail(state),
|
||||
isAuthenticated: Boolean(selectUserVerifiedEmail)(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
|
|
|
@ -89,7 +89,7 @@ export default function NotificationSettingsPage(props: Props) {
|
|||
});
|
||||
}
|
||||
|
||||
if (!isAuthenticated && !verificationToken) {
|
||||
if (IS_WEB && !isAuthenticated && !verificationToken) {
|
||||
return <Redirect to={`/$/${PAGES.AUTH_SIGNIN}?redirect=${location.pathname}`} />;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue