reference

Encouragement Badge System

Overview

The Encouragement Badge System is a progressive ranking system that rewards users for successfully encouraging others through the drops system. As users send drops that lead to engagement increases, they earn higher badge rankings.

Badge Progression

The system includes 7 badge levels, each with unique names, emojis, and colors:

  1. 🌱 Seedling (Level 1)

    • Starting badge for all users
    • 0+ successful drops
    • Color: Light Green (#90EE90)
  2. 🌿 Sprout (Level 2)

    • Growing encouragement skills
    • 6+ successful drops
    • Color: Lawn Green (#7CFC00)
  3. 🌸 Bloom (Level 3)

    • Encouragement is blossoming
    • 21+ successful drops
    • Color: Hot Pink (#FF69B4)
  4. 🐝 Pollinator (Level 4)

    • Spreading encouragement far and wide
    • 51+ successful drops
    • Color: Gold (#FFD700)
  5. 🍯 Hive Keeper (Level 5)

    • A trusted source of encouragement
    • 151+ successful drops
    • Color: Dark Orange (#FF8C00)
  6. 👑 Queen Bee (Level 6)

    • A master of encouragement
    • 501+ successful drops
    • Color: Medium Slate Blue (#9370DB)
  7. ⭐ Hive Legend (Level 7)

    • A legendary encourager
    • 1501+ successful drops
    • Color: Gold (#FFD700)

Badge Calculation

Badges are calculated based on:

  • Total Engagement Increases: Number of drops that led to recipient engagement
  • Success Rate: Percentage of drops that resulted in engagement (optional requirement)
  • Consecutive Days: Days in a row with at least one drop sent (optional requirement)

The system automatically:

  • Tracks all drops sent and their outcomes
  • Calculates success rates
  • Monitors consecutive days
  • Updates badges when users qualify for higher levels
  • Records milestone achievements

Database Schema

Tables

  • encouragement_badges: User badge information

    • Current badge and level
    • Total drops sent, engagement increases, success rate
    • Bonus drops earned, consecutive days
    • Badge progress toward next level
  • badge_definitions: Badge definitions and requirements

    • Badge name, level, display info
    • Minimum requirements (engagement increases, success rate, consecutive days)
    • Visual properties (emoji, color)
  • badge_milestones: Historical record of badge achievements

    • When each badge was achieved
    • Stats at time of achievement

API Endpoints

User Endpoints

  • GET /api/encouragement-drops/badge - Get current user's badge
  • GET /api/encouragement-drops/badge/:userId - Get badge for specific user
  • POST /api/encouragement-drops/badge/update - Manually trigger badge update
  • POST /api/encouragement-drops/badges/bulk - Get badges for multiple users
  • GET /api/encouragement-drops/badge/milestones - Get user's badge milestones
  • GET /api/encouragement-drops/leaderboard - Get encouragement leaderboard
  • GET /api/encouragement-drops/badge-definitions - Get all badge definitions

Automatic Badge Updates

Badges are automatically updated:

  1. After Sending Drop: When a user sends a drop, their badge is recalculated
  2. After Engagement Check: When engagement is detected, sender's badge is updated
  3. Cron Processing: During engagement processing, badges for recent senders are updated

UI Integration

Stream View

  • Avatar Badge: Badge displayed on user avatars in the Stream
  • Hover Preview: Badge shown in entry hover preview with progress
  • Tooltip: Shows badge name, description, and stats on hover

Badge Display Component

The BadgeDisplay component shows:

  • Badge icon (emoji) with color-coded border
  • Tooltip with badge information
  • Progress bar toward next badge (optional)
  • Responsive sizing (sm, md, lg)

Badge Progress

Users can see their progress toward the next badge:

  • Progress Percentage: How close they are to the next badge
  • Engagement Increases Needed: How many more successful drops needed
  • Next Badge: Preview of the next badge they can earn

Leaderboard

The system includes a leaderboard showing top encouragers:

  • Ranked by total engagement increases
  • Secondary sort by success rate
  • Shows badge level and stats
  • Configurable limit (default: 50)

Milestones

When users achieve a new badge:

  • Milestone is recorded with timestamp
  • Stats at achievement time are saved
  • Users can view their milestone history
  • Milestones are public (visible to all users)

Best Practices

  1. Regular Updates: Badges update automatically, but manual updates are available
  2. Progress Visibility: Show progress bars to motivate users
  3. Celebration: Consider notifications when users achieve new badges
  4. Leaderboard: Display leaderboard to encourage competition
  5. Badge Definitions: Keep badge requirements balanced and achievable

Future Enhancements

  • Badge Notifications: Notify users when they achieve new badges
  • Badge Showcase: Dedicated page to view all badges and progress
  • Badge Rewards: Special rewards for achieving certain badges
  • Badge Sharing: Share badge achievements on social media
  • Custom Badges: Special badges for unique achievements
  • Badge Analytics: Track badge distribution and progression rates
ENCOURAGEMENT BADGES — Docs | HiveJournal