Skip to content

feat: add new features for patch 16#23

Merged
mehdiasadli merged 1 commit into
mainfrom
v26-04-16
Apr 28, 2026
Merged

feat: add new features for patch 16#23
mehdiasadli merged 1 commit into
mainfrom
v26-04-16

Conversation

@mehdiasadli
Copy link
Copy Markdown
Contributor

@mehdiasadli mehdiasadli commented Apr 28, 2026

Summary by CodeRabbit

  • New Features

    • Share dialog for live game codes with direct sharing to WhatsApp, Telegram, Discord, Twitter, and Facebook
    • Admin dashboard section for badge catalog management with search and filtering options
    • Three new achievement badges: "abomination," "genius," and "dunce"
  • UX Improvements

    • Profile badges section redesigned with compact layout and responsive grid columns

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 28, 2026

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

Project Deployment Actions Updated (UTC)
xamsa-web Ready Ready Preview, Comment Apr 28, 2026 10:04am

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 28, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR introduces an admin badges listing system with filtering and sorting, adds three new badge types (abomination, genius, dunce) with awarding logic during game finalization, replaces clipboard-copy behavior with a share-sheet flow for game invites, and adjusts dashboard navigation and profile badge density.

Changes

Cohort / File(s) Summary
Admin Badges Listing System
apps/web/src/components/admin/filters/admin-badges-filters.tsx, apps/web/src/routes/dashboard/badges/index.tsx, packages/api/src/modules/admin/..., packages/schemas/src/modules/admin.ts, packages/schemas/src/modules/listings/admin.ts
New staff dashboard page for badge catalog with filtering UI (period, type, category, award/earner thresholds), sorting, pagination, and backend query service aggregating badge stats via SQL.
Badge Definitions & Schema
packages/schemas/src/modules/badge.ts, packages/utils/src/badges.ts, packages/api/src/modules/badge/topic-badges.ts
Adds three new badge IDs (abomination, genius, dunce) to schema enums and badge catalog with metadata. Implements topic-level abomination awarding for all-incorrect answers and extends topic-badge logic.
Game Share Flow
apps/web/src/components/game-header.tsx, apps/web/src/components/game-share-sheet.tsx, apps/web/src/lib/game-share.ts
Replaces clipboard-copy invite behavior with a share-sheet dialog supporting native navigator.share, platform-specific URLs (WhatsApp, Telegram, Discord, Twitter, Facebook), and fallback copy actions with toast feedback.
Dashboard & Navigation Updates
apps/web/src/routes/dashboard.tsx, apps/web/src/routes/dashboard/index.tsx, apps/web/src/routeTree.gen.ts
Adds "Badges" section to dashboard navigation and creates new route entry at /dashboard/badges/ with updated router type mappings.
UI Layout & Documentation
apps/web/src/components/profile-badges-section.tsx, apps/web/src/components/start-game-card.tsx, draft.txt, packages/utils/src/app-releases.ts
Compacts badge grid and component spacing for denser layout; updates game-start instructions to reference Share control; increments release version with feature highlights.
Game Finalization Badge Awards
packages/api/src/modules/game/finalize-game.ts
Adds logic to compute and award genius (strictly positive net points on all topics) and dunce (non-positive net points on all topics) badges per player after ranks are persisted.

Sequence Diagrams

sequenceDiagram
    participant User as Staff User
    participant UI as Filter UI
    participant Router as API Router
    participant Service as Admin Service
    participant DB as Database
    
    User->>UI: Click badges, apply filters (period, type, category, min/max)
    UI->>Router: POST /admin.listBadges { filters, sort, pagination }
    Router->>Service: listAdminBadges(input)
    Service->>DB: Query badge awards aggregated by badge ID
    DB-->>Service: Award totals & distinct earners
    Service->>Service: Apply text/category/period/type filters<br/>Apply numeric range filters<br/>Sort in-memory<br/>Paginate results
    Service-->>Router: Paginated badge catalog results
    Router-->>UI: Badge list with stats
    UI-->>User: Render table with columns (id, name, period, type,<br/>category, total awards, distinct earners)
Loading
sequenceDiagram
    participant Host as Game Host
    participant Header as Game Header
    participant Sheet as Share Sheet
    participant Nav as Native/Platform
    participant Clipboard as Clipboard API
    
    Host->>Header: Click "Share" button
    Header->>Sheet: open=true with context (code, invite URL, pack name)
    Sheet->>Sheet: Generate share body text
    Sheet->>Sheet: Compute platform URLs (WhatsApp, Telegram, etc.)
    Host->>Sheet: Select share option (native share, platform, or copy)
    Sheet->>Nav: navigator.share({ title, text, url })
    Nav-->>Host: Native share sheet / fallback
    alt Clipboard copy
        Sheet->>Clipboard: Copy room code or invite link
        Clipboard-->>Sheet: Success
        Sheet->>Sheet: Set copiedCode/copiedLink state<br/>Show toast notification<br/>Render check icon
    end
    Host->>Sheet: Dismiss
    Sheet->>Header: onOpenChange(false)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~55 minutes

Possibly related PRs

  • Implement badges, individual version pages, better sitemap #16 — Implements the same badge feature surface (new badge schemas, APIs, routes, and UI components) with direct code-level overlap.
  • Fix bugs #11 — Modifies packages/api/src/modules/game/finalize-game.ts to add genius/dunce badge awarding logic during game finalization; related control flow changes.
  • Feat/game #3 — Modifies game header and share-sheet files (game-header.tsx, game-share-sheet.tsx, game-share.ts) to replace copy behavior with native sharing flow.

Suggested labels

app:web, pkg:api, database, size:xl

Poem

🐰 Three badges hop into the fray,
Genius shines and dunce holds sway,
Abomination too, all answers wrong,
While share sheets sing a native song!
Filters sort the catalog's way,
Staff admins now have their say. ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 13.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is vague and overly generic. It says 'add new features for patch 16' without specifying what features are actually being added, making it unclear what the PR's primary purpose is. Replace with a specific title that highlights the main changes, such as 'feat: add badges catalog management and game share sheet' or similar to reflect the actual substantial features being introduced.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch v26-04-16

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mehdiasadli mehdiasadli merged commit 7dd2009 into main Apr 28, 2026
4 of 5 checks passed
@mehdiasadli mehdiasadli deleted the v26-04-16 branch April 28, 2026 10:04
@coderabbitai coderabbitai Bot mentioned this pull request May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant