Status: Live — This feature is operational.
Architecture Flow
Components
Frontend Components
-
FlipCountdown.tsx - Core countdown component
- Real-time countdown calculation
- Individual flip card per digit
- Auto mode for smart unit visibility
- Panchang-Bold font for numbers
-
FlipCountdown.module.css - 3D flip animations
- Perspective transforms
- Smooth easing transitions
- Card shadows and depth effects
-
AnnouncementsOverlay.tsx - Overlay renderer
- Handles all announcement styles
- Manages placement and sizing
- Integrates FlipCountdown component
-
AnnouncementsPage.tsx - Management UI
- Create/edit/delete interface
- Time presets (+10min, +1h, +1d, +1w)
- Auto mode toggle
- Live preview while editing
- Past date validation
-
ControlPanelApp.tsx - State broadcaster
- Loads announcements from backend
- Broadcasts via BroadcastChannel
- Sends to overlay page in real-time
Backend Components
-
model/model.go - Database model
- Announcement struct with countdown fields
- JSON serialization tags for API responses
-
handler/announcements.go - API endpoints
- CRUD operations
- Countdown field validation
- Special handling for countdown style
-
Database Table:
announcements- Standard announcement fields
- Countdown-specific fields:
target_time(TIMESTAMP)countdown_show_days(BOOLEAN)countdown_show_hours(BOOLEAN)countdown_show_minutes(BOOLEAN)countdown_show_seconds(BOOLEAN)countdown_auto_mode(BOOLEAN)
Data Flow
1. Creating a Countdown
2. Displaying on Overlay
UX Features
Smart Time Presets
- +10 min - Quick countdown for imminent events
- +1 hour - Short-term announcements
- +1 day - Next-day events
- +1 week - Weekly milestones
Auto Mode
When enabled, automatically shows/hides units based on time remaining:- Hides “Days” if < 1 day
- Hides “Hours” if < 1 hour
- Always shows minutes and seconds
- Keeps display clean and relevant
Manual Mode
Full control over which units display:- Toggle Days on/off
- Toggle Hours on/off
- Toggle Minutes on/off
- Toggle Seconds on/off
Validation
- Prevents past dates with
minattribute - Shows warning if past date is detected
- Client-side validation before submission
- Backend validation for countdown requirements
Live Preview
- Shows countdown while creating (before saving)
- Updates in real-time as settings change
- Also shows in standard Preview section
- Matches exact overlay appearance
API Endpoints
GET /v1/announcements
Returns all announcements for authenticated user, including countdown fields. Response:POST /v1/announcements
Creates a new countdown announcement. Request:PUT /v1/announcements/{id}
Updates an existing countdown.DELETE /v1/announcements/{id}
Deletes a countdown announcement.Placement Options
All standard placement options supported:full-screen- Full viewporttop-bar- Top center stripbottom-bar- Bottom center stripcenter- Dead centertop-left- Upper left cornertop-right- Upper right cornerbottom-left- Lower left cornerbottom-right- Lower right corner
Styling
Colors
backgroundColor- Card background colortextColor- Digit and label color
Typography
- Uses Panchang-Bold font (same as headers)
- Font size scales all elements proportionally
- Tabular numbers for consistent digit width
Animations
- 3D flip animation on digit change
- 0.6s duration with cubic-bezier easing
- Smooth, professional transitions
Troubleshooting
Countdown Not Showing on Overlay
Countdown Not Showing on Overlay
Check:
- Is
isVisibleset totrue? - Is the streamer ID correct in the overlay URL?
- Open browser console - any errors?
- Check if BroadcastChannel is working (same browser)
- Ensure countdown announcement has
is_visible = truein database - Verify ControlPanelApp is broadcasting (check console logs)
- Refresh overlay page to re-establish BroadcastChannel
Preview Erratic
Preview Erratic
Issue: Preview flickering or not updating properly.Solution:
- Fixed by ensuring
previewAnnouncementsincludes form data when editing - Only shows preview when form is open AND visibility is ON
- Uses consistent field mapping
400 Bad Request
400 Bad Request
Issue: Backend rejecting countdown creation.Causes:
- Missing
targetTimefor countdown style - Invalid date format
- Missing JSON tags on backend model
- Client validates
targetTimebefore submission - Backend uses default “Countdown” text for empty text field
- All model fields have proper JSON tags
Performance
- Update Frequency: 1 second (minimal CPU)
- Animation Cost: CSS transforms (GPU accelerated)
- Network: No polling (BroadcastChannel is local)
- Database: Indexed on
target_timefor queries