Skip to content

Conversation

@codeunia-dev
Copy link
Owner

@codeunia-dev codeunia-dev commented Nov 7, 2025

Summary

This PR introduces a complete Admin Support Ticket Management System that allows administrators to view, manage, and respond to user-submitted support tickets efficiently.

Key Features Added

  • 🧾 Admin Dashboard for Support Tickets: Displays all user-submitted tickets with filtering by status, type, and date.
  • 👀 Detailed Ticket View: Allows admins to inspect individual ticket details including user info, subject, and message.
  • ⚙️ Status Management: Admins can update ticket statuses (open, in_progress, resolved, closed) directly from the dashboard.
  • 💡 Improved UI/UX: Enhanced responsive design and intuitive layout for better usability across devices.
  • 🔗 Database Integration: Connected with support_tickets table and RLS policies for secure data access.
  • 🧱 Error Handling: Added robust error handling for missing relationships and data fetch failures.

Technical Notes

  • Uses optimized SQL policies for secure admin access.
  • Fixed PostgREST relationship issue between support_tickets and profiles.
  • Ensures compatibility with the Help Centre module for unified support management.

Authored by: @akshay0611

Summary by CodeRabbit

Release Notes

New Features

  • Comprehensive support ticket management system added to admin dashboard
  • Support tickets list view with search, real-time statistics, and filtering options for type and status
  • Detailed ticket view displaying user information, internal notes section, and status update controls
  • Support Tickets navigation item now available in the admin sidebar

- Implement new support ticket detail page with dynamic routing
- Add support ticket API routes for fetching and updating tickets
- Enhance admin sidebar with new Support Tickets navigation item
- Create detailed ticket view with status tracking and user information
- Implement loading skeletons and error handling for ticket management
- Add internal notes section for admin communication
- Support different ticket types (bug report and contact request)
- Integrate toast notifications for ticket status updates
…improved UX

- Refactor page layout with responsive padding and spacing
- Update header and title styles for better readability on different screen sizes
- Simplify and improve filter section layout with more compact design
- Add responsive adjustments to buttons and text sizes
- Optimize ticket list display with more compact and mobile-friendly elements
- Improve visual hierarchy and spacing across the support tickets page
- Enhance filter buttons with flex-wrap and size-adaptive labels
@vercel
Copy link

vercel bot commented Nov 7, 2025

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

Project Deployment Preview Comments Updated (UTC)
codeunia Ready Ready Preview Comment Nov 7, 2025 5:13am

@codeunia-dev codeunia-dev merged commit df92bd8 into main Nov 7, 2025
3 checks passed
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 7, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request introduces a comprehensive admin support ticket management system. It adds a sidebar navigation entry, creates a ticket listing page with filtering and search capabilities, develops a detailed ticket view page, and implements backend API routes for retrieving and updating ticket data with admin authentication checks.

Changes

Cohort / File(s) Summary
Sidebar Navigation
app/admin/layout.tsx
Adds "Support Tickets" navigation item to admin sidebar with LifeBuoy icon from lucide-react.
Admin Support Pages
app/admin/support/page.tsx,
app/admin/support/[id]/page.tsx
Creates ticket listing page with dynamic filtering (type, status, search), statistics dashboard, and responsive table. Adds ticket detail page with data fetching, status update UI, internal notes textarea, user information card, and timestamps.
API Routes
app/api/admin/support/tickets/route.ts,
app/api/admin/support/tickets/[id]/route.ts
Implements GET endpoint to fetch all support tickets with user profiles; adds GET and PATCH handlers for individual tickets with admin authentication, error handling, and status updates.

Sequence Diagram

sequenceDiagram
    actor Admin
    participant UI as Support Pages
    participant API as API Routes
    participant DB as Supabase
    
    Admin->>UI: Access support tickets page
    UI->>API: GET /api/admin/support/tickets
    API->>DB: Verify admin, fetch tickets + profiles
    DB-->>API: Tickets with user data
    API-->>UI: Return tickets list
    UI-->>Admin: Display filtered ticket list with stats
    
    Admin->>UI: Click ticket to view details
    UI->>API: GET /api/admin/support/tickets/[id]
    API->>DB: Fetch ticket & author profile
    DB-->>API: Ticket details
    API-->>UI: Return ticket data
    UI-->>Admin: Display ticket detail view
    
    Admin->>UI: Update ticket status
    UI->>API: PATCH /api/admin/support/tickets/[id]
    API->>DB: Validate status, update ticket
    DB-->>API: Updated ticket
    API-->>UI: Confirmation response
    UI-->>Admin: Show success, refresh ticket
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • API authentication & authorization: Both routes implement admin checks via the profiles table; verify consistency of authentication logic across GET and PATCH handlers
  • Data validation: PATCH endpoint restricts status to four values; confirm validation robustness
  • Client-side state management: Both support pages manage multiple state variables (tickets, filters, loading); verify proper updates and side effects in dependency arrays
  • API integration: Ensure error handling is consistent between client pages and API routes; verify loading states and toast notifications align with actual API responses
  • Data fetching logic: app/api/admin/support/tickets/route.ts fetches all tickets and joins with profiles; verify query efficiency and null handling for missing user data

Poem

🐰 A warren of tickets, now organized with care,
Admins can filter and search without despair,
Status updates flow through the burrow deep,
From open to resolved, the records they keep,
Support and delight, in each hoppy leap! 🎟️

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/adminsupport

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9cfc9a2 and 33e6c02.

📒 Files selected for processing (5)
  • app/admin/layout.tsx (2 hunks)
  • app/admin/support/[id]/page.tsx (1 hunks)
  • app/admin/support/page.tsx (1 hunks)
  • app/api/admin/support/tickets/[id]/route.ts (1 hunks)
  • app/api/admin/support/tickets/route.ts (1 hunks)

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.

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.

3 participants