Skip to content

Commit a79e90a

Browse files
Fix: Spotify UI and playback fixes from PR review (#9667)
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: arii <342438+arii@users.noreply.github.com>
1 parent b0c8f99 commit a79e90a

4 files changed

Lines changed: 7 additions & 11 deletions

File tree

app/api/spotify/playlists/[playlistId]/tracks/route.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ async function getPlaylistTracks(
104104
images: track.album.images,
105105
},
106106
duration_ms: track.duration_ms,
107+
duration: track.duration_ms, // Legacy fallback
107108
uri: track.uri,
108109
}
109110
})

components/Spotify/TrackListItem.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export const TrackListItem: React.FC<TrackListItemProps> = ({
5050
<Avatar
5151
variant="rounded"
5252
src={albumThumbnail}
53+
alt={track.name}
5354
sx={{ width: 32, height: 32 }}
5455
>
5556
<MusicNoteIcon fontSize="small" />

tests/unit/app/api/spotify/playlists/[playlistId]/tracks/route.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ describe('GET /api/spotify/playlists/[playlistId]/tracks', () => {
5959
name: 'Album 1',
6060
},
6161
duration_ms: 180000,
62+
duration: 180000,
6263
uri: 'spotify:track:t1',
6364
})
6465
})

types/websocket.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import type {
1111
SpotifyPlaybackState as SpotifyData, // Single source of truth for playback state
1212
TimerMode,
1313
SpotifyCommand,
14+
SpotifyCommandParameters,
1415
} from './core'
1516

1617
// --- WebSocket Connection & Augmentation ---
@@ -153,18 +154,9 @@ export interface TimerConfigMessage {
153154
restDuration: number
154155
}
155156

156-
export interface SpotifyCommandMessage {
157+
export interface SpotifyCommandMessage extends SpotifyCommandParameters {
157158
type: 'SPOTIFY_COMMAND'
158159
command: SpotifyCommand
159-
deviceId?: string
160-
volume?: number
161-
playlistUri?: string // Added to support your incoming message
162-
contextUri?: string // Generic support for albums/artists
163-
uri?: string
164-
offset?: {
165-
position?: number
166-
uri?: string
167-
}
168160
}
169161

170162
interface GetStateMessage {
@@ -256,7 +248,8 @@ const SpotifyCommandMessageSchema = z.object({
256248
uri: z.string().optional(),
257249
offset: z
258250
.object({
259-
position: z.number(),
251+
position: z.number().optional(),
252+
uri: z.string().optional(),
260253
})
261254
.optional(),
262255
})

0 commit comments

Comments
 (0)