-
-
Notifications
You must be signed in to change notification settings - Fork 514
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: prompt to enlarge grid when a connected surface does not fit
- Loading branch information
Showing
5 changed files
with
83 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { CAlert, CButton } from '@coreui/react' | ||
import { observer } from 'mobx-react-lite' | ||
import React, { useContext } from 'react' | ||
import { RootAppStoreContext } from '../Stores/RootAppStore.js' | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' | ||
import { faExpand } from '@fortawesome/free-solid-svg-icons' | ||
|
||
export const ButtonGridResizePrompt = observer(function ButtonGridResizePrompt(): React.ReactNode { | ||
const { socket, surfaces, userConfig } = useContext(RootAppStoreContext) | ||
|
||
const overflowing = userConfig.properties && surfaces.getSurfacesOverflowingBounds(userConfig.properties.gridSize) | ||
if (!overflowing || overflowing.surfaces.length === 0) return null | ||
|
||
const doAutoResize = () => { | ||
if (!overflowing) return | ||
socket.emit('set_userconfig_key', 'gridSize', overflowing.neededBounds) | ||
} | ||
|
||
return ( | ||
<> | ||
<CAlert color="info"> | ||
You have some surfaces which overflow the current grid bounds | ||
<ul> | ||
{overflowing.surfaces.map((s) => ( | ||
<li key={s.id}>{s.displayName}</li> | ||
))} | ||
</ul> | ||
<CButton color="info" onClick={doAutoResize}> | ||
<FontAwesomeIcon icon={faExpand} /> | ||
Resize grid to fit | ||
</CButton> | ||
</CAlert> | ||
</> | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters