# Project TODO

## Database & Schema
- [x] Create subscription tiers table (free, paid monthly, paid annual)
- [x] Add subscription status to user schema
- [x] Create resources table for downloadable worksheets
- [x] Add Stripe customer ID and subscription ID to user schema

## Payment Integration
- [x] Integrate Stripe payment system
- [x] Create subscription plans (monthly and annual)
- [x] Implement subscription lifecycle management (sign-up, renewal, cancellation)
- [x] Add webhook handlers for Stripe events

## Public Landing Page
- [x] Design and build hero section with Parallel Builder branding
- [x] Add Parallel Builder Principles content sections
- [x] Add Stadium Rules content
- [x] Implement Join/Sign Up CTA buttons
- [x] Add navigation with login link
- [x] Make fully responsive for mobile and desktop

## Authentication & User Management
- [x] Implement secure user registration
- [x] Add login/logout functionality
- [x] Create user profile management page
- [x] Add role-based access control (free vs paid members)

## Free Member Area
- [x] Create free member dashboard
- [x] Add all Parallel Builder Principle texts
- [x] Add Principle Extracted sections
- [x] Add Stadium Rule content
- [x] Implement basic NicheVet app (static HTML/JS)
- [x] Add downloadable worksheets (First Territory Mapping, Walkaway Power, Monopoly Context Canvas, Asset Audit, First Engine Blueprint)
- [x] Protect with authentication wall

## Paid Member Area
- [x] Create paid member dashboard
- [x] Build advanced AI-powered NicheVet app with LLM integration
- [x] Add real-time analysis features
- [x] Implement additional permission checks for paid tier
- [x] Add subscription management interface

## Content & Resources
- [x] Create sample Parallel Builder Principle content
- [x] Generate worksheet PDFs for download
- [x] Build basic NicheVet app (first iteration)
- [x] Build AI-powered NicheVet app (robust iteration)

## Design & Branding
- [x] Choose professional color scheme for Parallel Builder brand
- [x] Select appropriate typography
- [x] Design trustworthy, modern UI components
- [x] Ensure consistent branding across all pages
- [x] Optimize for mobile responsiveness

## Testing & Deployment
- [x] Test user registration and authentication flow
- [x] Test free member access and content gating
- [x] Test paid subscription flow with Stripe
- [x] Test AI-powered NicheVet app functionality
- [x] Verify all downloadable resources work correctly
- [x] Test on mobile and desktop devices
- [x] Create final checkpoint


## Community Comment System
- [x] Create comments database table with user associations
- [x] Add comment CRUD operations to backend API
- [x] Build comment UI component with reply functionality
- [x] Integrate comments into Principle content pages
- [x] Add comment moderation capabilities
- [x] Test comment posting, editing, and deletion

## Notification System
- [x] Create notifications database table
- [x] Build notification API endpoints (create, read, mark as read)
- [x] Implement email notification service
- [x] Create in-app notification UI component
- [x] Add notification bell icon to navigation
- [x] Integrate notifications with comment reply system
- [ ] Add email notification preferences
- [x] Test notification delivery and display

## User Profile Page
- [x] Build backend API to fetch user profile data
- [x] Create API endpoint for user comment history
- [x] Design profile page layout with member info
- [x] Display subscription status and tier
- [x] Show member since date and activity stats
- [x] Add comment history section with pagination
- [x] Add profile navigation link
- [x] Test profile page functionality

## Avatar Upload Feature
- [x] Add avatarUrl field to user schema
- [x] Create avatar upload API endpoint with S3 integration
- [x] Add file size and type validation (max 5MB, jpg/png only)
- [x] Build avatar upload UI component with image preview
- [x] Add avatar cropping/resizing functionality
- [x] Update profile page to display custom avatars
- [x] Show avatars in comment sections
- [x] Test avatar upload and display

## Image Cropper Integration
- [x] Install react-easy-crop library
- [x] Update AvatarUpload component with cropping UI
- [x] Add zoom and rotation controls
- [x] Implement crop area adjustment
- [x] Process cropped image before upload
- [x] Test cropping functionality

## Rotation Control for Image Cropper
- [x] Add rotation state to AvatarUpload component
- [x] Implement rotation slider UI (0-360 degrees)
- [x] Connect rotation to react-easy-crop
- [x] Test rotation with various images

## Flip Controls for Image Cropper
- [x] Add horizontal and vertical flip state
- [x] Create flip button UI with icons
- [x] Implement flip transform in image processing
- [x] Test flip functionality with various images

## Real-Time Avatar Preview
- [x] Add preview canvas component
- [x] Implement real-time preview rendering
- [x] Update preview on zoom/rotation/flip/crop changes
- [x] Test preview updates with various images

## Image Adjustment Filters
- [x] Add brightness, contrast, and saturation state
- [x] Create adjustment slider controls
- [x] Apply CSS filters to preview canvas
- [x] Apply filters to final uploaded image
- [x] Test adjustments with various images

## Preset Filter Buttons
- [x] Define preset filter configurations (Vivid, Soft, B&W, Auto Enhance)
- [x] Create preset filter button UI
- [x] Implement one-click filter application
- [x] Test preset filters with various images

## Enhanced Filter Button Labels
- [x] Add descriptive labels to preset filter buttons
- [x] Add icons to each filter button
- [x] Implement tooltips with detailed filter descriptions
- [x] Improve button layout and styling
- [x] Test enhanced UI

## Reset to Default Button
- [x] Create comprehensive reset function for all adjustments
- [x] Add prominent reset button to UI
- [x] Reset zoom, rotation, flip, and all filters
- [x] Test reset functionality

## Zoom Preset Buttons
- [x] Extend zoom slider range from 0.25x to 2x
- [x] Add zoom preset buttons (.25x, .5x, 1x, 1.5x, 2x)
- [x] Update zoom slider min/max values
- [x] Test zoom presets with various images

## Comment Upvoting System
- [x] Create commentVotes database table with user-comment relationship
- [x] Add upvoteCount field to comments table
- [x] Implement backend API for upvoting/removing votes
- [x] Add API endpoint to check if user has voted on a comment
- [x] Create thumbs-up button component with vote count display
- [x] Implement optimistic UI updates for instant feedback
- [x] Add "Most Helpful" sorting option to comment sections
- [x] Prevent users from voting on their own comments
- [x] Show visual indicator when user has upvoted a comment
- [x] Write comprehensive tests for voting functionality

## Comment Downvoting System
- [x] Add downvoteCount field to comments table
- [x] Update commentVotes table to track vote type (upvote/downvote)
- [x] Implement backend API for downvoting/removing downvotes
- [x] Create thumbs-down button component with downvote count display
- [x] Implement optimistic UI updates for downvote actions
- [x] Update sorting to use net score (upvotes - downvotes)
- [x] Prevent users from voting on their own comments (both up and down)
- [x] Show visual indicator when user has downvoted a comment
- [x] Allow users to switch between upvote and downvote
- [x] Write comprehensive tests for downvoting functionality

## Comment Reporting System
- [x] Create commentReports database table with report categories
- [x] Define report categories (spam, harassment, misinformation, other)
- [x] Implement backend API for submitting reports
- [x] Add API endpoint to get reports for admin review
- [x] Create Report button component in comment UI
- [x] Build report dialog with category selection and optional details
- [x] Prevent users from reporting the same comment multiple times
- [x] Send admin notification when comment is reported
- [x] Track report status (pending, reviewed, dismissed, action_taken)
- [x] Write comprehensive tests for reporting functionality

## Admin Moderation Dashboard
- [x] Create /admin/reports page route
- [x] Build sortable table component for displaying reports
- [x] Add filters for report category (spam, harassment, misinformation, other)
- [x] Add filters for report status (pending, reviewed, dismissed, action_taken)
- [x] Display report details (reporter, comment text, category, timestamp)
- [x] Add quick-action buttons (Dismiss, Mark Reviewed, Delete Comment)
- [ ] Implement bulk actions for multiple reports
- [x] Show comment context and link to original content
- [x] Add pagination for large report lists
  - [x] Implement backend pagination with limit/offset
  - [x] Add page size selector (25, 50, 100 per page)
  - [x] Create pagination navigation controls (prev/next, page numbers)
  - [x] Show total count and current range (e.g., "Showing 1-25 of 150")
  - [x] Persist page size preference in local state
  - [x] Handle edge cases (empty results, single page)
  - [x] Write tests for pagination logic
- [x] Write comprehensive tests for admin dashboard functionality

## Bulk Moderation Actions
- [x] Add checkbox selection to report table rows
- [x] Implement "Select All" / "Deselect All" functionality
- [x] Create bulk action toolbar with action buttons
- [x] Implement backend API for bulk dismiss reports
- [x] Implement backend API for bulk delete comments
- [x] Implement backend API for bulk update report status
- [x] Add confirmation dialogs for destructive bulk actions
- [x] Show success/error feedback after bulk operations
- [x] Update UI state after bulk actions complete
- [x] Write comprehensive tests for bulk operations

## Admin Reports Search
- [x] Add search parameter to backend API
- [x] Implement text search across comment content, reporter name, and author name
- [x] Add search input field to admin reports page
- [x] Implement real-time search with debouncing
- [x] Reset to page 1 when search query changes
- [x] Show "No results found" message for empty search results
- [x] Clear search button to reset filters
- [x] Write comprehensive tests for search functionality

## CSV Export for Admin Reports
- [x] Add backend API endpoint to export reports as CSV
- [x] Include all current filters (status, category, search) in export
- [x] Format CSV with proper headers and data escaping
- [x] Add Export CSV button to admin reports page
- [x] Generate filename with timestamp for downloads
- [x] Handle large datasets efficiently (streaming or pagination)
- [x] Show loading state during export generation
- [x] Write comprehensive tests for export functionality

## Auto-Moderation Settings
- [x] Create moderationSettings database table
- [x] Define rule types (auto-hide, auto-escalate, auto-flag-user)
- [x] Implement backend API to get/update moderation settings
- [x] Create /admin/settings page route
- [x] Build settings UI with threshold inputs for each rule type
- [x] Add toggle switches to enable/disable rules
- [x] Implement auto-hide logic when report threshold is reached
  - [x] Check settings after each report submission
  - [x] Hide comment when threshold reached
  - [x] Update comment isDeleted flag
- [x] Implement auto-escalate (owner notification) for harassment reports
  - [x] Check if harassment report and escalation enabled
  - [x] Send owner notification with report details
- [x] Implement auto-flag-user when user has multiple reported comments
  - [x] Count reported comments per user
  - [x] Track flagged users in database or notifications
- [x] Write comprehensive tests for enforcement logic
- [x] Write comprehensive tests for auto-moderation rules

## Moderation Activity Log
- [x] Create moderationActivityLog database table
- [x] Define log entry fields (timestamp, rule type, action, comment ID, user ID, details)
- [x] Add logging calls in auto-hide enforcement
- [x] Add logging calls in auto-escalate enforcement
- [x] Add logging calls in auto-flag enforcement
- [x] Implement backend API to get activity logs with pagination
- [x] Add filtering by rule type and date range
- [x] Create /admin/activity page route
- [x] Build activity log table with sortable columns
- [x] Display rule type, timestamp, affected content, and action taken
- [x] Add link to view related comment/user
- [x] Write comprehensive tests for activity logging

## User Reputation System
- [x] Add reputation score field to user schema
- [x] Create backend function to calculate user reputation from votes
- [x] Implement automatic reputation updates when votes change
- [x] Add API endpoint to get user reputation stats
- [x] Define reputation badges and thresholds (Newcomer, Contributor, Expert, etc.)
- [x] Display reputation score on user profile page
- [x] Show reputation badge with icon on profile
- [x] Display reputation in comment sections next to usernames
  - [x] Update backend comment queries to include user reputation
  - [x] Create reputation badge component
  - [x] Add reputation display to CommentSection component
  - [x] Show badge icon and score next to username
  - [x] Write tests for reputation display
- [x] Create reputation leaderboard page
  - [x] Add backend API to get top users by reputation
  - [x] Create /leaderboard page route
  - [x] Build leaderboard UI with rankings table
  - [x] Display rank, username, reputation score, badge, comment count
  - [x] Add navigation link to leaderboard in menu
  - [x] Write tests for leaderboard
- [x] Add reputation breakdown (total upvotes, downvotes, net score)
- [x] Write comprehensive tests for reputation calculations

## Time-Based Leaderboard Filtering
- [x] Add time-based filtering to leaderboard
  - [x] Update commentVotes schema to include createdAt timestamp
  - [x] Update backend API to support timeframe parameter (daily, weekly, monthly, all-time)
  - [x] Calculate reputation scores based on votes within timeframe
  - [x] Add filter tabs/buttons to leaderboard UI
  - [x] Update leaderboard display based on selected timeframe
  - [x] Write tests for time-based filtering logic
  - [x] Test all timeframes (daily, weekly, monthly, all-time)
