Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions new-ui/src/app/App.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
import { QueryClientProvider } from '@tanstack/react-query';
import { RouterProvider } from '@tanstack/react-router';
import { type as getOsType } from '@tauri-apps/plugin-os';
import { useEffect } from 'react';
import { MainBackground } from '../shared/components/MainBackground/MainBackground';
import { WindowDecorations } from '../shared/components/WindowDecorations/WindowDecorations';
import { queryClient } from './query';
import { router } from './router';

const isLinux = getOsType() === 'linux';

// WebKitGTK on Linux doesn't recompute 100dvh on window resize, so on Linux
// only we track window.innerHeight in JS instead. Windows/macOS keep the
// native 100dvh default (--app-dvh's fallback value in _shared_tokens.scss) unchanged.
function applyLinuxViewportHeightFix(): () => void {
const update = () => {
document.documentElement.style.setProperty('--app-dvh', `${window.innerHeight}px`);
};
update();
window.addEventListener('resize', update);
return () => window.removeEventListener('resize', update);
}

function App() {
useEffect(() => {
if (!isLinux) return;
return applyLinuxViewportHeightFix();
}, []);

return (
<div id="app">
<MainBackground />
Expand Down
2 changes: 1 addition & 1 deletion new-ui/src/pages/compact/CompactLocationsPage/style.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#compact-locations-page {
display: flex;
flex-flow: column;
height: 100dvh;
height: var(--app-dvh);

> .compact-footer {
display: flex;
Expand Down
2 changes: 1 addition & 1 deletion new-ui/src/pages/full/OverviewPage/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
height: 100%;
width: 100%;
overflow: hidden;
max-height: calc(100dvh - 50px);
max-height: calc(var(--app-dvh) - 50px);
}

.overview-content {
Expand Down
4 changes: 2 additions & 2 deletions new-ui/src/pages/full/SessionTimeoutPage/style.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#session-timeout {
min-height: 100dvh;
min-height: var(--app-dvh);
min-width: 100%;

> .positioner {
height: 100dvh;
height: var(--app-dvh);
display: flex;
flex-flow: column;
align-items: center;
Expand Down
4 changes: 2 additions & 2 deletions new-ui/src/shared/components/ModalFoundation/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
display: block;
content: ' ';
width: 100%;
height: calc(100dvh - var(--window-decorations-height));
height: calc(var(--app-dvh) - var(--window-decorations-height));
z-index: 4;
}

Expand All @@ -21,7 +21,7 @@
left: 0;
top: var(--window-decorations-height);
width: 100%;
height: calc(100dvh - var(--window-decorations-height));
height: calc(var(--app-dvh) - var(--window-decorations-height));
z-index: 4;
display: flex;
flex-flow: column;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const WindowDecorations = () => {
const shouldReserveSpace = isFullView && osCheck && (isMac || !isDecorated);
document.documentElement.style.setProperty(
'--window-decorations-height',
shouldReserveSpace ? `${decorationsHeight}px` : '0',
shouldReserveSpace ? `${decorationsHeight}px` : '0px',
);
}, [isDecorated]);

Expand Down
2 changes: 1 addition & 1 deletion new-ui/src/shared/components/wizard/WizardPage/style.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.wizard-page {
--page-content-limit: 536px;

height: calc(100dvh - var(--window-decorations-height));
height: calc(var(--app-dvh) - var(--window-decorations-height));
overflow-y: auto;

> .page-grid {
Expand Down
2 changes: 1 addition & 1 deletion new-ui/src/shared/layouts/FullPageLayout/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
display: grid;
grid-template-columns: 52px 1fr;
grid-template-rows: 50px 1fr;
height: calc(100dvh - var(--window-decorations-height));
height: calc(var(--app-dvh) - var(--window-decorations-height));
overflow: hidden;

#window-header {
Expand Down
2 changes: 1 addition & 1 deletion new-ui/src/shared/scss/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ body {

#root,
#app {
min-height: 100dvh;
min-height: var(--app-dvh);
overflow: hidden;
}

Expand Down
2 changes: 2 additions & 0 deletions new-ui/src/shared/scss/_shared_tokens.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ $jetbrains:
// set by WindowDecorations component via effect on window metadata
// --window-decorations-height: 33px;
--window-header-height: 50px;
// 100dvh on Windows/macOS; overridden in px on Linux by App.tsx, see applyLinuxViewportHeightFix
--app-dvh: 100dvh;

// font settings
--font-family-title: #{$geist};
Expand Down
Loading