Unify playlist/favorites views
This commit is contained in:
45
CLAUDE.md
45
CLAUDE.md
@@ -12,14 +12,27 @@ QueueCube is a SwiftUI-based jukebox client application for iOS and macOS (via M
|
||||
|
||||
- **API.swift**: Central networking layer that handles all communication with the jukebox server. Includes REST API methods for playback control, playlist management, and WebSocket events for real-time updates.
|
||||
- **ContentView.swift**: Main view controller containing the `MainViewModel` that coordinates between UI components and API calls. Handles WebSocket event processing and data flow.
|
||||
- **Settings Management**: Server configuration stored in UserDefaults with validation through `SettingsViewModel` that tests connectivity on URL changes.
|
||||
- **Server.swift**: Represents individual jukebox servers with support for both manual configuration and Bonjour service discovery.
|
||||
- **Settings.swift**: Manages multiple server configurations stored in UserDefaults with validation through `SettingsViewModel` that tests connectivity on URL changes.
|
||||
|
||||
### Data Flow
|
||||
|
||||
1. **Settings**: Server URL stored in UserDefaults, validated asynchronously via API calls
|
||||
2. **Real-time Updates**: WebSocket connection provides live updates for playlist changes, playback state, and volume
|
||||
3. **API Integration**: All server communication goes through the `API` struct using a fluent `RequestBuilder` pattern
|
||||
4. **State Management**: Uses SwiftUI's `@Observable` pattern for reactive UI updates
|
||||
1. **Multiple Server Support**: Array of `Server` objects stored in UserDefaults with selected server tracking
|
||||
2. **Settings**: Server configurations validated asynchronously via API calls with live connectivity testing
|
||||
3. **Real-time Updates**: WebSocket connection provides live updates for playlist changes, playback state, and volume
|
||||
4. **API Integration**: All server communication goes through the `API` struct using a fluent `RequestBuilder` pattern
|
||||
5. **State Management**: Uses SwiftUI's `@Observable` pattern for reactive UI updates
|
||||
|
||||
### Request Builder Pattern
|
||||
|
||||
The API layer uses a fluent builder pattern for HTTP requests:
|
||||
```swift
|
||||
try await request()
|
||||
.path("/nowplaying")
|
||||
.json()
|
||||
```
|
||||
|
||||
This provides type-safe, composable API calls with automatic error handling and connection state management.
|
||||
|
||||
### Key Features
|
||||
|
||||
@@ -58,7 +71,23 @@ The server API includes these endpoints:
|
||||
|
||||
## UI Structure
|
||||
|
||||
### View Hierarchy
|
||||
```
|
||||
QueueCubeApp
|
||||
└── ContentView (coordination layer)
|
||||
└── MainView (tab management)
|
||||
├── PlaylistView (with embedded NowPlayingView)
|
||||
├── FavoritesView (favorites management)
|
||||
└── SettingsView (server configuration)
|
||||
├── ServerListSettingsView
|
||||
├── AddServerView
|
||||
└── GeneralSettingsView
|
||||
```
|
||||
|
||||
### Key Views
|
||||
- **ContentView**: Main coordinator that manages API instances and global state
|
||||
- **MainView**: Tab-based navigation container with platform-specific adaptations
|
||||
- **PlaylistView**: Scrollable list of queued media with reorder/delete actions, includes embedded NowPlayingView
|
||||
- **NowPlayingView**: Playback controls and current track display
|
||||
- **PlaylistView**: Scrollable list of queued media with reorder/delete actions
|
||||
- **AddMediaBarView**: Input field for adding new media URLs
|
||||
- **SettingsView**: Server configuration with live validation
|
||||
- **AddMediaBarView**: Input field for adding new media URLs to playlist
|
||||
- **SettingsView**: Multi-server configuration with live validation and service discovery
|
||||
Reference in New Issue
Block a user