Add toggle to display stream debug tools

This commit is contained in:
Max Goodhart
2020-07-27 14:22:10 -07:00
parent bc700abfae
commit cea7210485

View File

@@ -192,6 +192,11 @@ function App({ wsEndpoint }) {
} = useStreamwallConnection(wsEndpoint) } = useStreamwallConnection(wsEndpoint)
const { gridCount } = config const { gridCount } = config
const [showDebug, setShowDebug] = useState(false)
const handleChangeShowDebug = useCallback((ev) => {
setShowDebug(ev.target.checked)
})
const [dragStart, setDragStart] = useState() const [dragStart, setDragStart] = useState()
const handleDragStart = useCallback((idx, ev) => { const handleDragStart = useCallback((idx, ev) => {
setDragStart(idx) setDragStart(idx)
@@ -403,6 +408,7 @@ function App({ wsEndpoint }) {
isListening={isListening} isListening={isListening}
isBlurred={isBlurred} isBlurred={isBlurred}
isHighlighted={isDragHighlighted} isHighlighted={isDragHighlighted}
showDebug={showDebug}
onMouseDown={handleDragStart} onMouseDown={handleDragStart}
onMouseEnter={setDragEnd} onMouseEnter={setDragEnd}
onFocus={handleFocusInput} onFocus={handleFocusInput}
@@ -419,6 +425,14 @@ function App({ wsEndpoint }) {
</StyledGridLine> </StyledGridLine>
))} ))}
</div> </div>
<label>
<input
type="checkbox"
value={showDebug}
onChange={handleChangeShowDebug}
/>
Show stream debug tools
</label>
<div> <div>
{isConnected {isConnected
? normalStreams.map((row) => ( ? normalStreams.map((row) => (
@@ -531,6 +545,7 @@ function GridInput({
isListening, isListening,
isBlurred, isBlurred,
isHighlighted, isHighlighted,
showDebug,
onMouseDown, onMouseDown,
onMouseEnter, onMouseEnter,
onFocus, onFocus,
@@ -600,12 +615,16 @@ function GridInput({
<StyledSmallButton onClick={handleReloadClick} tabIndex={1}> <StyledSmallButton onClick={handleReloadClick} tabIndex={1}>
<ReloadIcon /> <ReloadIcon />
</StyledSmallButton> </StyledSmallButton>
{showDebug && (
<>
<StyledSmallButton onClick={handleBrowseClick} tabIndex={1}> <StyledSmallButton onClick={handleBrowseClick} tabIndex={1}>
<WindowIcon /> <WindowIcon />
</StyledSmallButton> </StyledSmallButton>
<StyledSmallButton onClick={handleDevToolsClick} tabIndex={1}> <StyledSmallButton onClick={handleDevToolsClick} tabIndex={1}>
<LifeRingIcon /> <LifeRingIcon />
</StyledSmallButton> </StyledSmallButton>
</>
)}
</StyledGridButtons> </StyledGridButtons>
)} )}
<StyledGridButtons side="right"> <StyledGridButtons side="right">