feat: use browser store for setting dimensions

This commit is contained in:
Rohit
2025-03-18 04:01:55 +05:30
parent aa5d9765fb
commit 29706ba36d
5 changed files with 26 additions and 90 deletions

View File

@@ -11,17 +11,12 @@ import {
// TODO: Tab !show currentUrl after recordingUrl global state
export const BrowserContent = () => {
const { width } = useBrowserDimensionsStore();
const { socket } = useSocketStore();
const [tabs, setTabs] = useState<string[]>(["current"]);
const [tabIndex, setTabIndex] = React.useState(0);
const [showOutputData, setShowOutputData] = useState(false);
const [browserWidth, setBrowserWidth] = useState(window.innerWidth * 0.7);
const handleResize = useCallback(() => {
setBrowserWidth(window.innerWidth * 0.7);
}, []);
const { browserWidth } = useBrowserDimensionsStore();
const handleChangeIndex = useCallback(
(index: number) => {
@@ -114,14 +109,6 @@ export const BrowserContent = () => {
[handleCloseTab]
);
useEffect(() => {
window.addEventListener('resize', handleResize);
return () => {
window.removeEventListener('resize', handleResize);
};
}, [handleResize]);
useEffect(() => {
if (socket) {
socket.on("newTab", handleNewTab);