Skip to content

Conversation

@codeunia-dev
Copy link
Owner

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

This PR introduces several improvements across the Company Dashboard, focusing on notification workflows, moderation updates, and UI refinements. These changes enhance communication, improve visibility into important actions, and refine the user experience.


✨ What’s New

1. Company Member Notifications

  • Added member removal notification emails.
  • Ensures users are immediately informed when they are removed from a company team.

2. Admin Moderation Notifications

  • Implemented email notifications for event creator updates, including approvals and moderation actions.
  • Provides better transparency and timely communication for event-related decisions.

3. Event & Hackathon Update Notifications

  • Added a notification system for:

    • Event updates
    • Hackathon updates
  • Notifications include reason messages, improving clarity on what changed and why.

4. UI Improvements for Company Pages

  • Updated spacing, banner sizing, and layout adjustments for cleaner visual flow.
  • Makes dashboard sections more consistent and easier to scan.

🔧 Code Overview

  • 15 files changed
  • Hundreds of additions across 4 commits
  • Touches notification utilities, moderation logic, dashboard components, and styling

🧪 Testing

  • Verified email triggers for:

    • Member removal
    • Event moderation updates
    • Hackathon update events
  • Manually tested dashboard UI changes across different roles and screen sizes.


📌 Notes

  • Future work may include:

    • Unified notification template system
    • Dashboard-level activity feed for all updates
    • Role-based notification preferences

Authored by: @akshay0611

Summary by CodeRabbit

  • New Features

    • Event creators now receive notifications when their events are approved or rejected.
    • Company members receive notifications when removed from the company.
    • Events and hackathons reset to pending approval when edited after initial approval.
  • Notifications

    • Added new notification types for event and hackathon updates.
  • UI Updates

    • Improved spacing on company profile pages.
    • Enhanced company profile banner design with increased height.
  • Branding

    • Updated branding terminology across email communications.

- Import getMemberRemovedEmail function in member deletion endpoint
- Fetch member and requesting user profile information before removal
- Send removal notification email to removed member with context about their access removal
- Include member name, company name, removed by information, and previous role in email
- Handle email sending asynchronously to prevent request failures if email service is unavailable
- Fix brand name capitalization from "CodeUnia" to "Codeunia" across all email templates
- Add comprehensive email template for member removal with clear explanation of access changes and remaining account capabilities
…roval and rejection

- Fetch event creator's email and name from profiles table for direct notification
- Send approval emails to event creator as primary recipient, with company as secondary
- Send rejection emails to event creator as primary recipient, with company as secondary
- Add personalized greeting with creator's name in email templates
- Add error handling and logging for email delivery failures
- Update email templates to include creator name parameter
- Fix edit URL in rejection email to use company slug for proper navigation
- Ensure creator receives notifications independently of company email address
…e-approval workflow

- Pass userId parameter to updateHackathon and updateEvent service methods for tracking
- Add event_updated and event_status_changed notification types with appropriate icons and colors
- Add hackathon_updated and hackathon_status_changed notification types with appropriate icons and colors
- Implement automatic re-approval workflow when approved events are edited
- Reset approval_status to pending when approved events are modified
- Create admin notifications when events require re-approval after edits
- Notify company members about event status changes via notification service
- Log moderation actions when events are edited after approval
- Implement similar re-approval workflow for hackathons with admin and creator notifications
- Ensures content quality by requiring re-review of previously approved items when modified
…out consistency

- Update company header section padding from `py-12` to `pt-24 pb-12` in events and hackathons pages for consistent top spacing
- Adjust main content area padding from `py-12` to `pt-24 pb-12` on company profile page to align with header spacing
- Increase company profile banner height from `h-48` to `h-56 sm:h-64` for better visual prominence on responsive layouts
- Adjust CardHeader negative margin from `-mt-16` to `-mt-20` to properly overlap with larger banner on company profile
- Ensures consistent spacing across all company pages and improves visual hierarchy with responsive banner sizing
@vercel
Copy link

vercel bot commented Nov 17, 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 17, 2025 7:26am

@codeunia-dev codeunia-dev merged commit 24ff47c into main Nov 17, 2025
3 of 4 checks passed
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 17, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This PR implements user-context-aware updates for hackathons and events with re-approval workflows, adds creator-focused email notifications for event approvals and rejections, introduces member removal emails, adds new notification types for status changes, updates branding terminology (CodeUnia → Codeunia), and adjusts UI spacing across company pages.

Changes

Cohort / File(s) Summary
Hackathon Update Context
app/api/admin/hackathons/route.ts, app/api/hackathons/[id]/route.ts
Both hackathon update endpoints now pass the authenticated user's ID to the updateHackathon service method, enabling user-aware update tracking.
Event Moderation Email Flows
app/api/admin/moderation/events/[id]/approve/route.ts, app/api/admin/moderation/events/[id]/reject/route.ts
Both approval and rejection handlers now fetch event creator details from the profiles table and send creator-specific emails with personalized greetings, followed by conditional company notifications. Email templates updated to accept optional creatorName parameter.
Member Removal Notification
app/api/companies/[slug]/members/[userId]/route.ts
DELETE flow now asynchronously sends member removal email using new getMemberRemovedEmail template after deletion, with non-blocking error handling.
Email Templates & Branding
lib/email/company-emails.ts, lib/email/templates/event-rejected.tsx
Added getMemberRemovedEmail export for member removal notifications. Updated branding terminology (CodeUnia → Codeunia) across multiple email templates and subject lines.
Notification Types
types/notifications.ts, components/notifications/notification-utils.tsx
Added four new notification type literals (event_updated, event_status_changed, hackathon_updated, hackathon_status_changed) and corresponding icon/color mappings in utility functions.
Re-approval Workflows
lib/services/events.ts, lib/services/hackathons.ts
Both services updated to accept a userId parameter. When approved items are edited, approval status resets to pending, and notifications are sent to admins and company members via dynamically imported services.
UI Layout Adjustments
app/companies/[slug]/events/page.tsx, app/companies/[slug]/hackathons/page.tsx, app/companies/[slug]/page.tsx, components/companies/CompanyProfile.tsx
Header/section padding increased (py-12 → pt-24 pb-12 on pages; banner height h-48 → h-56/h-64, CardHeader offset -mt-16 → -mt-20 on component) for improved vertical spacing.

Sequence Diagram(s)

sequenceDiagram
    participant User as User/Admin
    participant API as API Handler
    participant Service as Service Layer
    participant DB as Database
    participant Notify as Notification Service
    participant Email as Email Service

    User->>API: PUT /update approved event/hackathon
    API->>Service: updateEvent/Hackathon(id, data, userId)
    Service->>DB: Fetch current item
    alt Item is approved
        Service->>DB: Reset approval_status to pending,<br/>clear approved_by & approved_at
        Service->>Notify: Create admin notifications<br/>(re-approval needed)
        Service->>Notify: Notify company members<br/>(status changed to pending)
    end
    Service->>DB: Persist updated item
    Service-->>API: Return updated item
    Notify->>Email: Send admin notifications
    Notify->>Email: Send company member notifications
    API-->>User: Response (200 OK)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Areas requiring extra attention:
    • lib/services/events.ts and lib/services/hackathons.ts: Complex re-approval logic with dynamic imports and multi-step notification flows; verify notification payloads and absence of circular dependencies.
    • app/api/admin/moderation/events/[id]/approve/route.ts and reject/route.ts: Two-step email sending with conditional logic; confirm error handling doesn't suppress email failures inappropriately.
    • Email template signature updates across approve and reject routes; ensure all callers pass the new creatorName parameter correctly.

Possibly related PRs

Poem

🐰 Users context now flows through updates bright,
Approvals reset when edits take flight,
Creator emails greet with personalized cheer,
Members removed hear kindly, crystal clear,
Spacing takes breath—the UI takes flight! ✨

✨ 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/companydashboard

📜 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 cbe17be and 85cd491.

📒 Files selected for processing (15)
  • app/api/admin/hackathons/route.ts (1 hunks)
  • app/api/admin/moderation/events/[id]/approve/route.ts (2 hunks)
  • app/api/admin/moderation/events/[id]/reject/route.ts (5 hunks)
  • app/api/companies/[slug]/members/[userId]/route.ts (2 hunks)
  • app/api/hackathons/[id]/route.ts (1 hunks)
  • app/companies/[slug]/events/page.tsx (1 hunks)
  • app/companies/[slug]/hackathons/page.tsx (1 hunks)
  • app/companies/[slug]/page.tsx (1 hunks)
  • components/companies/CompanyProfile.tsx (1 hunks)
  • components/notifications/notification-utils.tsx (2 hunks)
  • lib/email/company-emails.ts (7 hunks)
  • lib/email/templates/event-rejected.tsx (3 hunks)
  • lib/services/events.ts (3 hunks)
  • lib/services/hackathons.ts (1 hunks)
  • types/notifications.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