Add 90-day timespan option and change default to 30d#252
Add 90-day timespan option and change default to 30d#252rajivsinclair wants to merge 1 commit intotrending-uifrom
Conversation
- Add '90d' to Timespan type union in useSnippetFilters.tsx - Add 90d option to TIMESPAN_OPTIONS array in trending-card.tsx - Change default timespan from 'all' to '30d' for better initial load performance 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @rajivsinclair, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Trending Topics feature by introducing a new 90-day timespan option and optimizing the user experience by setting the default timespan to 30 days instead of "All". These changes are primarily additive, involving updates to type definitions and UI options, and are designed to improve performance without altering core filtering logic. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed everything up to 21df5d8 in 1 minute and 31 seconds. Click for details.
- Reviewed
34lines of code in2files - Skipped
0files when reviewing. - Skipped posting
2draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. src/components/ui/trending-card.tsx:89
- Draft comment:
Default state for timespan updated to '30d'. Note that useSnippetFilters still defaults to '7d' – consider syncing these defaults for a consistent behavior. - Reason this comment was not posted:
Comment looked like it was already resolved.
2. src/hooks/useSnippetFilters.tsx:44
- Draft comment:
The fallback default for timespan remains '7d'. If the new default is intended to be '30d' everywhere, update this fallback accordingly. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
Workflow ID: wflow_Ei9X7Vp23dA5TxqV
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
There was a problem hiding this comment.
Code Review
This pull request correctly adds a '90d' timespan option and changes the default timespan to '30d' for better performance, as described. The changes are straightforward and well-documented in the pull request description. I have one suggestion regarding maintainability: to centralize the definition of timespan options and the Timespan type to prevent them from becoming out of sync in the future. This would make the code more robust and easier to maintain.
| { value: '24h', label: '24h' }, | ||
| { value: '7d', label: '7d' }, | ||
| { value: '30d', label: '30d' }, | ||
| { value: '90d', label: '90d' }, |
There was a problem hiding this comment.
While adding this new option is correct, there's an opportunity to improve long-term maintainability. Currently, the Timespan type is defined in src/hooks/useSnippetFilters.tsx while the TIMESPAN_OPTIONS array is defined here. This separation means that adding or removing a timespan requires changes in two different files, which can be error-prone.
To create a single source of truth, you could define the TIMESPAN_OPTIONS array in useSnippetFilters.tsx and derive the Timespan type from it. For example:
// In src/hooks/useSnippetFilters.tsx
export const TIMESPAN_OPTIONS = [
{ value: '24h', label: '24h' },
{ value: '7d', label: '7d' },
{ value: '30d', label: '30d' },
{ value: '90d', label: '90d' },
{ value: 'all', label: 'All' }
] as const;
export type Timespan = (typeof TIMESPAN_OPTIONS)[number]['value'];You could then export TIMESPAN_OPTIONS from useSnippetFilters.tsx and import it here. This would ensure the type and the options are always synchronized.
There was a problem hiding this comment.
Pull request overview
This PR enhances the Trending Topics feature by adding a 90-day timespan option and improving initial load performance by changing the default timespan from "All" to "30d". The changes are minimal, type-safe, and well-integrated with existing backend support.
Key changes:
- Extended the
Timespantype union to include'90d' - Added 90d option to the timespan selector UI
- Changed default timespan from
'all'to'30d'for better performance
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/hooks/useSnippetFilters.tsx |
Extended Timespan type definition to include '90d' option |
src/components/ui/trending-card.tsx |
Added 90d to timespan selector options and changed default state from 'all' to '30d' |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
This PR adds a 90-day (90d) timespan option to the Trending Topics feature and changes the default from "All" to "30d" for better performance.
Changes Made
1.
src/hooks/useSnippetFilters.tsx(line 4)Before:
export type Timespan = '24h' | '7d' | '30d' | 'all'After:
export type Timespan = '24h' | '7d' | '30d' | '90d' | 'all''90d'to the TypeScript union type2.
src/components/ui/trending-card.tsx(lines 37-43)Before:
After:
3.
src/components/ui/trending-card.tsx(line 89)Before:
const [timespan, setTimespan] = useState<Timespan>('all')After:
const [timespan, setTimespan] = useState<Timespan>('30d')Backend Support
The Supabase RPC functions
get_trending_topicsandget_topic_detailsalready support '90d' via migrations:20251126072129_add_90d_support_to_get_trending_topics20251126072204_add_90d_support_to_get_topic_detailsThe 90d option uses:
Implementation Analysis
Why this approach is optimal:
What was NOT changed (and why):
handleTopicClickandhandleExitFocusModefunctions remain identicaluseSnippetFiltershook'ssetFiltersfunction is unchangedRisk Assessment
Low risk - These changes are purely additive:
No breaking changes to:
Testing Checklist
Deployment Notes
For Fly.io deployment, remember to include build args:
🤖 Generated with Claude Code
Important
Adds 90-day timespan option to Trending Topics and changes default to 30 days for better performance.
Timespantype inuseSnippetFilters.tsx.TIMESPAN_OPTIONSintrending-card.tsxto include '90d'.trending-card.tsx.get_trending_topicsandget_topic_detailsalready support '90d'.This description was created by
for 21df5d8. You can customize this summary. It will automatically update as commits are pushed.