+ {isEditing ? (
+ // Render input field when editing
+ e.stopPropagation()}
+ >
+ {ws.number}
+ setEditingLabel(e.target.value)}
+ onKeyDown={handleKeyDown}
+ onBlur={saveLabel}
+ autoFocus
+ style={{
+ width: `${Math.max(editingLabel.length, 1)}ch`,
+ }}
+ className="bg-transparent border-0 outline-none focus:outline-none focus:ring-0 p-0 m-0 text-inherit"
+ />
+
+ ) : (
+ // Render button when not editing
+
+
dragControls.start(e)}
+ className="cursor-grab active:cursor-grabbing p-1 hover:bg-black/10 rounded flex items-center justify-center"
+ >
+
+
+
+
+ )}
+
+ );
+}
export function TabBar() {
const {
@@ -106,73 +203,20 @@ export function TabBar() {
onReorder={(newOrder) => reorderWorkspaces(newOrder.map((w) => w.id))}
className="flex items-center gap-1 flex-nowrap list-none p-0 m-0"
>
- {sortedWorkspaces.map((ws) => {
- const isEditing = editingId === ws.id;
- const isActive = ws.id === activeWorkspaceId;
-
- return (
-