Skip to content

RED-108: Fix subreddit analyzer display#184

Merged
aegloist merged 2 commits into
mainfrom
bugfix/RED-108-analyzer-display-fixes
Mar 18, 2026
Merged

RED-108: Fix subreddit analyzer display#184
aegloist merged 2 commits into
mainfrom
bugfix/RED-108-analyzer-display-fixes

Conversation

@aegloist
Copy link
Copy Markdown
Owner

Summary

  • Show actual Reddit rules instead of empty "Rule summary"
  • Active users: "Not available" with explanation (Reddit requires auth for this)
  • Subscribers: formatted (2.0M instead of 2013694)
  • Replace confusing "Stale hours: 0" with "Data source: Live from Reddit"
  • Replace "Restriction: Open" with "Type: Public/Restricted/NSFW/Quarantined"

Test Plan

  • All 467 tests pass
  • TypeScript clean

🤖 Generated with Claude Code

- Show actual Reddit rules (was ignoring rules field from API)
- Active users: show "Not available" with explanation instead of "0"
- Subscribers: format as 2.0M instead of raw number
- Replace "Stale hours" with "Data source" (Live vs Cached)
- Replace "Restriction" with "Type" (Public/Restricted/NSFW/Quarantined)
- Remove old "queued/ingest" messaging (no longer applicable)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 18, 2026 18:32
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openfast Ready Ready Preview, Comment Mar 18, 2026 6:40pm

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the public Subreddit analyzer UI to present clearer subreddit rules/policy and community stats, aligning the page with the tool’s intended “pre-flight check before posting” workflow.

Changes:

  • Replaces the “Rule summary” card with a “Rules” view (rules list when available; policy fallback otherwise).
  • Improves community stats display (compact subscriber formatting, clearer active user availability messaging, refined “Type” and “Data source” labels).
  • Reorganizes secondary sections (best-time windows shown only when present; updated “What to do next” CTA copy).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 17 to 23
policy?: {
promoAllowed: boolean;
linkPolicy: string;
promoAllowed: unknown;
linkPolicy: unknown;
flairRequired: boolean;
noLinksInPosts: boolean;
textOnly: boolean;
} | null;
}

const hasRules = (result?.rules?.length ?? 0) > 0;
const hasPolicy = result?.policy && result.policy.promoAllowed != null;
Comment on lines +131 to 175
<p className="text-sm font-semibold">Rules</p>
{hasRules ? (
<ul className="mt-4 space-y-2">
{result!.rules!.map((rule, i) => (
<li
key={i}
className="rounded-2xl border border-border bg-card/80 px-4 py-3 text-sm text-muted-foreground"
>
{rule}
</li>
))}
</ul>
) : hasPolicy ? (
<ul className="mt-4 space-y-2 text-sm text-muted-foreground">
<li>
Link policy:{" "}
Promo allowed:{" "}
<span className="font-semibold text-foreground">
{result.policy.linkPolicy}
{result!.policy!.promoAllowed ? "Yes" : "No"}
</span>
</li>
<li>
Promo allowed:{" "}
Link policy:{" "}
<span className="font-semibold text-foreground">
{result.policy.promoAllowed ? "Yes" : "No"}
{String(result!.policy!.linkPolicy ?? "Unknown")}
</span>
</li>
<li>
Flair required:{" "}
<span className="font-semibold text-foreground">
{result.policy.flairRequired ? "Yes" : "No"}
{result!.policy!.flairRequired ? "Yes" : "No"}
</span>
</li>
<li>
Text only:{" "}
<span className="font-semibold text-foreground">
{result!.policy!.textOnly ? "Yes" : "No"}
</span>
</li>
</ul>
) : (
<p className="mt-4 text-sm text-muted-foreground">
Analyze a subreddit to preview policy and rule signals.
{result
? "No rules data available for this subreddit."
: "Enter a subreddit name to see its rules and posting policies."}
</p>
}

function formatNumber(n: number | null | undefined): string {
if (n == null || n === 0) return "N/A";
- Fix formatNumber: handle NaN/Infinity, don't treat 0 as N/A
- Type policy fields properly (boolean|null, string|null instead of unknown)
- Handle "fallback" source: show "Estimated (Reddit unavailable)"
- Fix promoAllowed null display (show "Unknown" instead of "No")

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@aegloist aegloist merged commit 4e42846 into main Mar 18, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants