feat: add recent plays history modal
- GET /api/me/recent endpoint returning last 50 play events with track and artist info - RecentPlays modal component with time-ago display - "Recent plays" button in user dropdown menu - Clicking a track in history starts playback Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -80,6 +80,19 @@ export async function getTrackInfo(trackSlug: string): Promise<TrackDetail | nul
|
||||
return res?.data ?? null
|
||||
}
|
||||
|
||||
export type RecentPlay = {
|
||||
track_slug: string
|
||||
track_title: string
|
||||
artist_name: string
|
||||
album_slug: string | null
|
||||
played_at: string
|
||||
}
|
||||
|
||||
export async function getRecentPlays(): Promise<RecentPlay[] | null> {
|
||||
const res = await furumiApi.get<RecentPlay[]>('/me/recent').catch(() => null)
|
||||
return res?.data ?? null
|
||||
}
|
||||
|
||||
export async function recordPlay(trackSlug: string): Promise<void> {
|
||||
await furumiApi.post(`/tracks/${trackSlug}/play`).catch(() => null)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user