Skip to content

Add admin activity management: delete, create, and category awards#239

Merged
prazgaitis merged 3 commits into
mainfrom
claude/activity-management-features-o0Gu9
Apr 1, 2026
Merged

Add admin activity management: delete, create, and category awards#239
prazgaitis merged 3 commits into
mainfrom
claude/activity-management-features-o0Gu9

Conversation

@prazgaitis
Copy link
Copy Markdown
Owner

Summary

Adds three admin activity management features:

  1. Admin Delete Activity — New adminDeleteActivity mutation that soft-deletes activities and reverses all associated points, streaks, and category metrics. Added delete button with confirmation dialog to the flagged activity detail view.

  2. Admin Create Activity Page — New admin page at /challenges/[id]/admin/log-activity with adminLogActivityForUser mutation. Allows admins to manually log activities on behalf of participants with optional points override and notes.

  3. Category Leaders 4th/5th Place — Extended previewWeeklyAwards query to return top 5 placements instead of top 3. Updated category leaders page to display 4th and 5th place with muted styling and zero bonus points.

Changes

  • Backend mutations (packages/backend/mutations/admin.ts):

    • adminDeleteActivity: Soft-deletes activity, reverses points/streaks/category metrics, adds history entry
    • adminLogActivityForUser: Creates activity for user with auto-calculated or overridden points
  • Backend queries (packages/backend/queries/categoryLeaderAwards.ts):

    • previewWeeklyAwards: Returns top 5 placements (was top 3)
  • Frontend pages:

    • New /challenges/[id]/admin/log-activity/page.tsx with form for creating activities
    • Updated /challenges/[id]/admin/layout.tsx to add "Log Activity" nav item
  • Frontend components (apps/web/components/admin/flagged-activity-actions.tsx):

    • Added delete button with confirmation dialog
    • Integrated adminDeleteActivity mutation
  • Admin category leaders (apps/web/app/challenges/[id]/admin/category-leaders/page.tsx):

    • Display 4th/5th place entries with reduced opacity
    • Show placement number instead of icon for honorable mentions
    • Muted text colors for non-top-3 entries

Testing

  • pnpm lint
  • pnpm typecheck
  • Verify admin can delete activities and points are reversed
  • Verify admin can create activities with auto-calculated or custom points
  • Verify category leaders shows top 5 with correct styling and zero bonus for 4th/5th

Notes

  • Delete operations are soft-deletes with audit trail via activityFlagHistory
  • Activity creation respects challenge admin permissions (global admin, creator, or challenge admin)
  • Points reversal includes category metrics and weekly category tracking

https://claude.ai/code/session_01FeKkPoze9PtGE659HyhKjA

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
march-fitness-2025 Ready Ready Preview, Comment Apr 1, 2026 4:12pm

Request Review

claude and others added 3 commits April 1, 2026 11:08
- Admin delete activity: adds delete button with confirmation dialog to flagged
  activity detail view, with backend mutation that soft-deletes and reverses all
  points/streaks/category scores
- Admin log activity: new page at /admin/log-activity for creating activities on
  behalf of participants, with user/type selectors and optional points override
- Category leaders: show 4th and 5th place entries in admin preview with muted
  styling and no bonus points awarded (only top 3 receive awards)

https://claude.ai/code/session_01FeKkPoze9PtGE659HyhKjA
@prazgaitis prazgaitis force-pushed the claude/activity-management-features-o0Gu9 branch from 72e4dcc to cf8c5e7 Compare April 1, 2026 16:11
@prazgaitis prazgaitis merged commit 01bccdf into main Apr 1, 2026
5 checks passed
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