feat(release-watch): dedicated tabbed view mirroring Qobuz mobile

Ports the Qobuz mobile 'Radar de Novedades' / Release Watch screen 1:1
(see rr0/i.java): a standalone view with three lazy-loaded tabs —
Artists, Labels, Awards — each hitting /favorite/getNewReleases with
the matching type parameter (limit 150 per tab, matching the mobile
cap).

Home's Release Watch rail (which still shows the Artists feed by
default, matching the mobile's default tab) now has a 'See all' link
that routes to the new view.

Adds view 'discover-release-watch' to the navigation type, wires the
route in +page.svelte, and adds tab/empty-state i18n keys in all five
locales.

cc
This commit is contained in:
vicrodh committed 2026-04-14 10:52:20 -06:00
1 parent 060395885b
commit ebeb86d03d
10 files changed
+463 -4

No files matched your search

+1 -1
View File
@@ -3012,7 +3012,7 @@ dependencies = [
[[package]]
name = "qbzd"
version = "0.1.0"
version = "0.1.9"
dependencies = [
"async-trait",
"axum",
+10 -3
View File
@@ -150,6 +150,7 @@
onNavigateQobuzissimes?: () => void;
onNavigateAlbumsOfTheWeek?: () => void;
onNavigatePressAccolades?: () => void;
onNavigateReleaseWatch?: () => void;
onNavigateQobuzPlaylists?: () => void;
onNavigateDailyQ?: () => void;
onNavigateWeeklyQ?: () => void;
@@ -202,6 +203,7 @@
onNavigateQobuzissimes,
onNavigateAlbumsOfTheWeek,
onNavigatePressAccolades,
onNavigateReleaseWatch,
onNavigateQobuzPlaylists,
onNavigateDailyQ,
onNavigateWeeklyQ,
@@ -1371,9 +1373,14 @@
{:else if releaseWatchAlbums.length > 0}
<HorizontalScrollRow>
{#snippet header()}
<div class="section-header-col">
<h2 class="section-title">{$t('home.releaseWatch')}</h2>
<p class="section-subtitle">{$t('discover.releaseWatch.subtitle')}</p>
<div class="section-header-group">
<div class="section-header-col">
<h2 class="section-title">{$t('home.releaseWatch')}</h2>
<p class="section-subtitle">{$t('discover.releaseWatch.subtitle')}</p>
</div>
{#if onNavigateReleaseWatch}
<button class="see-all-link" onclick={onNavigateReleaseWatch}>{$t('home.seeAll')}<ArrowRight size={14} /></button>
{/if}
</div>
{/snippet}
{#snippet children()}
@@ -0,0 +1,371 @@
<script lang="ts">
/**
* ReleaseWatchView — 1:1 port of the Qobuz mobile "Radar de Novedades"
* screen (see rr0/i.java in the v9.7.0.3 decompilation). Three tabs —
* Artists / Labels / Awards — each backed by
* `/favorite/getNewReleases?type=<tab>`. Mobile fetches one tab at a
* time on tab select; we do the same.
*/
import { invoke } from '@tauri-apps/api/core';
import { onMount } from 'svelte';
import { t } from '$lib/i18n';
import { ChevronLeft, User, Disc3, Award, LoaderCircle } from 'lucide-svelte';
import VirtualizedFavoritesAlbumGrid from '../VirtualizedFavoritesAlbumGrid.svelte';
import type { QobuzAlbum } from '$lib/types';
interface FavoriteAlbum {
id: string;
title: string;
artist: { id: number; name: string };
genre?: { name: string };
image: { small?: string; thumbnail?: string; large?: string };
release_date_original?: string;
hires: boolean;
maximum_bit_depth?: number;
maximum_sampling_rate?: number;
}
type TabType = 'artists' | 'labels' | 'awards';
interface Props {
onBack: () => void;
onAlbumClick?: (albumId: string) => void;
onAlbumPlay?: (albumId: string) => void;
onAlbumPlayNext?: (albumId: string) => void;
onAlbumPlayLater?: (albumId: string) => void;
onAlbumShareQobuz?: (albumId: string) => void;
onAlbumShareSonglink?: (albumId: string) => void;
onAlbumDownload?: (albumId: string) => void;
onOpenAlbumFolder?: (albumId: string) => void;
onReDownloadAlbum?: (albumId: string) => void;
onAddAlbumToPlaylist?: (albumId: string) => void;
checkAlbumFullyDownloaded?: (albumId: string) => Promise<boolean>;
downloadStateVersion?: number;
onArtistClick?: (artistId: number) => void;
}
let {
onBack,
onAlbumClick,
onAlbumPlay,
onAlbumPlayNext,
onAlbumPlayLater,
onAlbumShareQobuz,
onAlbumShareSonglink,
onAlbumDownload,
onOpenAlbumFolder,
onReDownloadAlbum,
onAddAlbumToPlaylist,
checkAlbumFullyDownloaded,
downloadStateVersion,
}: Props = $props();
const PAGE_SIZE = 50;
const MAX_PER_TAB = 150; // matches mobile's hard limit
let activeTab = $state<TabType>('artists');
let albumsByTab = $state<Record<TabType, FavoriteAlbum[]>>({ artists: [], labels: [], awards: [] });
let loadedTabs = new Set<TabType>();
let loadingTab = $state<TabType | null>(null);
let errorByTab = $state<Record<TabType, string | null>>({ artists: null, labels: null, awards: null });
let albumDownloadStatuses = $state<Map<string, boolean>>(new Map());
function qobuzToFavorite(item: QobuzAlbum): FavoriteAlbum {
const bitDepth = item.maximum_bit_depth ?? 16;
return {
id: item.id,
title: item.title,
artist: {
id: item.artist?.id ?? 0,
name: item.artist?.name || 'Unknown Artist',
},
genre: item.genre,
image: item.image as { small?: string; thumbnail?: string; large?: string },
release_date_original: item.release_date_original,
hires: bitDepth > 16,
maximum_bit_depth: item.maximum_bit_depth,
maximum_sampling_rate: item.maximum_sampling_rate,
};
}
async function fetchTab(tab: TabType) {
if (loadedTabs.has(tab)) return;
loadingTab = tab;
errorByTab = { ...errorByTab, [tab]: null };
try {
const result = await invoke<{ items: QobuzAlbum[]; total: number }>(
'v2_get_release_watch',
{ releaseType: tab, limit: MAX_PER_TAB, offset: 0 }
);
albumsByTab = {
...albumsByTab,
[tab]: (result.items || []).map(qobuzToFavorite),
};
loadedTabs.add(tab);
loadDownloadStatuses(albumsByTab[tab]).catch(() => {});
} catch (err) {
console.error(`[ReleaseWatch] failed to load ${tab}:`, err);
errorByTab = { ...errorByTab, [tab]: String(err) };
} finally {
if (loadingTab === tab) loadingTab = null;
}
}
async function loadDownloadStatuses(list: FavoriteAlbum[]) {
if (!checkAlbumFullyDownloaded) return;
for (const album of list) {
if (albumDownloadStatuses.has(album.id)) continue;
try {
const downloaded = await checkAlbumFullyDownloaded(album.id);
albumDownloadStatuses.set(album.id, downloaded);
} catch {
// ignore
}
}
albumDownloadStatuses = new Map(albumDownloadStatuses);
}
function isAlbumDownloaded(albumId: string): boolean {
void downloadStateVersion;
return albumDownloadStatuses.get(albumId) ?? false;
}
function selectTab(tab: TabType) {
activeTab = tab;
if (!loadedTabs.has(tab)) fetchTab(tab);
}
function getQualityLabel(item: { hires?: boolean; maximum_bit_depth?: number; maximum_sampling_rate?: number }): string {
if (!item.hires) return $t('quality.cdQuality');
const depth = item.maximum_bit_depth ?? 16;
const rate = item.maximum_sampling_rate ?? 44.1;
return `${depth}/${rate}kHz`;
}
function getAlbumYear(album: FavoriteAlbum): string | null {
if (!album.release_date_original) return null;
return album.release_date_original.substring(0, 4);
}
onMount(() => {
fetchTab('artists');
});
const tabs: { key: TabType; label: string; icon: typeof User }[] = [
{ key: 'artists', label: 'releaseWatch.tabs.artists', icon: User },
{ key: 'labels', label: 'releaseWatch.tabs.labels', icon: Disc3 },
{ key: 'awards', label: 'releaseWatch.tabs.awards', icon: Award },
];
</script>
<div class="release-watch">
<div class="top-bar">
<button class="back-btn" onclick={onBack} title={$t('actions.back')}>
<ChevronLeft size={20} />
</button>
<div class="header-text">
<h1 class="page-title">{$t('home.releaseWatch')}</h1>
<p class="page-subtitle">{$t('discover.releaseWatch.subtitle')}</p>
</div>
</div>
<div class="tabs">
{#each tabs as tab}
{@const Icon = tab.icon}
<button
class="tab"
class:active={activeTab === tab.key}
onclick={() => selectTab(tab.key)}
>
<Icon size={16} />
<span>{$t(tab.label)}</span>
{#if albumsByTab[tab.key].length > 0}
<span class="tab-count">{albumsByTab[tab.key].length}</span>
{/if}
</button>
{/each}
</div>
<div class="content">
{#if loadingTab === activeTab && albumsByTab[activeTab].length === 0}
<div class="loading-state">
<LoaderCircle size={28} class="spinner" />
<p>{$t('favorites.loadingFavorites')}</p>
</div>
{:else if errorByTab[activeTab]}
<div class="empty-state">
<p>{$t('favorites.failedLoadFavorites')}</p>
<p class="error-detail">{errorByTab[activeTab]}</p>
<button class="retry-btn" onclick={() => { loadedTabs.delete(activeTab); fetchTab(activeTab); }}>
{$t('actions.retry')}
</button>
</div>
{:else if albumsByTab[activeTab].length === 0}
<div class="empty-state">
<p>{$t(`releaseWatch.empty.${activeTab}`)}</p>
</div>
{:else}
<VirtualizedFavoritesAlbumGrid
groups={[{ key: '', id: 'all', albums: albumsByTab[activeTab] }]}
showGroupHeaders={false}
viewMode="grid"
onAlbumClick={onAlbumClick}
onAlbumPlay={onAlbumPlay}
onAlbumPlayNext={onAlbumPlayNext}
onAlbumPlayLater={onAlbumPlayLater}
onAlbumShareQobuz={onAlbumShareQobuz}
onAlbumShareSonglink={onAlbumShareSonglink}
onAlbumDownload={onAlbumDownload}
onOpenAlbumFolder={onOpenAlbumFolder}
onReDownloadAlbum={onReDownloadAlbum}
onAddAlbumToPlaylist={onAddAlbumToPlaylist}
{downloadStateVersion}
{isAlbumDownloaded}
{getQualityLabel}
{getAlbumYear}
/>
{/if}
</div>
</div>
<style>
.release-watch {
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
}
.top-bar {
display: flex;
align-items: center;
gap: 12px;
padding: 20px 24px 8px 24px;
flex-shrink: 0;
}
.back-btn {
display: flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
background: transparent;
border: none;
border-radius: 6px;
color: var(--text-secondary);
cursor: pointer;
transition: background-color 150ms ease, color 150ms ease;
}
.back-btn:hover {
background: var(--bg-tertiary);
color: var(--text-primary);
}
.header-text {
display: flex;
flex-direction: column;
gap: 2px;
}
.page-title {
font-size: 24px;
font-weight: 600;
color: var(--text-primary);
margin: 0;
}
.page-subtitle {
font-size: 13px;
color: var(--text-secondary);
margin: 0;
}
.tabs {
display: flex;
gap: 4px;
padding: 0 24px;
margin-bottom: 16px;
border-bottom: 1px solid var(--border-primary);
flex-shrink: 0;
}
.tab {
display: flex;
align-items: center;
gap: 8px;
padding: 10px 16px;
background: transparent;
border: none;
border-bottom: 2px solid transparent;
color: var(--text-secondary);
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: color 150ms ease, border-color 150ms ease;
}
.tab:hover:not(.active) {
color: var(--text-primary);
}
.tab.active {
color: var(--accent-primary);
border-bottom-color: var(--accent-primary);
}
.tab-count {
font-size: 11px;
font-weight: 600;
padding: 2px 6px;
border-radius: 999px;
background: var(--bg-tertiary);
color: var(--text-muted);
}
.tab.active .tab-count {
background: color-mix(in srgb, var(--accent-primary) 15%, transparent);
color: var(--accent-primary);
}
.content {
flex: 1;
min-height: 0;
overflow: hidden;
padding: 0 24px;
}
.loading-state,
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 12px;
padding: 48px 24px;
color: var(--text-secondary);
text-align: center;
}
.error-detail {
font-size: 12px;
color: var(--text-muted);
}
.retry-btn {
margin-top: 8px;
padding: 8px 16px;
background: var(--bg-tertiary);
border: 1px solid var(--border-primary);
border-radius: 6px;
color: var(--text-primary);
font-size: 13px;
cursor: pointer;
transition: background-color 150ms ease;
}
.retry-btn:hover {
background: var(--bg-secondary);
}
</style>
+12
View File
@@ -2613,5 +2613,17 @@
"ribbon": {
"albumOfTheWeek": "Album der Woche",
"qobuzissime": "Qobuzissime"
},
"releaseWatch": {
"tabs": {
"artists": "Künstler",
"labels": "Labels",
"awards": "Auszeichnungen"
},
"empty": {
"artists": "Keine Neuerscheinungen von den Künstlern, denen du folgst.",
"labels": "Keine Neuerscheinungen von den Labels, denen du folgst.",
"awards": "Keine Neuerscheinungen von den Auszeichnungen, denen du folgst."
}
}
}
+12
View File
@@ -2613,5 +2613,17 @@
"ribbon": {
"albumOfTheWeek": "Album of the Week",
"qobuzissime": "Qobuzissime"
},
"releaseWatch": {
"tabs": {
"artists": "Artists",
"labels": "Labels",
"awards": "Awards"
},
"empty": {
"artists": "No new releases from the artists you follow.",
"labels": "No new releases from the labels you follow.",
"awards": "No new releases from the awards you follow."
}
}
}
+12
View File
@@ -2613,5 +2613,17 @@
"ribbon": {
"albumOfTheWeek": "Álbum de la semana",
"qobuzissime": "Qobuzissime"
},
"releaseWatch": {
"tabs": {
"artists": "Artistas",
"labels": "Sellos",
"awards": "Premios"
},
"empty": {
"artists": "No hay novedades de los artistas que sigues.",
"labels": "No hay novedades de los sellos que sigues.",
"awards": "No hay novedades de los premios que sigues."
}
}
}
+12
View File
@@ -2613,5 +2613,17 @@
"ribbon": {
"albumOfTheWeek": "Album de la semaine",
"qobuzissime": "Qobuzissime"
},
"releaseWatch": {
"tabs": {
"artists": "Artistes",
"labels": "Labels",
"awards": "Récompenses"
},
"empty": {
"artists": "Aucune nouveauté des artistes que vous suivez.",
"labels": "Aucune nouveauté des labels que vous suivez.",
"awards": "Aucune nouveauté des récompenses que vous suivez."
}
}
}
+12
View File
@@ -2613,5 +2613,17 @@
"ribbon": {
"albumOfTheWeek": "Álbum da semana",
"qobuzissime": "Qobuzissime"
},
"releaseWatch": {
"tabs": {
"artists": "Artistas",
"labels": "Selos",
"awards": "Prêmios"
},
"empty": {
"artists": "Nenhuma novidade dos artistas que você segue.",
"labels": "Nenhuma novidade dos selos que você segue.",
"awards": "Nenhuma novidade dos prêmios que você segue."
}
}
}
+1
View File
@@ -32,6 +32,7 @@ export type ViewType =
| 'discover-albums-of-the-week'
| 'discover-press-accolades'
| 'discover-playlists'
| 'discover-release-watch'
| 'purchases'
| 'purchase-album'
| 'dailyq'
+20
View File
@@ -415,6 +415,7 @@
import BlacklistManagerView from '$lib/components/views/BlacklistManagerView.svelte';
import DiscoverBrowseView from '$lib/components/views/DiscoverBrowseView.svelte';
import DiscoverPlaylistsBrowseView from '$lib/components/views/DiscoverPlaylistsBrowseView.svelte';
import ReleaseWatchView from '$lib/components/views/ReleaseWatchView.svelte';
import PurchasesView from '$lib/components/views/PurchasesView.svelte';
import PurchaseAlbumDetailView from '$lib/components/views/PurchaseAlbumDetailView.svelte';
import DynamicSuggestView from '$lib/components/views/DynamicSuggestView.svelte';
@@ -632,6 +633,7 @@
case 'discover-albums-of-the-week':
case 'discover-press-accolades':
case 'discover-playlists':
case 'discover-release-watch':
case 'purchases':
case 'dailyq':
case 'weeklyq':
@@ -5034,6 +5036,7 @@
onNavigateQobuzissimes={() => navigateTo('discover-qobuzissimes')}
onNavigateAlbumsOfTheWeek={() => navigateTo('discover-albums-of-the-week')}
onNavigatePressAccolades={() => navigateTo('discover-press-accolades')}
onNavigateReleaseWatch={() => navigateTo('discover-release-watch')}
onNavigateQobuzPlaylists={() => navigateTo('discover-playlists')}
onNavigateDailyQ={() => navigateTo('dailyq')}
onNavigateWeeklyQ={() => navigateTo('weeklyq')}
@@ -5520,6 +5523,23 @@
onPlaylistCopyToLibrary={copyPlaylistToLibraryById}
onPlaylistShareQobuz={sharePlaylistQobuzLinkById}
/>
{:else if activeView === 'discover-release-watch'}
<ReleaseWatchView
onBack={navGoBack}
onAlbumClick={handleAlbumClick}
onAlbumPlay={playAlbumById}
onAlbumPlayNext={queueAlbumNextById}
onAlbumPlayLater={queueAlbumLaterById}
onAlbumShareQobuz={shareAlbumQobuzLinkById}
onAlbumShareSonglink={shareAlbumSonglinkById}
onAlbumDownload={downloadAlbumById}
onOpenAlbumFolder={openAlbumFolderById}
onReDownloadAlbum={reDownloadAlbumById}
onAddAlbumToPlaylist={addAlbumToPlaylistById}
checkAlbumFullyDownloaded={checkAlbumFullyDownloaded}
{downloadStateVersion}
onArtistClick={handleArtistClick}
/>
{:else if activeView === 'dailyq'}
<DynamicSuggestView
onBack={navGoBack}