This document outlines the reusable UI components that would be needed for the Yoto Smart Stream web interface.
Purpose: Display individual device status and basic controls
Props:
- deviceName: string
- status: 'connected' | 'disconnected' | 'idle'
- currentTrack: string | null
- progress: number (0-100)
- volume: number (0-100)
Layout:
┌──────────────────────────────────┐
│ 🟢 Living Room Yoto │
│ │
│ Playing: "Story Track 3" │
│ [████████░░░░] 8:32 / 15:00 │
│ │
│ [⏸️] [⏭️] [🔊 60%] │
└──────────────────────────────────┘
Purpose: Display audio file in library with metadata and actions
Props:
- title: string
- duration: string
- trackCount: number
- thumbnail: string | null
- onPlay: function
- onEdit: function
- onDelete: function
Layout:
┌─────────────────┐
│ 🎵 │
│ │
│ Story Time │
│ Volume 1 │
│ │
│ 12 tracks │
│ 45:32 │
│ │
│ [▶️] [✏️] [🗑️] │
└─────────────────┘
Purpose: Edit individual script nodes in CYOA builder
Props:
- nodeId: string
- nodeType: 'audio' | 'choice' | 'action'
- audioFile: string | null
- nextNodes: array
- buttonMappings: object
Layout:
┌──────────────────────────────────┐
│ Node: start_01 │
├──────────────────────────────────┤
│ Type: [Audio Playback ▼] │
│ │
│ Audio: [intro.mp3 ▼] [▶️] │
│ │
│ Next Actions: │
│ • Button 1 → [choice_1a] │
│ • Button 2 → [choice_1b] │
│ • Timeout → [repeat] │
│ │
│ [+ Add Action] │
└──────────────────────────────────┘
Purpose: Display real-time MQTT events from devices
Props:
- deviceId: string
- maxEvents: number
- events: array of {timestamp, type, message}
Layout:
┌──────────────────────────────────────┐
│ MQTT Events │
├──────────────────────────────────────┤
│ 08:15:32 - Button 1 pressed │
│ 08:15:30 - Playback started │
│ 08:15:28 - Card inserted │
│ 08:14:55 - Volume changed to 60% │
│ 08:14:50 - Connection established │
├──────────────────────────────────────┤
│ [Clear Log] [Export] [⏸️ Pause] │
└──────────────────────────────────────┘
Purpose: Handle drag-and-drop and browse file uploads
Props:
- acceptedFormats: array
- maxFileSize: number
- onUpload: function
- multiple: boolean
Layout:
┌──────────────────────────────────┐
│ │
│ 📁 Drag & Drop Files Here │
│ or │
│ [Browse Files] │
│ │
│ Supported: MP3, WAV, OGG, FLAC │
│ Max size: 500MB per file │
│ │
└──────────────────────────────────┘
With Files:
┌──────────────────────────────────┐
│ Uploaded Files: │
│ ✓ story_intro.mp3 (2.3 MB) │
│ ⏳ bedtime.wav [▓▓░░] 45% │
│ ❌ toolarge.wav (Error) │
└──────────────────────────────────┘
Purpose: Record audio directly in the browser
Props:
- onRecordingComplete: function
- maxDuration: number
- format: string
Layout:
┌──────────────────────────────────┐
│ 🎙️ Recording │
│ │
│ 00:02:35 │
│ │
│ Level: [████████░░░░] 🔊 │
│ │
│ [⏸️ Pause] [⏹️ Stop] │
│ │
│ Input: [Built-in Mic ▼] │
│ Quality: [High (320kbps) ▼] │
└──────────────────────────────────┘
Purpose: Visual node-based editor for CYOA stories
Props:
- nodes: array
- connections: array
- onNodeAdd: function
- onNodeDelete: function
- onNodeConnect: function
- selectedNode: string | null
Features:
- Drag-and-drop nodes
- Click-and-drag connections
- Zoom and pan
- Auto-layout option
- Minimap for large flows
Interaction:
- Click node to select/edit
- Drag from output to input to connect
- Right-click for context menu
- Scroll to zoom
- Double-click to add node
Purpose: Hierarchical tree view of script structure
Props:
- rootNode: object
- onNodeSelect: function
- expandedNodes: array
Layout:
┌──────────────────────┐
│ Script Structure │
├──────────────────────┤
│ 📍 Start │
│ ├─ 🔊 intro.mp3 │
│ └─ ❓ Choice 1 │
│ ├─ 🔊 path_a.mp3 │
│ │ └─ ⏹️ End A │
│ └─ 🔊 path_b.mp3 │
│ └─ ⏹️ End B │
│ │
│ [+ Add Node] │
│ [🗑️ Delete] │
│ [📋 Duplicate] │
└──────────────────────┘
Purpose: Show connection/status with color coding
Props:
- status: 'connected' | 'disconnected' | 'warning' | 'error'
- label: string
- showLabel: boolean
Variants:
- 🟢 Connected
- 🔴 Disconnected
- 🟡 Warning
- ⚪ Unknown
Purpose: Show progress for uploads, playback, etc.
Props:
- value: number (0-100)
- variant: 'default' | 'success' | 'warning' | 'error'
- showLabel: boolean
- label: string
Layout:
[████████░░░░░░] 45%
Purpose: Standard media player controls
Props:
- isPlaying: boolean
- currentTime: number
- duration: number
- volume: number
- onPlay: function
- onPause: function
- onNext: function
- onPrevious: function
- onVolumeChange: function
Layout:
┌──────────────────────────────────────┐
│ [⏮️] [⏸️] [⏭️] │
│ │
│ [████████░░░░░░] 8:32 / 15:00 │
│ │
│ 🔊 [██████░░░░] 60% │
└──────────────────────────────────────┘
Purpose: Overlay dialog for focused tasks
Props:
- isOpen: boolean
- title: string
- onClose: function
- size: 'small' | 'medium' | 'large'
Layout:
┌─────────────────────────────────┐
│ Modal Title [✕] │
├─────────────────────────────────┤
│ │
│ Content goes here │
│ │
├─────────────────────────────────┤
│ [Cancel] [Confirm] │
└─────────────────────────────────┘
Purpose: Main app navigation
Props:
- currentRoute: string
- user: object
Layout:
┌────────────────────┐
│ [Logo] Yoto Stream │
├────────────────────┤
│ 🏠 Dashboard │ ← Active
│ 🎵 Library │
│ 📝 Scripts │
│ 🎮 CYOA Builder │
│ 📱 Devices │
│ 📊 Analytics │
│ ⚙️ Settings │
├────────────────────┤
│ 👤 User Profile │
│ 🚪 Logout │
└────────────────────┘
Mobile (Collapsed):
[☰] Yoto Stream
Purpose: Search and filter content
Props:
- placeholder: string
- value: string
- onSearch: function
- suggestions: array
Layout:
┌──────────────────────────────────┐
│ 🔍 [Search audio files...____] │
└──────────────────────────────────┘
Purpose: Filter and sort options
Props:
- filters: object
- onFilterChange: function
Layout:
┌──────────────────────────────────┐
│ Filters │
├──────────────────────────────────┤
│ Type: [All ▼] │
│ Duration: [Any ▼] │
│ Date Added: [All Time ▼] │
│ │
│ [Reset] [Apply] │
└──────────────────────────────────┘
Purpose: Temporary feedback messages
Props:
- message: string
- type: 'success' | 'error' | 'warning' | 'info'
- duration: number
- onClose: function
Variants:
✅ File uploaded successfully
❌ Connection failed
⚠️ Low battery on device
ℹ️ New device detected
Purpose: Display key metrics on dashboard
Props:
- title: string
- value: string | number
- icon: string
- trend: 'up' | 'down' | 'neutral'
- trendValue: string
Layout:
┌──────────────────┐
│ 📊 Total Plays │
│ │
│ 1,234 │
│ │
│ ↗️ +12% today │
└──────────────────┘
Purpose: Organize content in tabs
Props:
- tabs: array
- activeTab: string
- onTabChange: function
Layout:
┌────────────────────────────────────┐
│ [Info] [Audio] [Settings] [Test] │ ← Active: Info
├────────────────────────────────────┤
│ │
│ Tab content here │
│ │
└────────────────────────────────────┘
Purpose: Right-click or long-press actions
Props:
- items: array
- position: {x, y}
- onSelect: function
Layout:
┌──────────────────┐
│ ▶️ Play │
│ ✏️ Edit │
│ 📋 Duplicate │
│ ────────────── │
│ 🗑️ Delete │
└──────────────────┘
Purpose: Select display icons for Yoto Mini chapters
Props:
- selectedIcon: string | null
- iconSource: 'public' | 'user' | 'all'
- onSelect: function
- maxIcons: number
Layout:
┌──────────────────────────────────┐
│ Select Display Icon [✕] │
├──────────────────────────────────┤
│ [Public Icons] [My Icons] │
├──────────────────────────────────┤
│ [🔍 Search...] [Category: All▼] │
├──────────────────────────────────┤
│ │
│ ┌────┐ ┌────┐ ┌────┐ ┌────┐ │
│ │ 🎵 │ │ 📖 │ │ ⭐ │ │ 🌙 │ │
│ └────┘ └────┘ └────┘ └────┘ │
│ │
│ ┌────┐ ┌────┐ ┌────┐ ┌────┐ │
│ │ 🎨 │ │ 🎮 │ │ 📚 │ │ 🎪 │ │
│ └────┘ └────┘ └────┘ └────┘ │
│ │
│ Preview on Yoto Mini: │
│ ┌────┐ │
│ │ 🎵 │ ← Selected icon │
│ └────┘ │
│ │
│ [Cancel] [Select] │
└──────────────────────────────────┘
Features:
- Browse public icon repository
- Filter by category or search
- Preview at actual size (16x16px)
- Upload custom icons
- Recent icons quick access
Purpose: Show when no content is available
Props:
- icon: string
- title: string
- message: string
- actionLabel: string
- onAction: function
Layout:
┌──────────────────────────────────┐
│ │
│ 📁 │
│ │
│ No audio files yet │
│ │
│ Upload your first audio file │
│ to get started │
│ │
│ [Upload Audio] │
│ │
└──────────────────────────────────┘
DeviceCard (shows current status)
↓ (user clicks device)
MQTTEventLog (shows live events)
↓ (events stream in)
NotificationToast (shows alerts)
FileUploader (drag and drop)
↓ (files selected)
ProgressBar (upload progress)
↓ (upload complete)
NotificationToast (success message)
↓ (navigate to)
AudioFileCard (new file in library)
FlowCanvas (visual editor)
↓ (user adds node)
NodeEditor (configure node)
↓ (select audio)
Modal (audio picker)
↓ (connect nodes)
ScriptTreeView (updates structure)
- User authentication
- Device connection status
- MQTT connection
- Audio library index
- Current playback state
- Form inputs
- UI toggles (modals, sidebars)
- Temporary selections
- Filter/search criteria
- Device status updates
- Playback progress
- Event streams
- Connection health
Mobile: < 640px (1 column, stacked)
Tablet: 640-1024px (2 columns, simplified)
Desktop: > 1024px (full layout)
- Transitions: 200-300ms for UI state changes
- Loading: Skeleton screens for content loading
- Feedback: Micro-interactions on button clicks
- Modals: Fade in/slide up (300ms)
- Toasts: Slide in from top/bottom
- Node connections: Animated path drawing
- All interactive elements keyboard accessible
- Focus visible and logical order
- ARIA labels on icon buttons
- Color not sole indicator of state
- Alt text on meaningful images
- Screen reader announcements for state changes
- Form validation accessible
- Skip navigation links
- Lazy load audio waveforms
- Virtualize long lists (library, events)
- Debounce search inputs
- Throttle MQTT event rendering
- Code-split routes
- Optimize audio file previews
- Cache device status
- Efficient canvas rendering for flow editor