feat: add Usage Limits Panel component with usage tracking and visual indicators for limits

style: implement custom color schemes and gradients for account section, enhancing visual hierarchy
This commit is contained in:
IGNY8 VPS (Salman)
2025-12-12 13:15:15 +00:00
parent 12956ec64a
commit 6e2101d019
29 changed files with 3622 additions and 85 deletions

View File

@@ -1,4 +1,226 @@
# Tenancy Change Log - December 9, 2025
# IGNY8 Change Log
**Current Version:** v1.0.1
**Last Updated:** December 12, 2025
---
## v1.0.1 - December 12, 2025
### Fixed
- Usage summary endpoint routing - added direct URL path for `/api/v1/billing/usage-summary/` as standalone user-facing endpoint (separated from admin-only `BillingViewSet`)
- Endpoint accessibility issue - properly registered `get_usage_summary` function view in billing URLs
### Added
- **Frontend Plan Limits Display**: Complete UI integration for usage tracking and limits
- `UsageLimitsPanel` component - visual progress bars for all plan limits with color-coded status (blue/yellow/red)
- Plan Limits tab in Usage Analytics page (now default/first tab)
- Limit display in pricing table comparison with "Unlimited" formatting for high values
- Days until reset counter for monthly limits
- Upgrade CTA when approaching limits
- **IGNY8 Brand Styling**: Custom CSS design system for account section (`account-colors.css`)
- Brand gradients (primary blue, success green, warning amber, danger red, purple, teal)
- Enhanced card variants with top color bars
- Animated progress bars with shimmer effects
- Stat numbers with gradient text effects
- Custom badges and plan cards
- Billing tables with hover effects
- Dark mode support throughout
### Changed
- Usage Analytics page tab order - Plan Limits now first tab, followed by Credit Usage, Credit Balance, API Usage, Cost Breakdown
- Pricing table enhanced to display all plan limits (sites, users, words/month, ideas/month, images/month, credits/month)
- Plans and Billing page now passes complete limit data to pricing table component
### Documentation
- Added API endpoint rules to `.cursorrules` - enforce using existing `/api/v1/` structure, test via `/api/docs/` Swagger, no parallel API systems
- Updated `PLAN-LIMITS.md` with correct endpoint path documentation
---
## v1.0.0 - December 12, 2025 (Production Release)
### 🎉 INITIAL PRODUCTION RELEASE
This marks the first production-ready release of IGNY8, featuring a complete multi-tenant AI-powered content platform.
### 🆕 Latest Additions (v1.0.0 Final)
**Plan Limits System** - Implemented comprehensive usage limits tied to subscription plans:
- **Hard Limits** (persistent, never reset):
- `max_sites`: Maximum number of sites per account
- `max_users`: Maximum team members
- `max_keywords`: Total keywords allowed
- `max_clusters`: Total clusters allowed
- **Monthly Limits** (reset on billing cycle):
- `max_content_ideas`: New content ideas per month
- `max_content_words`: Words generated per month
- `max_images_basic`: Basic AI images per month
- `max_images_premium`: Premium AI images per month
- `max_image_prompts`: Image prompts per month
- **Enforcement Features**:
- Pre-operation validation (blocks exceeding actions)
- Real-time usage tracking and incrementation
- Automatic monthly reset via Celery Beat task
- Usage summary API endpoint (`/api/v1/billing/usage-summary/`)
- Warning notifications at 80% threshold
- Clear error messages with upgrade prompts
- **Technical Implementation**:
- `PlanLimitUsage` model tracks monthly consumption
- `LimitService` handles all check/increment/reset operations
- `word_counter.py` utility for accurate HTML word counting
- Integrated into Site creation, content generation, image generation
- Celery scheduled tasks: `reset_monthly_plan_limits` (daily), `check_approaching_limits` (daily)
### ✨ Core Features Implemented
**Multi-Tenancy System:**
- Complete account isolation with row-level security
- Multi-site management per account
- Sector-based content organization
- Role-based access control (Owner, Admin, Editor, Viewer)
- Session management with Redis backend
- JWT authentication with refresh tokens
**Planner Module:**
- Bulk keyword import (CSV, unlimited rows)
- AI-powered keyword clustering (GPT-4)
- Global seed keyword database (50+ industries)
- Content idea generation from clusters
- Search intent classification
- Advanced filtering and search
**Writer Module:**
- AI content generation (GPT-4, customizable word counts)
- Task management and queuing
- Content taxonomy system (categories, tags)
- HTML content editor integration
- SEO metadata management
- Status workflow (draft, review, published)
**Image Generation:**
- Dual AI providers (DALL-E 3, Runware)
- Featured and in-article images
- Smart prompt extraction from content
- Multiple image sizes and formats
- Automatic alt text generation
- Batch image processing
**Automation Pipeline:**
- 7-stage automation (keywords → clusters → ideas → tasks → content → prompts → images)
- Scheduled runs (daily, weekly, monthly)
- Configurable batch sizes and delays
- Credit estimation and buffering
- Pause/resume functionality
- Detailed activity logging
**Internal Linking:**
- AI-powered link candidate discovery
- Relevance scoring and smart injection
- Context-aware anchor text
- Bi-directional linking
- Link density control
**Content Optimization:**
- 15+ factor SEO analysis
- Readability scoring
- AI-powered content enhancement
- Before/after comparison
- Batch optimization support
**WordPress Integration:**
- One-click publishing to WordPress
- Bidirectional status sync
- Taxonomy synchronization
- Featured image upload
- SEO metadata sync
- Multiple site support
- API key authentication
**Billing & Credits:**
- Usage-based credit system
- Plan-based hard limits (sites, users, keywords, clusters)
- Monthly usage limits (content ideas, words, images, prompts)
- Automatic limit enforcement with clear error messages
- Real-time usage tracking and reporting
- Monthly limit reset on billing cycle
- Usage warning notifications
- Multiple payment methods (Bank Transfer, Mobile Wallet, Stripe*, PayPal*)
- Invoice generation and management
- Credit transaction tracking
- Multi-currency support (8 currencies)
- Manual payment approval workflow
**Enterprise Features:**
- Team collaboration and user management
- Activity logging and audit trails
- API access with rate limiting
- Comprehensive analytics and reporting
- Data export capabilities
### 🏗️ Technical Stack
**Backend:**
- Django 5.x + Django REST Framework
- PostgreSQL 14+ (production)
- Redis 7+ (cache and sessions)
- Celery + Celery Beat (task queue)
- JWT authentication
- Docker containerization
**Frontend:**
- React 19 + TypeScript
- Vite 6 (build tool)
- Zustand 5 (state management)
- TailwindCSS 4 (styling)
- React Router 7 (routing)
- Custom component library
**AI Integration:**
- OpenAI GPT-4, GPT-4 Turbo, GPT-3.5 Turbo
- OpenAI DALL-E 3, DALL-E 2
- Runware image generation
### 📊 Platform Statistics
- 50+ backend API endpoints
- 100+ React components
- 15+ database models
- 20+ Celery tasks
- Support for 8 currencies
- 50+ industry templates
### 🔒 Security & Compliance
- Encrypted data at rest and in transit
- GDPR compliance ready
- Session integrity validation
- CORS and CSRF protection
- SQL injection prevention
- Rate limiting per scope
### 📚 Documentation
- Complete API documentation (OpenAPI 3.0)
- Frontend component library docs
- Admin guides and workflows
- Multi-tenancy architecture docs
- Payment workflow guides
### ⚠️ Known Limitations
- Stripe integration disabled (pending production credentials)
- PayPal integration disabled (pending production credentials)
- Some analytics features in development
---
## Tenancy Change Log - December 9, 2025
## Summary
This document tracks all changes made to the multi-tenancy system during the current staging session and the last 2 commits (4d13a570 and 72d0b6b0).