diff --git a/src/components/ArticlePreview/ArticlePreview.module.scss b/src/components/ArticlePreview/ArticlePreview.module.scss index da5771a..b8fa9d8 100644 --- a/src/components/ArticlePreview/ArticlePreview.module.scss +++ b/src/components/ArticlePreview/ArticlePreview.module.scss @@ -152,6 +152,13 @@ font-weight: 700; line-height: 24px; } + + .estimate { + color: var(--text-tertiary); + font-size: 15px; + font-weight: 400; + line-height: 24px; + } } } .image { diff --git a/src/components/ArticlePreview/ArticleShort.tsx b/src/components/ArticlePreview/ArticleShort.tsx index aaa29f3..86a0c4e 100644 --- a/src/components/ArticlePreview/ArticleShort.tsx +++ b/src/components/ArticlePreview/ArticleShort.tsx @@ -44,6 +44,9 @@ const ArticlePreview: Component<{
{props.article.title}
+
+ {Math.ceil(props.article.wordCount / 238)} minutes +
0}> diff --git a/src/handleNotes.ts b/src/handleNotes.ts index baf099f..cc3244a 100644 --- a/src/handleNotes.ts +++ b/src/handleNotes.ts @@ -196,6 +196,7 @@ export const fetchArticles = (pubkey: string | undefined, noteIds: string[], sub topZaps: {}, since: 0, until: 0, + wordCount: {}, } const events = noteIds.reduce((acc, id) => { @@ -231,7 +232,6 @@ export const fetchArticles = (pubkey: string | undefined, noteIds: string[], sub }); getParametrizedEvents(events, subId); - // getEvents(pubkey, [...noteIds], subId, true); const updatePage = (content: NostrEventContent) => { if (content.kind === Kind.Metadata) { @@ -358,6 +358,17 @@ export const fetchArticles = (pubkey: string | undefined, noteIds: string[], sub return; } + if (content.kind === Kind.WordCount) { + const count = JSON.parse(content.content) as { event_id: string, words: number }; + + if (!page.wordCount) { + page.wordCount = {}; + } + + page.wordCount[count.event_id] = count.words + return; + } + if (content.kind === Kind.NoteQuoteStats) { const quoteStats = JSON.parse(content.content); @@ -384,6 +395,7 @@ export const fetchArticleThread = (pubkey: string | undefined, noteIds: string, topZaps: {}, since: 0, until: 0, + wordCount: {}, } let primaryArticle: PrimalArticle | undefined;