From 2a6c4b8bda54319f55fa03306eb9290109e483a0 Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Wed, 4 Feb 2026 16:47:59 +0000 Subject: [PATCH] fix(workspace): improve file editor header responsiveness and prevent overflow Restructure header into three distinct sections (controls, filename/indicators, metadata) with proper flex constraints and truncation behavior. Add responsive visibility controls to hide secondary elements on small screens. Fix content overflow issues in markdown and code block rendering with max-width constraints and improved text wrapping. --- src/components/workspace/FileEditor.tsx | 234 ++++++++++++------------ 1 file changed, 122 insertions(+), 112 deletions(-) diff --git a/src/components/workspace/FileEditor.tsx b/src/components/workspace/FileEditor.tsx index 21d95c0..65b7b09 100644 --- a/src/components/workspace/FileEditor.tsx +++ b/src/components/workspace/FileEditor.tsx @@ -201,123 +201,132 @@ export function FileEditor({ return (
{/* File header */} -
- {/* Star button */} - {filePath && onStar && ( - - )} - -

{fileName}

- {isMarkdown && ( - - Markdown - - )} - - {/* Edit mode indicator */} - {isEditing && ( - - Editing - - )} - - {/* Unsaved changes indicator */} - {isEditing && hasUnsavedChanges && ( - - Unsaved - - )} - - {/* Save status */} - - {isEditing && ( - + {/* Left: Controls - always visible, fixed width */} +
+ {/* Star button */} + {filePath && onStar && ( + )} - - {/* File metadata */} -
- {fileSize !== undefined && ( - - {formatFileSize(fileSize)} - - )} - {fileModified && ( - - {formatModifiedDate(fileModified)} - + {/* Action buttons */} + {onSave && ( +
+ {!isEditing ? ( + + ) : ( + <> + + + + )} +
)}
- {/* Action buttons */} - {onSave && ( -
- {!isEditing ? ( - - ) : ( - <> - - - + {saveStatus === 'saving' && ( + <> +
+ Saving... + + )} + {saveStatus === 'saved' && ( + <> + + Saved + + )} + {saveStatus === 'error' && ( + <> + + Save failed + + )} + + )} + +
+ + {/* Right: Metadata - shows when space allows, hides on very small screens */} +
+
+ {fileSize !== undefined && ( + + {formatFileSize(fileSize)} + + )} + {fileModified && ( + + {formatModifiedDate(fileModified)} + )}
- )} +
{/* Content */} @@ -351,9 +360,10 @@ export function FileEditor({ animate={{ opacity: 1 }} exit={{ opacity: 0 }} transition={{ duration: 0.15 }} + className="min-w-0" > {isMarkdown ? ( -
+
( @@ -377,8 +387,8 @@ export function FileEditor({ {children} ) : ( -
-                              {children}
+                            
+                              {children}
                             
) }, @@ -427,7 +437,7 @@ export function FileEditor({
) : ( -
{content}
+
{content}
)} )}