5.6 KiB
5.6 KiB
24. Dashboard — Unified Widgets for All Services
meta: id: shieldai-unified-restructure-24 feature: shieldai-unified-restructure priority: P1 depends_on: [shieldai-unified-restructure-23] tags: [frontend, dashboard, widgets, solidjs]
objective:
- Build rich, interactive dashboard widgets that give users a unified view of their security posture across all ShieldAI services. Replace placeholder stat cards with real, actionable widgets.
deliverables:
web/src/components/dashboard/ThreatScoreWidget.tsx— Circular gauge showing overall threat score (0-100):- Color-coded: green (0-30), amber (31-70), red (71-100)
- Trend indicator (up/down vs last week)
- Click to view detailed breakdown
web/src/components/dashboard/AlertFeedWidget.tsx— Real-time alert stream:- List of latest 5-10 alerts with severity icons
- Grouped by correlation group
- "Mark as read" and "View details" actions
- "View all" link to alerts page
web/src/components/dashboard/ExposureWidget.tsx— DarkWatch summary:- Count of exposures by severity
- Latest exposure with source and date
- "Run scan" button
- Link to full DarkWatch page
web/src/components/dashboard/VoicePrintWidget.tsx— VoicePrint summary:- Enrollment count
- Recent analyses count
- Synthetic detection rate
- "Analyze audio" button
web/src/components/dashboard/SpamShieldWidget.tsx— SpamShield summary:- Blocked calls/SMS count (today/this week)
- Top spam sources
- Custom rules count
- "View rules" link
web/src/components/dashboard/HomeTitleWidget.tsx— HomeTitle summary:- Watched properties count
- Recent changes count
- Latest change with severity
- "View properties" link
web/src/components/dashboard/RemoveBrokersWidget.tsx— RemoveBrokers summary:- Total brokers in registry
- Pending/completed removals count
- Progress bar for overall removal completion
- "Manage removals" link
web/src/components/dashboard/QuickActionsWidget.tsx— Shortcut buttons:- "Add to watchlist", "Upload voice sample", "Check number", "Add property", "Start removal"
web/src/routes/(webapp)/dashboard.tsx— Updated dashboard layout:- Grid layout: 2 columns on desktop, 1 on mobile
- Widgets arranged by priority (threat score top-left, quick actions top-right)
- Auto-refresh every 60 seconds
steps:
- Create
web/src/components/dashboard/directory. - ThreatScoreWidget:
- Use SVG for circular gauge with stroke-dasharray animation
- Query
api.correlation.getStatsfor score and trend - Color transitions based on score value
- AlertFeedWidget:
- Query
api.correlation.getAlertswithlimit: 10 - Each item: severity icon (shield with color), title, time ago, source badge
- Use
Cardprimitive with compact padding - "Mark as read" calls
api.correlation.resolveAlert
- Query
- ExposureWidget:
- Query
api.darkwatch.getExposureswithlimit: 1for latest - Show severity breakdown as small horizontal bars
- "Run scan" button triggers
api.darkwatch.runScanmutation
- Query
- VoicePrintWidget:
- Query
api.voiceprint.getEnrollmentsandapi.voiceprint.getAnalyses - Show counts and a mini bar chart of recent analyses
- Query
- SpamShieldWidget:
- Query
api.spamshield.getStats - Show blocked count with trend
- List top 3 spam sources as small rows
- Query
- HomeTitleWidget:
- Query
api.hometitle.getPropertiesandapi.hometitle.getChanges - Show property count and latest change
- Query
- RemoveBrokersWidget:
- Query
api.removebrokers.getRemovalRequestsandapi.removebrokers.getBrokerRegistry - Calculate completion percentage
- Show progress bar using theme colors
- Query
- QuickActionsWidget:
- Grid of icon buttons linking to service pages or opening modals
- Each button uses
Buttonprimitive with icon
- Update dashboard route:
- Compose all widgets in responsive grid
- Add
createIntervalorsetIntervalfor auto-refresh - Handle loading states with skeleton cards
steps:
- Unit: Each widget renders correctly with mock data
- Unit: ThreatScoreWidget displays correct color for score ranges
- Unit: AlertFeedWidget calls mark-read mutation on click
- Visual: Dashboard grid is responsive and widgets align correctly
- E2E: Dashboard loads with real data and auto-refreshes
acceptance_criteria:
- Dashboard displays 8 widgets in a responsive grid layout
- Threat score gauge animates on load and updates with real data
- Alert feed shows latest alerts with correct severity colors
- Each service widget summarizes the most important metrics
- Quick actions provide one-click access to common tasks
- Dashboard auto-refreshes every 60 seconds
- Loading states show skeleton cards while data fetches
- All widgets use theme tokens and shift correctly in dark mode
validation:
- Open
/dashboardand verify all widgets render with real data - Resize browser to mobile width and verify single-column layout
- Wait 60 seconds and verify auto-refresh updates data
- Click "Mark as read" on an alert and verify it disappears from feed
- Run
cd web && pnpm testfor widget unit tests
notes:
- Keep widgets focused on summary data. Deep interactions belong on service-specific pages.
- The threat score gauge is the visual centerpiece. Invest in making it polished and informative.
- Consider adding a "Security Tip of the Day" widget that rotates educational content.
- Widgets should be collapsible or reorderable in a future enhancement. Design them as self-contained units.
- Use
Suspenseboundaries around widget groups to prevent the entire dashboard from blocking on one slow API call.