- {splitTabIds.length > 0 ? (
-
- {splitTabIds.map(id => {
- const terminal = terminals.find(t => t.id === id);
- return terminal ? (
-
- {
- if (ref && !terminal.terminalRef) {
- setTerminals(prev => prev.map(t =>
- t.id === terminal.id ? { ...t, terminalRef: ref } : t
- ));
- }
- }}
- />
-
- ) : null;
- })}
+
+ {terminals.map((terminal) => (
+
+ {
+ if (ref && !terminal.terminalRef) {
+ setTerminals((prev) =>
+ prev.map((t) =>
+ t.id === terminal.id
+ ? { ...t, terminalRef: ref }
+ : t
+ )
+ );
+ }
+ }}
+ />
- ) : (
-
- {terminals.find(t => t.id === activeTab) && (
-
- t.id === activeTab).hostConfig}
- ref={(ref) => {
- const terminal = terminals.find(t => t.id === activeTab);
- if (ref && terminal && !terminal.terminalRef) {
- setTerminals(prev => prev.map(t =>
- t.id === activeTab ? { ...t, terminalRef: ref } : t
- ));
- }
- }}
- />
-
- )}
-
- )}
+ ))}
@@ -212,4 +199,4 @@ function App() {
);
}
-export default App;
\ No newline at end of file
+export default App;
diff --git a/src/TabList.jsx b/src/TabList.jsx
index c9d1a3c5..6ac09e53 100644
--- a/src/TabList.jsx
+++ b/src/TabList.jsx
@@ -2,74 +2,81 @@ import { Button, ButtonGroup } from "@mui/joy";
import PropTypes from "prop-types";
function TabList({ terminals, activeTab, setActiveTab, closeTab, toggleSplit, splitTabIds, theme }) {
+ const isSplitScreenActive = splitTabIds.length > 0;
+
return (
- {terminals.map((terminal, index) => (
-
-
-
-
-
-
-
- ))}
+ {terminals.map((terminal, index) => {
+ const isActive = terminal.id === activeTab;
+ const isSplit = splitTabIds.includes(terminal.id);
+
+ // Disable split screen button for the active tab (before and after splitting)
+ const isSplitButtonDisabled = isActive && !isSplitScreenActive || splitTabIds.length >= 3 && !isSplit;
+
+ return (
+
+
+ {/* Set active tab button */}
+
+ {/* Split screen button */}
+
+ {/* Close tab button */}
+
+
+
+ );
+ })}
);
}
@@ -84,4 +91,4 @@ TabList.propTypes = {
theme: PropTypes.object.isRequired,
};
-export default TabList;
\ No newline at end of file
+export default TabList;