feat(renderer): StatusBar reads from editor store (word count, cursor pos)

This commit is contained in:
2026-06-05 12:49:16 +05:30
parent 0e80e37d9d
commit 5d6a55dd09
+14 -3
View File
@@ -1,14 +1,25 @@
import { useEditorStore } from '@/stores/editor-store';
function countWords(text: string): number {
return text.trim().length === 0 ? 0 : text.trim().split(/\s+/).length;
}
export function StatusBar() {
const { buffers, activeId } = useEditorStore();
const buf = activeId ? buffers.get(activeId) : null;
const wordCount = buf ? countWords(buf.content) : 0;
const cursor = buf?.cursor ?? { line: 1, column: 1 };
return (
<footer className="flex h-7 items-center justify-between border-t border-border bg-card/20 px-3 text-xs text-muted-foreground">
<div className="flex items-center gap-4">
<span>0 words</span>
<span>{wordCount} words</span>
<span>UTF-8</span>
</div>
<div className="flex items-center gap-4">
<span>Ln 1, Col 1</span>
<span>Ln {cursor.line}, Col {cursor.column}</span>
<span>Markdown</span>
</div>
</footer>
);
}
}