Overview
The Admin Notification System allows administrators to broadcast important messages, announcements, and updates to all users across the platform. Notifications appear in a popup at the bottom-right corner of the user interface.Database Schema
admin_notifications Table
Notifications are stored in theadmin_notifications table:
| Field | Type | Description |
|---|---|---|
id | UUID | Primary key, auto-generated |
title | TEXT | Notification title (required) |
message | TEXT | Notification message body (required) |
enabled | BOOLEAN | Whether notification is active (default: false) |
created_at | TIMESTAMP | When notification was created |
created_by | TEXT | Admin identifier who created it |
expires_at | TIMESTAMP | Optional expiration date |
Row Level Security
The notifications table has RLS enabled with the following policies:Only notifications with
enabled = true are visible to regular users. Admins can see all notifications regardless of status.Creating Notifications
Admin Dashboard Interface
Access the notification manager from the Admin Dashboard → Notifications tab. Steps to create a notification:- Navigate to the Notifications section
- Fill in the notification form:
- Title: Short, descriptive heading
- Message: Detailed announcement text
- Expires At (optional): Set an expiration date/time
- Click “Create Notification”
- Toggle the notification to enable it
Example Notification
Managing Notifications
Enable/Disable Notifications
Toggle notifications on or off without deleting them:- Enable: Makes the notification visible to all users
- Disable: Hides the notification but keeps it in the database
Edit Notifications
Currently, notifications cannot be edited after creation. To modify:- Disable the old notification
- Create a new notification with updated content
- Delete the old notification if no longer needed
Delete Notifications
Permanently remove notifications by clicking the delete (trash) icon.User-Facing Display
Notification Popup Component
Notifications appear using thenotification-popup.tsx component:
Features:
- Appears in bottom-right corner of the screen
- Shows one active notification at a time
- Auto-refreshes every 30 seconds to check for new notifications
- Users can dismiss notifications
- Respects expiration dates automatically
Auto-Refresh Behavior
The notification system polls for updates every 30 seconds:Integration Points
Component Location
The notification popup is integrated into the main layout:API Endpoints
Notifications are accessed via Supabase client queries:Use Cases
Platform Announcements
Maintenance Notices
Promotional Messages
Critical Alerts
Best Practices
Notification Guidelines:
- Keep titles under 50 characters for optimal display
- Limit messages to 2-3 sentences
- Use clear, actionable language
- Set expiration dates for time-sensitive announcements
- Test notifications before enabling for all users
- Don’t overuse - frequent notifications can annoy users
Notification Frequency
Recommended notification frequency:- Critical alerts: Immediate
- Feature announcements: 1-2 per week maximum
- Maintenance notices: At least 24 hours in advance
- Promotional messages: Sparingly, no more than weekly
Content Guidelines
Do:- ✓ Be concise and clear
- ✓ Include specific dates/times for events
- ✓ Use emojis sparingly for emphasis
- ✓ Provide actionable next steps
- ✓ Set appropriate expiration dates
- ✗ Use all caps (except acronyms)
- ✗ Create multiple active notifications for the same topic
- ✗ Leave expired notifications enabled
- ✗ Use technical jargon users won’t understand
- ✗ Make notifications too long
Troubleshooting
Notification Not Appearing
Check:- Notification is
enabled = true expires_atis null or in the future- User hasn’t dismissed it recently
- RLS policies are correctly configured
- User is authenticated (if required)
Notification Appearing Multiple Times
Ensure the popup component is only rendered once in your layout hierarchy.Auto-Refresh Not Working
Verify the 30-second interval is not being cleared prematurely:Related Documentation
Admin Dashboard
Return to admin dashboard overview
User Management
Learn about managing user accounts