diff --git a/src/web/control.js b/src/web/control.js index 5f4ea77..cee451c 100644 --- a/src/web/control.js +++ b/src/web/control.js @@ -119,6 +119,16 @@ function App({ wsEndpoint }) { ) }, []) + const handleClickId = useCallback((streamId) => { + const availableIdx = range(GRID_COUNT * GRID_COUNT).find( + (i) => !stateIdxMap.has(i), + ) + if (availableIdx === undefined) { + return + } + handleSetView(availableIdx, streamId) + }) + const handleChangeCustomStream = useCallback((idx, customStream) => { let newCustomStreams = [...customStreams] newCustomStreams[idx] = customStream @@ -170,7 +180,7 @@ function App({ wsEndpoint }) {
{isConnected ? [...streams, ...customStreams.values()].map((row) => ( - + )) : 'loading...'}
@@ -198,10 +208,17 @@ function App({ wsEndpoint }) { ) } -function StreamLine({ id, row: { Label, Source, Title, Link, Notes } }) { +function StreamLine({ + id, + row: { Label, Source, Title, Link, Notes }, + onClickId, +}) { + const handleClickId = useCallback(() => { + onClickId(id) + }) return ( - {id} + {id}
{Label ? ( Label @@ -412,6 +429,7 @@ const StyledId = styled.div` border-radius: 5px; width: 3em; text-align: center; + cursor: pointer; ` const StyledStreamLine = styled.div`