diff --git a/modules/playground/components/editor-area.tsx b/modules/playground/components/editor-area.tsx index ed7a4cdf..60ee343e 100644 --- a/modules/playground/components/editor-area.tsx +++ b/modules/playground/components/editor-area.tsx @@ -78,6 +78,16 @@ export const EditorArea: React.FC = ({ const activeFile = openFiles.find((file) => file.id === activeFileId); const collaboratorCount = useCollaboratorCount(id); + const fileContent = activeFile?.content || ""; + + const lineCount = fileContent + ? fileContent.split("\n").length + : 0; + + const wordCount = fileContent.trim() + ? fileContent.trim().split(/\s+/).length + : 0; + // Auto-open default file when preview is shown if no file is open useEffect(() => { if (isPreviewVisible && !activeFileId && templateData) { @@ -188,7 +198,7 @@ export const EditorArea: React.FC = ({ {})} + writeFileSync={writeFileSync || (async () => { })} error={containerError} serverUrl={serverUrl || ""} @@ -227,6 +237,8 @@ export const EditorArea: React.FC = ({ containerStatus={containerStatus} collaboratorCount={collaboratorCount} openFileCount={openFiles.length} + lineCount={lineCount} + wordCount={wordCount} /> ); diff --git a/modules/playground/components/status-bar.tsx b/modules/playground/components/status-bar.tsx index 5ba38f63..2929724e 100644 --- a/modules/playground/components/status-bar.tsx +++ b/modules/playground/components/status-bar.tsx @@ -13,6 +13,8 @@ interface StatusBarProps { containerStatus: "idle" | "building" | "running" | "error"; collaboratorCount: number; openFileCount: number; + lineCount: number; + wordCount: number; } const LANGUAGE_MAP: Record = { @@ -50,6 +52,8 @@ export function StatusBar({ containerStatus, collaboratorCount, openFileCount, + lineCount, + wordCount, }: StatusBarProps) { const ext = activeFile?.fileExtension?.toLowerCase() || ""; const language = LANGUAGE_MAP[ext] || "Plain Text"; @@ -73,6 +77,17 @@ export function StatusBar({ Ln {cursorPosition.line}, Col {cursorPosition.col} + + + + {lineCount} Lines + + + + + + {wordCount} Words + )} {!activeFile && (