Add an Electron app drag handle to sign-in page (#3795)
* Add Electron app drag handle to sign-in page * Don't assign drag regions in web from JSX, results in dev-only console errors about unsupported style values
This commit is contained in:
10
src/App.tsx
10
src/App.tsx
@ -122,11 +122,11 @@ export function App() {
|
|||||||
// Override the electron window draggable region behavior as well
|
// Override the electron window draggable region behavior as well
|
||||||
// when the button is down in the stream
|
// when the button is down in the stream
|
||||||
style={
|
style={
|
||||||
{
|
isDesktop() && context.store?.buttonDownInStream
|
||||||
'-webkit-app-region': context.store?.buttonDownInStream
|
? ({
|
||||||
? 'no-drag'
|
'-webkit-app-region': 'no-drag',
|
||||||
: '',
|
} as React.CSSProperties)
|
||||||
} as React.CSSProperties
|
: {}
|
||||||
}
|
}
|
||||||
project={{ project, file }}
|
project={{ project, file }}
|
||||||
enableMenu={true}
|
enableMenu={true}
|
||||||
|
|||||||
@ -6,6 +6,9 @@
|
|||||||
grid-template-columns: 1fr auto 1fr;
|
grid-template-columns: 1fr auto 1fr;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header.desktopApp {
|
||||||
/* Make the header act as a handle to drag the electron app window,
|
/* Make the header act as a handle to drag the electron app window,
|
||||||
* per the electron docs: https://www.electronjs.org/docs/latest/tutorial/window-customization#set-custom-draggable-region
|
* per the electron docs: https://www.electronjs.org/docs/latest/tutorial/window-customization#set-custom-draggable-region
|
||||||
* all interactive elements opt-out of this behavior by default in src/index.css
|
* all interactive elements opt-out of this behavior by default in src/index.css
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import { useSettingsAuthContext } from 'hooks/useSettingsAuthContext'
|
|||||||
import styles from './AppHeader.module.css'
|
import styles from './AppHeader.module.css'
|
||||||
import { RefreshButton } from 'components/RefreshButton'
|
import { RefreshButton } from 'components/RefreshButton'
|
||||||
import { CommandBarOpenButton } from './CommandBarOpenButton'
|
import { CommandBarOpenButton } from './CommandBarOpenButton'
|
||||||
|
import { isDesktop } from 'lib/isDesktop'
|
||||||
|
|
||||||
interface AppHeaderProps extends React.PropsWithChildren {
|
interface AppHeaderProps extends React.PropsWithChildren {
|
||||||
showToolbar?: boolean
|
showToolbar?: boolean
|
||||||
@ -32,7 +33,9 @@ export const AppHeader = ({
|
|||||||
className={
|
className={
|
||||||
'w-full grid ' +
|
'w-full grid ' +
|
||||||
styles.header +
|
styles.header +
|
||||||
' overlaid-panes sticky top-0 z-20 px-2 items-start ' +
|
` ${
|
||||||
|
isDesktop() ? styles.desktopApp + ' ' : ''
|
||||||
|
}overlaid-panes sticky top-0 z-20 px-2 items-start ` +
|
||||||
className
|
className
|
||||||
}
|
}
|
||||||
style={style}
|
style={style}
|
||||||
|
|||||||
@ -58,7 +58,16 @@ const SignIn = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="bg-primary h-screen grid place-items-stretch m-0 p-2">
|
<main
|
||||||
|
className="bg-primary h-screen grid place-items-stretch m-0 p-2"
|
||||||
|
style={
|
||||||
|
isDesktop()
|
||||||
|
? ({
|
||||||
|
'-webkit-app-region': 'drag',
|
||||||
|
} as CSSProperties)
|
||||||
|
: {}
|
||||||
|
}
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
style={
|
style={
|
||||||
{
|
{
|
||||||
@ -68,6 +77,7 @@ const SignIn = () => {
|
|||||||
'--circle-size-mid': '15%',
|
'--circle-size-mid': '15%',
|
||||||
'--circle-size-end': '200%',
|
'--circle-size-end': '200%',
|
||||||
'--circle-timing': 'cubic-bezier(0.25, 1, 0.4, 0.9)',
|
'--circle-timing': 'cubic-bezier(0.25, 1, 0.4, 0.9)',
|
||||||
|
...(isDesktop() ? { '-webkit-app-region': 'no-drag' } : {}),
|
||||||
} as CSSProperties
|
} as CSSProperties
|
||||||
}
|
}
|
||||||
className="in-circle-hesitate body-bg py-5 px-12 rounded-lg grid place-items-center overflow-y-auto"
|
className="in-circle-hesitate body-bg py-5 px-12 rounded-lg grid place-items-center overflow-y-auto"
|
||||||
|
|||||||
Reference in New Issue
Block a user