Fix dashboard article status and scheduled-date display - #195
Merged
Conversation
The dashboard's timeAgo() assumed every article was already published, so a scheduled article's future date produced a negative minute count and rendered as "-429m ago". Take the absolute difference and pick the direction from its sign, and guard an unparseable date the same way a missing one is guarded. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The articles page renders "Published"/"Scheduled"; the dashboard was showing the raw lowercase API value. Also widens the RecentArticle status type to include "scheduled", which the endpoint already returns. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two fixes to the dashboard's "All Recent Articles" table.
Negative relative times. Scheduled articles showed a negative relative time — e.g.
-429m agofor an article going live in about seven hours.timeAgo()assumed every article was already published, soDate.now() - published_datewent negative for anything in the future and the sign leaked straight into the label. It now takes the absolute difference and reads the direction off its sign: future dates renderin 7h, past dates keep7h ago, and anything inside the last minute readsjust now. An unparseable date falls back to—, the same as a missing one.Lowercase status badges. The badges rendered the raw API value (
scheduled,published) while the articles page showsScheduled/Published/Draft. They're now capitalized to match.RecentArticle.statuswas also typed"published" | "draft"even though the endpoint returns"scheduled"too; widened.Frontend typecheck passes.
🤖 Generated with Claude Code