mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-09-01 09:45:10 +00:00
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 debounce from 'util/debounce';
|
||||||
import { useHistory } from 'react-router';
|
import { useHistory } from 'react-router';
|
||||||
|
|
||||||
|
const IS_DESKTOP_MAC = typeof process === 'object' ? process.platform === 'darwin' : false;
|
||||||
const DEBOUNCE_WINDOW_RESIZE_HANDLER_MS = 60;
|
const DEBOUNCE_WINDOW_RESIZE_HANDLER_MS = 60;
|
||||||
export const INLINE_PLAYER_WRAPPER_CLASS = 'inline-player__wrapper';
|
export const INLINE_PLAYER_WRAPPER_CLASS = 'inline-player__wrapper';
|
||||||
|
|
||||||
|
@ -153,8 +154,18 @@ export default function FileRenderFloating(props: Props) {
|
||||||
|
|
||||||
const rect = element.getBoundingClientRect();
|
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
|
// $FlowFixMe
|
||||||
setFileViewerRect(rect);
|
setFileViewerRect({ ...objectRect, windowOffset: window.pageYOffset });
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -241,7 +252,7 @@ export default function FileRenderFloating(props: Props) {
|
||||||
height: fileViewerRect.height,
|
height: fileViewerRect.height,
|
||||||
left: fileViewerRect.x,
|
left: fileViewerRect.x,
|
||||||
// 80px is header height in scss/init/vars.scss
|
// 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.SEARCH}`} exact component={SearchPage} />
|
||||||
<Route path={`/$/${PAGES.TOP}`} exact component={TopPage} />
|
<Route path={`/$/${PAGES.TOP}`} exact component={TopPage} />
|
||||||
<Route path={`/$/${PAGES.SETTINGS}`} exact component={SettingsPage} />
|
<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.SETTINGS_ADVANCED}`} exact component={SettingsAdvancedPage} />
|
||||||
<Route path={`/$/${PAGES.INVITE}/:referrer`} exact component={InvitedPage} />
|
<Route path={`/$/${PAGES.INVITE}/:referrer`} exact component={InvitedPage} />
|
||||||
<Route path={`/$/${PAGES.CHECKOUT}`} exact component={CheckoutPage} />
|
<Route path={`/$/${PAGES.CHECKOUT}`} exact component={CheckoutPage} />
|
||||||
|
|
|
@ -6,7 +6,7 @@ import SettingsPage from './view';
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
osNotificationsEnabled: selectosNotificationsEnabled(state),
|
osNotificationsEnabled: selectosNotificationsEnabled(state),
|
||||||
isAuthenticated: selectUserVerifiedEmail(state),
|
isAuthenticated: Boolean(selectUserVerifiedEmail)(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
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}`} />;
|
return <Redirect to={`/$/${PAGES.AUTH_SIGNIN}?redirect=${location.pathname}`} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ $breakpoint-large: 1600px;
|
||||||
// Width & spacing
|
// Width & spacing
|
||||||
--page-max-width: 1280px;
|
--page-max-width: 1280px;
|
||||||
--page-max-width--filepage: 1700px;
|
--page-max-width--filepage: 1700px;
|
||||||
--mac-titlebar-height: 1.5rem;
|
--mac-titlebar-height: 24px;
|
||||||
--mobile: 600px;
|
--mobile: 600px;
|
||||||
--side-nav-width: 230px;
|
--side-nav-width: 230px;
|
||||||
--side-nav-width--micro: 125px;
|
--side-nav-width--micro: 125px;
|
||||||
|
|
Loading…
Add table
Reference in a new issue