refactor(feed): build the prose view count where it's used
It sat above the one-line row's early return but only textBlock consumes it, so every compact row allocated it and threw it away — the same shape I'd already fixed for textBlock and meta, crept back. Also merges a rationale comment I'd written twice.
This commit is contained in:
@@ -352,13 +352,10 @@ function VideoCard({
|
||||
// line here rather than let the mode silently lose them.
|
||||
const noThumb = !spec.thumb;
|
||||
// Each datum on its own, so the one-line row can give each a column of its own while the stacked
|
||||
// layouts still run them together as one sentence.
|
||||
// Two shapes for the count: the stacked layouts read it as prose ("1.5K views · 2 min ago"), so
|
||||
// they need the word; the row's column doesn't — a table doesn't repeat its unit on every line,
|
||||
// and the tooltip has the exact figure anyway. Same tooltip either way.
|
||||
// One span either way, so the exact-count tooltip covers all of whatever is rendered: the stacked
|
||||
// layouts read it as prose and need the word, the row's column doesn't — a table doesn't repeat
|
||||
// its unit on every line.
|
||||
// layouts still run them together as one sentence. The count comes in two shapes from one span —
|
||||
// one span so the exact-count tooltip covers all of whatever is rendered: prose needs the word
|
||||
// ("1.5K views · 2 min ago"), the row's column doesn't, because a table doesn't repeat its unit
|
||||
// on every line and the tooltip carries the figure regardless.
|
||||
const viewsCell = (withWord: boolean) =>
|
||||
video.view_count != null && (
|
||||
<span title={`${video.view_count.toLocaleString()} ${t("card.views")}`}>
|
||||
@@ -366,7 +363,6 @@ function VideoCard({
|
||||
{withWord && ` ${t("card.views")}`}
|
||||
</span>
|
||||
);
|
||||
const views = viewsCell(true);
|
||||
const published = (
|
||||
<>
|
||||
{relativeTime(video.published_at)}
|
||||
@@ -497,6 +493,7 @@ function VideoCard({
|
||||
// Everything below is a STACKED layout — the card and the thumbnailed row. Only they run the
|
||||
// data together as one sentence; the one-line row above gives each datum its own column and has
|
||||
// already returned, so building this for it would be waste dressed up as shared code.
|
||||
const views = viewsCell(true);
|
||||
const textBlock = (
|
||||
<>
|
||||
{title}
|
||||
|
||||
Reference in New Issue
Block a user