fix: Fixed issue on desktop where custom titlebar would overlap with preferences view header

This commit is contained in:
Aman Harwara
2023-04-21 19:21:00 +05:30
parent ab5b292364
commit 87cd75d324
4 changed files with 42 additions and 37 deletions

View File

@@ -114,18 +114,6 @@ async function configureWindow(remoteBridge: CrossProcessBridge) {
if (isMacOS || useSystemMenuBar) { if (isMacOS || useSystemMenuBar) {
// !important is important here because #desktop-title-bar has display: flex. // !important is important here because #desktop-title-bar has display: flex.
sheet.insertRule('#desktop-title-bar { display: none !important; }', sheet.cssRules.length) sheet.insertRule('#desktop-title-bar { display: none !important; }', sheet.cssRules.length)
} else {
/* Use custom title bar. Take the sn-titlebar-height off of
the app content height so its not overflowing */
sheet.insertRule(
'body, [data-dialog], [data-mobile-popover] { padding-top: var(--sn-desktop-titlebar-height) !important; }',
sheet.cssRules.length,
)
sheet.insertRule(
`.main-ui-view { height: calc(100vh - var(--sn-desktop-titlebar-height)) !important;
min-height: calc(100vh - var(--sn-desktop-titlebar-height)) !important; }`,
sheet.cssRules.length,
)
} }
} }

View File

@@ -37,7 +37,6 @@ panel-resizer {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
z-index: 99999; z-index: 99999;
position: absolute;
width: 100%; width: 100%;
top: 0; top: 0;
} }
@@ -84,3 +83,14 @@ input,
.panel-resizer { .panel-resizer {
-webkit-app-region: no-drag; -webkit-app-region: no-drag;
} }
body {
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
}
#app-group-root {
min-height: 0;
}

View File

@@ -6,32 +6,39 @@ import { useModalAnimation } from '../Modal/useModalAnimation'
type Props = { type Props = {
isOpen: boolean isOpen: boolean
children: ReactNode children: ReactNode
portal?: boolean
} }
const ModalOverlay = forwardRef(({ isOpen, children, ...props }: Props, ref: ForwardedRef<HTMLDivElement>) => { const ModalOverlay = forwardRef(
const [isMounted, setElement] = useModalAnimation(isOpen) ({ isOpen, children, portal = true, ...props }: Props, ref: ForwardedRef<HTMLDivElement>) => {
const dialog = useDialogStore({ const [isMounted, setElement] = useModalAnimation(isOpen)
open: isMounted, const dialog = useDialogStore({
}) open: isMounted,
})
if (!isMounted) { if (!isMounted) {
return null return null
} }
return ( return (
<Dialog <Dialog
tabIndex={0} tabIndex={0}
className="h-full w-full" className="h-full w-full"
backdropProps={{ backdropProps={{
className: '!z-modal', className: '!z-modal',
}} style: {
ref={mergeRefs([setElement, ref])} position: !portal ? 'absolute' : 'fixed',
store={dialog} },
{...props} }}
> ref={mergeRefs([setElement, ref])}
{children} store={dialog}
</Dialog> portal={portal}
) {...props}
}) >
{children}
</Dialog>
)
},
)
export default ModalOverlay export default ModalOverlay

View File

@@ -20,7 +20,7 @@ const PreferencesViewWrapper: FunctionComponent<PreferencesViewWrapperProps> = (
}, [commandService, viewControllerManager]) }, [commandService, viewControllerManager])
return ( return (
<ModalOverlay isOpen={viewControllerManager.preferencesController.isOpen}> <ModalOverlay isOpen={viewControllerManager.preferencesController.isOpen} portal={false}>
<PreferencesView <PreferencesView
closePreferences={() => viewControllerManager.preferencesController.closePreferences()} closePreferences={() => viewControllerManager.preferencesController.closePreferences()}
application={application} application={application}