From 166f843dd79955b14d0ee13a66394883f1ff025e Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Sat, 19 Oct 2024 14:00:21 +0530 Subject: [PATCH] chore: lint --- src/components/organisms/BrowserContent.tsx | 58 ++++++++++----------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/components/organisms/BrowserContent.tsx b/src/components/organisms/BrowserContent.tsx index e9892bd9..b95f034b 100644 --- a/src/components/organisms/BrowserContent.tsx +++ b/src/components/organisms/BrowserContent.tsx @@ -11,16 +11,16 @@ import { InterpretationLog } from "../molecules/InterpretationLog"; // TODO: Tab !show currentUrl after recordingUrl global state export const BrowserContent = () => { - const { width } = useBrowserDimensionsStore(); - const { socket } = useSocketStore(); + const { width } = useBrowserDimensionsStore(); + const { socket } = useSocketStore(); - const [tabs, setTabs] = useState(['current']); - const [tabIndex, setTabIndex] = React.useState(0); - const [showOutputData, setShowOutputData] = useState(false); + const [tabs, setTabs] = useState(['current']); + const [tabIndex, setTabIndex] = React.useState(0); + const [showOutputData, setShowOutputData] = useState(false); - const handleChangeIndex = useCallback((index: number) => { - setTabIndex(index); - }, [tabIndex]) + const handleChangeIndex = useCallback((index: number) => { + setTabIndex(index); + }, [tabIndex]) const handleCloseTab = useCallback((index: number) => { // the tab needs to be closed on the backend @@ -53,17 +53,17 @@ export const BrowserContent = () => { handleChangeIndex(tabs.length); }, [socket, tabs]); - const handleNewTab = useCallback((tab: string) => { - // Adds a new tab to the end of the tabs array and shifts focus - setTabs((prevState) => [...prevState, tab]); - // changes focus on the new tab - same happens in the remote browser - handleChangeIndex(tabs.length); - handleTabChange(tabs.length); - }, [tabs]); + const handleNewTab = useCallback((tab: string) => { + // Adds a new tab to the end of the tabs array and shifts focus + setTabs((prevState) => [...prevState, tab]); + // changes focus on the new tab - same happens in the remote browser + handleChangeIndex(tabs.length); + handleTabChange(tabs.length); + }, [tabs]); const handleTabChange = useCallback((index: number) => { // page screencast and focus needs to be changed on backend - socket?.emit('changeTab', index); + socket?.emit('changeTab', index); }, [socket]); const handleUrlChanged = (url: string) => { @@ -93,18 +93,18 @@ export const BrowserContent = () => { handleCloseTab(index); }, [handleCloseTab]) - useEffect(() => { - if (socket) { - socket.on('newTab', handleNewTab); - socket.on('tabHasBeenClosed', tabHasBeenClosedHandler); - } - return () => { - if (socket) { - socket.off('newTab', handleNewTab); - socket.off('tabHasBeenClosed', tabHasBeenClosedHandler); - } - } - }, [socket, handleNewTab]) + useEffect(() => { + if (socket) { + socket.on('newTab', handleNewTab); + socket.on('tabHasBeenClosed', tabHasBeenClosedHandler); + } + return () => { + if (socket) { + socket.off('newTab', handleNewTab); + socket.off('tabHasBeenClosed', tabHasBeenClosedHandler); + } + } + }, [socket, handleNewTab]) useEffect(() => { getCurrentTabs().then((response) => { @@ -131,7 +131,7 @@ export const BrowserContent = () => { browserWidth={1150} handleUrlChanged={handleUrlChanged} /> - + ); }