Skip to content

docs: respect banner expires field#602

Merged
jdx merged 1 commit intomainfrom
claude/banner
Apr 23, 2026
Merged

docs: respect banner expires field#602
jdx merged 1 commit intomainfrom
claude/banner

Conversation

@jdx
Copy link
Copy Markdown
Owner

@jdx jdx commented Apr 23, 2026

Summary

  • Honors the new optional expires (ISO-8601) field in jdx.dev/banner.json
  • Banner is hidden once Date.now() >= Date.parse(expires)
  • No-op when expires is absent (preserves existing behavior)
  • Requires jdx/blog#65 to populate the field

Test plan

  • Set an expires in the past → banner hidden
  • Set an expires in the future → banner shown
  • No expires field → banner shown as before

🤖 Generated with Claude Code


Note

Low Risk
Low risk: small, client-side docs banner change that only gates rendering based on an optional timestamp; no auth or data writes beyond existing localStorage usage.

Overview
Adds support for an optional expires field in banner.json so the docs site announcement banner will not render once the timestamp has passed.

Introduces isExpired() to safely parse the date (treating missing/invalid values as non-expired) and checks it during initBanner() before calling render().

Reviewed by Cursor Bugbot for commit b64256d. Bugbot is set up for automated code reviews on this repo. Configure here.

The banner.json endpoint now includes an optional ISO-8601 `expires`
timestamp so announcements can auto-hide without a code change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@gemini-code-assist
Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 23, 2026

Greptile Summary

This PR adds support for an optional expires (ISO-8601) field in the remote banner JSON, hiding the banner once the current time reaches or passes the expiry timestamp. The implementation is minimal and correct: the isExpired helper gracefully no-ops on missing or malformed dates, and the expiry check is placed at the right point in the render guard chain.

Confidence Score: 5/5

Safe to merge — single-file, additive change with correct fallback behavior and no breaking changes.

No P0 or P1 findings. The logic is correct: NaN guard prevents accidental banner suppression on invalid dates, absence of the field preserves existing behavior, and the check ordering in the flow is appropriate.

No files require special attention.

Important Files Changed

Filename Overview
docs/.vitepress/theme/banner.ts Adds optional expires field to BannerData and an isExpired() helper that suppresses the banner once Date.now() >= Date.parse(expires); NaN-guards invalid date strings and is a no-op when the field is absent.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[fetch banner.json] --> B{r.ok?}
    B -- No --> Z[silent catch / no-op]
    B -- Yes --> C{b.enabled?}
    C -- No --> Z
    C -- Yes --> D{isExpired?}
    D -- "expires absent → false" --> E
    D -- "invalid date → false" --> E
    D -- "Date.now() >= t → true" --> Z
    D -- "Date.now() < t → false" --> E{dismissed in localStorage?}
    E -- Yes --> Z
    E -- No --> F[render banner]
Loading

Reviews (1): Last reviewed commit: "docs: respect banner expires field" | Re-trigger Greptile

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.03%. Comparing base (2661934) to head (b64256d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #602   +/-   ##
=======================================
  Coverage   79.03%   79.03%           
=======================================
  Files          48       48           
  Lines        7235     7235           
  Branches     7235     7235           
=======================================
  Hits         5718     5718           
  Misses       1140     1140           
  Partials      377      377           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jdx jdx merged commit 90ad7f1 into main Apr 23, 2026
12 checks passed
@jdx jdx deleted the claude/banner branch April 23, 2026 21:26
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.

1 participant