Skip to content

feat(usage-indicator): added ability to see current usage#925

Merged
waleedlatif1 merged 2 commits intostagingfrom
feat/usage-indicator
Aug 11, 2025
Merged

feat(usage-indicator): added ability to see current usage#925
waleedlatif1 merged 2 commits intostagingfrom
feat/usage-indicator

Conversation

@emir-karabeg
Copy link
Collaborator

Summary

Brief description of what this PR does and why.

Fixes #(issue)

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

How has this been tested? What should reviewers focus on?

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos

@vercel
Copy link

vercel bot commented Aug 9, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sim ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 9, 2025 8:12pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
docs ⬜️ Skipped (Inspect) Aug 9, 2025 8:12pm

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR introduces a comprehensive usage indicator feature that allows users to monitor their subscription billing usage directly from the sidebar. The implementation adds a new UsageIndicator component that displays current usage statistics with progress bars, plan information, and contextual upgrade prompts based on usage thresholds.

The feature integrates seamlessly with the existing sidebar architecture by adding the usage indicator above the navigation bar with proper spacing calculations. A companion SubscriptionModal component provides detailed plan comparison and upgrade functionality, replacing a previous implementation with improved data flow through a centralized Zustand subscription store.

Visual enhancements include new gradient color variables (vibrant purple and pink) added to both the global CSS and Tailwind configuration, enabling gradient text effects for paid plan names and styled badges. The usage indicator is conditionally rendered - hidden in development environments but visible in production - and includes loading states with skeleton components for smooth user experience.

The implementation follows established patterns in the codebase, using proper error handling, responsive design, and modular component architecture. The feature addresses a common UX need by providing immediate visibility into billing usage without requiring navigation to separate billing pages, while strategically prompting upgrades when users approach usage limits.

PR Description Notes:

  • The PR template is incomplete with empty sections for summary, issue reference, testing details, and missing checkboxes
  • No screenshots or videos are provided despite this being a UI-focused feature

Confidence score: 4/5

  • This PR introduces new functionality with proper integration patterns but has some implementation concerns that warrant review
  • Score reflects solid architectural choices but potential issues with error handling, environment detection, and missing test coverage
  • Pay close attention to usage-indicator.tsx and subscription-modal.tsx for proper error handling and data validation

7 files reviewed, 3 comments

Edit Code Review Bot Settings | Greptile

const currentUrl = window.location.origin + window.location.pathname

try {
const upgradeParams: any = {
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Using any type reduces type safety. Consider defining a proper interface for upgradeParams to ensure type correctness and better IntelliSense support.

Context Used: Context - Avoid using type assertions to 'any' in TypeScript. Instead, ensure proper type definitions are used to maintain type safety. (link)

await betterAuthSubscription.upgrade(upgradeParams)
} catch (error) {
logger.error('Failed to initiate subscription upgrade:', error)
alert('Failed to initiate upgrade. Please try again or contact support.')
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Using alert() for error handling provides poor UX. Consider using a toast notification or proper error state.

Comment on lines +61 to +67
const planType = subscription.isEnterprise
? 'enterprise'
: subscription.isTeam
? 'team'
: subscription.isPro
? 'pro'
: 'free'
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Complex nested ternary logic could be extracted into a separate function for better readability

@vercel vercel bot temporarily deployed to Preview – docs August 9, 2025 20:08 Inactive
@waleedlatif1 waleedlatif1 merged commit 83f1139 into staging Aug 11, 2025
5 checks passed
@waleedlatif1 waleedlatif1 deleted the feat/usage-indicator branch August 11, 2025 00:20
arenadeveloper02 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Sep 19, 2025
…i#925)

* feat(usage-indicator): added ability to see current usage

* feat(billing): added billing ennabled flag for usage indicator, enforcement of billing usage

---------

Co-authored-by: waleedlatif1 <walif6@gmail.com>
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