✨ estimated read
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
|
||||
.editor-statusbar {
|
||||
flex-shrink: 0;
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
@@ -45,6 +46,17 @@
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.statusbar-center {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.statusbar-readtime {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.statusbar-right {
|
||||
margin-left: auto;
|
||||
display: flex;
|
||||
|
||||
@@ -1171,6 +1171,18 @@ export function MarkdownEditor(): JSX.Element {
|
||||
) : sentenceWordCount > 0 ? (
|
||||
<span className="statusbar-selection-wordcount">{sentenceWordCount} in sentence</span>
|
||||
) : null}
|
||||
<div className="statusbar-center">
|
||||
{(() => {
|
||||
const wc = countWords(activeFileContent)
|
||||
const mins = wc / 238
|
||||
if (wc < 10) return null
|
||||
if (mins < 1) return <span className="statusbar-readtime">{'<'} 1 min read</span>
|
||||
const h = Math.floor(mins / 60)
|
||||
const m = Math.round(mins % 60)
|
||||
const label = h > 0 ? `${h}h ${m}m read` : `${Math.round(mins)} min read`
|
||||
return <span className="statusbar-readtime">{label}</span>
|
||||
})()}
|
||||
</div>
|
||||
<div className="statusbar-right">
|
||||
{(() => {
|
||||
const docWc = countWords(activeFileContent)
|
||||
|
||||
Reference in New Issue
Block a user