Skip to content

Kairul/kal 42 add feedback pages for user to sent a feedback - #100

Merged
rekabytes merged 4 commits into
mainfrom
kairul/kal-42-add-feedback-pages-for-user-to-sent-a-feedback
Jan 21, 2026
Merged

Kairul/kal 42 add feedback pages for user to sent a feedback#100
rekabytes merged 4 commits into
mainfrom
kairul/kal-42-add-feedback-pages-for-user-to-sent-a-feedback

Conversation

@rekabytes

@rekabytes rekabytes commented Jan 21, 2026

Copy link
Copy Markdown
Owner

📝 Description

Brief description of what this PR does.

🔗 Related Issue

Fixes #(issue number)

🏷️ Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🧹 Code refactoring (no functional changes)
  • 🧪 Test update (adding or updating tests)

✅ Checklist

  • I have read the Contributing Guidelines
  • My branch is created from dev (not main)
  • I have run pnpm lint:fix
  • I have run pnpm typecheck
  • I have tested my changes locally
  • My code follows the project's coding standards
  • I have updated documentation (if applicable)

📸 Screenshots (if applicable)

Add screenshots to help explain your changes.

🧪 How to Test

Steps to test this PR:

  1. ...
  2. ...
  3. ...

📝 Additional Notes

Any additional information reviewers should know.

Summary by CodeRabbit

Release Notes

  • New Features
    • Added feedback submission interface with star ratings and text input for user reviews
    • Added bug report submission form with title and description fields
    • Added admin dashboard to view user feedback and review statistics
    • Added admin dashboard to view and manage bug reports with status filtering and editing
    • Updated navigation to include links to feedback and bug reporting features

✏️ Tip: You can customize this high-level summary in your review settings.

Kai and others added 4 commits January 7, 2026 23:35
- Add Feedback button to sidebar with gradient green 'new' badge
- Create feedback page with two options: Write a Review and Report a Bug
- Implement review form with 5-star rating and feedback text
- Implement bug report form with title, description, and steps to reproduce
- Add MongoDB migration script for feedback_reviews and feedback_bugs collections
- Create feedback tRPC router with submitReview, submitBug, getMyBugs endpoints
- Show user's submitted bugs with open/closed status on bug report page
- Simplified schemas: no status on reviews, no priority on bugs (set internally)
- Add admin procedures to feedback router (getAllReviews, getAllBugs, updateBugStatus, getStats)
- Add Feedback and Bug Reports nav items to kal-admin sidebar
- Create Feedback page with reviews table and stats cards
- Create Bug Reports page with status filtering and inline status update
- Add Select UI component for dropdowns
- Change kal-frontend sidebar label from 'Feedback' to 'Review & Bug'
- Change success screen button from 'Submit Another' to 'Back'
- Update seed-safe.ts to add only new foods when FORCE_SEED=false
- Add Redis cache invalidation to seed-safe.ts
- Remove seed.ts (functionality merged into seed-safe.ts)
- Update package.json: 'seed' for incremental, 'seed:force' for full reset

New behavior:
- pnpm seed: adds only new foods (keeps existing IDs)
- pnpm seed:force: drops and reseeds everything
@rekabytes
rekabytes merged commit 5fe0b5a into main Jan 21, 2026
@coderabbitai

coderabbitai Bot commented Jan 21, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

This PR introduces a comprehensive feedback and bug reporting system across the monorepo. It adds a TRPC-based feedback router with user submission and admin management endpoints, a MongoDB migration script for feedback collections, new dashboard pages in both admin and frontend applications for submitting and managing feedback, an enhanced seed script with force-mode capability, and UI components including a select dropdown built on Radix UI primitives.

Changes

Cohort / File(s) Summary
Admin Feedback System
packages/kal-admin/package.json, packages/kal-admin/src/components/ui/select.tsx, packages/kal-admin/src/components/Sidebar.tsx, packages/kal-admin/src/app/bugs/page.tsx, packages/kal-admin/src/app/feedback/page.tsx
Added Radix UI select dependency and fully-styled select component with forwardRef wrappers. Created two new dashboard pages: BugsPage (217 lines) with status filtering, mutation-based status updates, and stats; FeedbackPage (125 lines) with reviews table, star ratings, and aggregate stats. Updated sidebar with feedback and bug report navigation links with icons.
Backend Feedback Router
packages/kal-backend/src/routers/feedback.ts, packages/kal-backend/src/routers/index.ts, packages/kal-backend/package.json
Implemented comprehensive feedbackRouter (358 lines) with types for FeedbackReview/FeedbackBug and public API shapes. Exposed 9 procedures: user actions (submitReview, submitBug, getMyReviews, getMyBugs, getMyStats) and admin actions (getAllReviews, getAllBugs, updateBugStatus, getStats) with input validation, pagination, filtering, and atomic status update logic. Registered router in appRouter. Added migrate-feedback script entry.
MongoDB Migration & Seed Updates
packages/kal-backend/scripts/migrate-feedback.ts, packages/kal-db/scripts/seed-safe.ts, packages/kal-db/scripts/seed.ts, packages/kal-db/package.json
Created new migration script (121 lines) to initialize feedback_reviews and feedback_bugs collections with appropriate indexes. Enhanced seed-safe.ts with force-mode seeding (FORCE_SEED=true flag) for full DB resets, incremental seeding for new foods, and Redis cache invalidation post-seed. Removed deprecated seed.ts. Updated seed scripts in package.json.
Frontend Feedback Page
packages/kal-frontend/src/app/dashboard/feedback/page.tsx, packages/kal-frontend/src/app/dashboard/feedback/client.tsx, packages/kal-frontend/src/components/dashboard/Sidebar.tsx
Created server-side feedback page (28 lines) with Logto authentication guard. Implemented FeedbackClient (414 lines) with dual-form UX for review submission (star rating + text) and bug reporting (title + description + steps), tRPC integration with success/error handling, responsive mobile/desktop layouts, and user's bug history sidebar. Added feedback navigation link with badge to both mobile drawer and desktop sidebar.

Sequence Diagram(s)

sequenceDiagram
    actor User as User
    participant FC as FeedbackClient<br/>(Frontend)
    participant TRPC as TRPC Router<br/>(Backend)
    participant DB as MongoDB<br/>(feedback_reviews/<br/>feedback_bugs)

    User->>FC: Selects review or bug<br/>report type
    activate FC
    FC->>FC: Render form<br/>(rating/feedback or<br/>title/description)
    User->>FC: Fills form & submits
    FC->>FC: Validate input
    
    Note over FC: Validation success
    FC->>TRPC: submitReview(rating,<br/>feedback, userId)
    activate TRPC
    TRPC->>TRPC: Validate input<br/>(rating 1-5,<br/>feedback 1-2000 chars)
    TRPC->>DB: Insert document<br/>with userId & timestamp
    activate DB
    DB-->>TRPC: Inserted ID
    deactivate DB
    TRPC-->>FC: Success response<br/>with insertedId
    deactivate TRPC
    
    FC->>FC: Set isSubmitted=true<br/>clear forms
    FC-->>User: Show success message<br/>with back button
    deactivate FC
Loading
sequenceDiagram
    actor Admin as Admin
    participant BP as BugsPage/<br/>FeedbackPage<br/>(Admin Dashboard)
    participant TRPC as TRPC Router<br/>(Backend)
    participant DB as MongoDB<br/>(feedback_reviews/<br/>feedback_bugs)

    Admin->>BP: Open feedback/bugs page
    activate BP
    BP->>TRPC: getAllReviews() or<br/>getAllBugs(status filter)
    activate TRPC
    TRPC->>DB: Query collection<br/>with filters/pagination
    activate DB
    DB-->>TRPC: Return documents<br/>+ total count
    deactivate DB
    TRPC-->>BP: Public API shapes<br/>+ stats (avgRating,<br/>openBugs, etc.)
    deactivate TRPC
    
    BP->>BP: Render table with stats<br/>& status selects
    BP-->>Admin: Display reviews/bugs<br/>with pagination
    
    Note over Admin,BP: Admin updates bug status
    Admin->>BP: Select new status<br/>in table row
    activate BP
    BP->>TRPC: updateBugStatus<br/>(bugId, newStatus)
    activate TRPC
    TRPC->>DB: Update bug doc<br/>set updatedAt,<br/>optionally resolvedAt
    activate DB
    DB-->>TRPC: Acknowledge
    deactivate DB
    TRPC->>TRPC: Invalidate<br/>getAllBugs cache
    TRPC-->>BP: Success
    deactivate TRPC
    BP->>TRPC: Re-fetch bugs<br/>(cache miss)
    activate TRPC
    TRPC->>DB: Query updated docs
    activate DB
    DB-->>TRPC: Updated list
    deactivate DB
    TRPC-->>BP: Refreshed data
    deactivate TRPC
    BP-->>Admin: Display updated table
    deactivate BP
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Poem

🐰 Feedback flows through systems now,
Admin dashboards help us vow,
Bug reports and reviews shine,
Radix UI components align,
Seeds grow strong with force divine! 🌱

✨ Finishing touches
  • 📝 Generate docstrings

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.

@rekabytes
rekabytes deleted the kairul/kal-42-add-feedback-pages-for-user-to-sent-a-feedback branch March 14, 2026 05:04
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.

1 participant