Skip to content

Commit d30bde9

Browse files
committed
fix(suite): Move window dragging area to Main in suite-desktop
1 parent 9f5b582 commit d30bde9

File tree

4 files changed

+9
-20
lines changed

4 files changed

+9
-20
lines changed

packages/suite-desktop-ui/src/Main.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import TrezorConnect from '@trezor/connect';
1414
import { initStore } from 'src/reducers/store';
1515
import { preloadStore } from 'src/support/suite/preloadStore';
1616
import { Metadata } from 'src/components/suite/Metadata';
17-
import { Preloader, ToastContainer } from 'src/components/suite';
17+
import { Preloader, ToastContainer, TrafficLightDraggableWindowHeader } from 'src/components/suite';
1818
import { ConnectedIntlProvider } from 'src/support/suite/ConnectedIntlProvider';
1919
import Resize from 'src/support/suite/Resize';
2020
import Autodetect from 'src/support/suite/Autodetect';
@@ -45,6 +45,7 @@ const Main = () => {
4545
// Todo: Enable when issues are fixed (ReactTruncate & BumpFee)
4646
// <StrictMode>
4747
<HelmetProvider>
48+
<TrafficLightDraggableWindowHeader />
4849
<ConnectedThemeProvider>
4950
<RouterProvider history={history}>
5051
<ModalContextProvider>

packages/suite/src/components/suite/Preloader/Preloader.tsx

+3-15
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import { WelcomeLayout } from '../layouts/WelcomeLayout/WelcomeLayout';
3131
import { DeviceCompromised } from '../SecurityCheck/DeviceCompromised';
3232
import { RouterAppWithParams } from '../../../constants/suite/routes';
3333
import { useReportDeviceCompromised } from '../SecurityCheck/useReportDeviceCompromised';
34-
import { TrafficLightDraggableWindowHeader } from '../TrafficLightOffset';
3534

3635
const ROUTES_TO_SKIP_FIRMWARE_CHECK: RouterAppWithParams['app'][] = [
3736
'settings',
@@ -51,7 +50,9 @@ const getFullscreenApp = (route: AppState['router']['route']): FC | undefined =>
5150
}
5251
};
5352

54-
const usePreloaderData = ({ children }: PropsWithChildren) => {
53+
// Preloader is a top level wrapper used in _app.tsx.
54+
// Decides which content should be displayed basing on route and prerequisites.
55+
export const Preloader = ({ children }: PropsWithChildren) => {
5556
const lifecycle = useSelector(state => state.suite.lifecycle);
5657
const isTransportInitialized = useSelector(selectIsTransportInitialized);
5758
const router = useSelector(state => state.router);
@@ -147,16 +148,3 @@ const usePreloaderData = ({ children }: PropsWithChildren) => {
147148
// everything is set.
148149
return <SuiteLayout>{children}</SuiteLayout>;
149150
};
150-
151-
// Preloader is a top level wrapper used in _app.tsx.
152-
// Decides which content should be displayed basing on route and prerequisites.
153-
export const Preloader = (props: PropsWithChildren) => {
154-
const renderedComponent = usePreloaderData(props);
155-
156-
return (
157-
<>
158-
<TrafficLightDraggableWindowHeader />
159-
{renderedComponent}
160-
</>
161-
);
162-
};

packages/suite/src/components/suite/TrafficLightOffset.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@ type Props = {
1111
isVisible?: boolean;
1212
};
1313

14-
// See: https://github.com/electron/electron/issues/5678
15-
// Visible all the time in the app
16-
1714
const FixForNotBeingAbleToDragWindow = styled.div`
18-
background: rgba(255, 0, 0, 0.1);
1915
-webkit-app-region: drag;
2016
pointer-events: none;
2117
height: 64px;
@@ -32,6 +28,8 @@ const Container = styled.div<{ $offset: number }>`
3228
height: 100%;
3329
`;
3430

31+
// See: https://github.com/electron/electron/issues/5678
32+
// Visible all the time in the app
3533
export const TrafficLightDraggableWindowHeader = ({ children, isVisible = true }: Props) => {
3634
const isMac = isMacOs();
3735
const isDesktopApp = isDesktop();

packages/suite/src/components/suite/index.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import { QrCode } from './QrCode';
4747
import { CoinBalance } from './CoinBalance';
4848
import { DeviceAuthenticationExplainer } from './DeviceAuthenticationExplainer';
4949
import { Preloader } from './Preloader/Preloader';
50+
import { TrafficLightDraggableWindowHeader } from './TrafficLightOffset';
5051
import { PinMatrix } from './PinMatrix/PinMatrix';
5152
import { UdevDownload } from './UdevDownload';
5253
import { StakingFeature } from './StakingFeature';
@@ -100,6 +101,7 @@ export {
100101
CoinBalance,
101102
DeviceAuthenticationExplainer,
102103
Preloader,
104+
TrafficLightDraggableWindowHeader,
103105
PinMatrix,
104106
UdevDownload,
105107
StakingFeature,

0 commit comments

Comments
 (0)