chore: lint
This commit is contained in:
@@ -11,16 +11,16 @@ import { InterpretationLog } from "../molecules/InterpretationLog";
|
|||||||
|
|
||||||
// TODO: Tab !show currentUrl after recordingUrl global state
|
// TODO: Tab !show currentUrl after recordingUrl global state
|
||||||
export const BrowserContent = () => {
|
export const BrowserContent = () => {
|
||||||
const { width } = useBrowserDimensionsStore();
|
const { width } = useBrowserDimensionsStore();
|
||||||
const { socket } = useSocketStore();
|
const { socket } = useSocketStore();
|
||||||
|
|
||||||
const [tabs, setTabs] = useState<string[]>(['current']);
|
const [tabs, setTabs] = useState<string[]>(['current']);
|
||||||
const [tabIndex, setTabIndex] = React.useState(0);
|
const [tabIndex, setTabIndex] = React.useState(0);
|
||||||
const [showOutputData, setShowOutputData] = useState(false);
|
const [showOutputData, setShowOutputData] = useState(false);
|
||||||
|
|
||||||
const handleChangeIndex = useCallback((index: number) => {
|
const handleChangeIndex = useCallback((index: number) => {
|
||||||
setTabIndex(index);
|
setTabIndex(index);
|
||||||
}, [tabIndex])
|
}, [tabIndex])
|
||||||
|
|
||||||
const handleCloseTab = useCallback((index: number) => {
|
const handleCloseTab = useCallback((index: number) => {
|
||||||
// the tab needs to be closed on the backend
|
// the tab needs to be closed on the backend
|
||||||
@@ -53,17 +53,17 @@ export const BrowserContent = () => {
|
|||||||
handleChangeIndex(tabs.length);
|
handleChangeIndex(tabs.length);
|
||||||
}, [socket, tabs]);
|
}, [socket, tabs]);
|
||||||
|
|
||||||
const handleNewTab = useCallback((tab: string) => {
|
const handleNewTab = useCallback((tab: string) => {
|
||||||
// Adds a new tab to the end of the tabs array and shifts focus
|
// Adds a new tab to the end of the tabs array and shifts focus
|
||||||
setTabs((prevState) => [...prevState, tab]);
|
setTabs((prevState) => [...prevState, tab]);
|
||||||
// changes focus on the new tab - same happens in the remote browser
|
// changes focus on the new tab - same happens in the remote browser
|
||||||
handleChangeIndex(tabs.length);
|
handleChangeIndex(tabs.length);
|
||||||
handleTabChange(tabs.length);
|
handleTabChange(tabs.length);
|
||||||
}, [tabs]);
|
}, [tabs]);
|
||||||
|
|
||||||
const handleTabChange = useCallback((index: number) => {
|
const handleTabChange = useCallback((index: number) => {
|
||||||
// page screencast and focus needs to be changed on backend
|
// page screencast and focus needs to be changed on backend
|
||||||
socket?.emit('changeTab', index);
|
socket?.emit('changeTab', index);
|
||||||
}, [socket]);
|
}, [socket]);
|
||||||
|
|
||||||
const handleUrlChanged = (url: string) => {
|
const handleUrlChanged = (url: string) => {
|
||||||
@@ -93,18 +93,18 @@ export const BrowserContent = () => {
|
|||||||
handleCloseTab(index);
|
handleCloseTab(index);
|
||||||
}, [handleCloseTab])
|
}, [handleCloseTab])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (socket) {
|
if (socket) {
|
||||||
socket.on('newTab', handleNewTab);
|
socket.on('newTab', handleNewTab);
|
||||||
socket.on('tabHasBeenClosed', tabHasBeenClosedHandler);
|
socket.on('tabHasBeenClosed', tabHasBeenClosedHandler);
|
||||||
}
|
}
|
||||||
return () => {
|
return () => {
|
||||||
if (socket) {
|
if (socket) {
|
||||||
socket.off('newTab', handleNewTab);
|
socket.off('newTab', handleNewTab);
|
||||||
socket.off('tabHasBeenClosed', tabHasBeenClosedHandler);
|
socket.off('tabHasBeenClosed', tabHasBeenClosedHandler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [socket, handleNewTab])
|
}, [socket, handleNewTab])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getCurrentTabs().then((response) => {
|
getCurrentTabs().then((response) => {
|
||||||
@@ -131,7 +131,7 @@ export const BrowserContent = () => {
|
|||||||
browserWidth={1150}
|
browserWidth={1150}
|
||||||
handleUrlChanged={handleUrlChanged}
|
handleUrlChanged={handleUrlChanged}
|
||||||
/>
|
/>
|
||||||
<BrowserWindow/>
|
<BrowserWindow />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user