diff --git a/Cargo.lock b/Cargo.lock
index f6bd874..2384686 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6325,7 +6325,7 @@ checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9"
[[package]]
name = "yandex-music-rs"
-version = "0.1.3"
+version = "0.1.4"
dependencies = [
"aes",
"anyhow",
diff --git a/Cargo.toml b/Cargo.toml
index f9a987d..7a0d324 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "yandex-music-rs"
-version = "0.1.3"
+version = "0.1.4"
edition = "2021"
description = "Native high-performance, ultra-low-RAM Yandex Music desktop client in Rust + ash Vulkan SDF + taffy + cosmic-text"
diff --git a/README.md b/README.md
index 52e3451..5a4182e 100644
--- a/README.md
+++ b/README.md
@@ -10,12 +10,12 @@
Готовые сборки доступны на странице [Releases](https://git.tatar/marwy/yandex-music-rs/releases):
-- **Windows (x64)**: скачайте `yandex-music-rs-v0.1.3-windows-x86_64.exe` и запустите (переносной файл, установка не требуется).
-- **Linux (Debian / Ubuntu x64)**: скачайте `yandex-music-rs_0.1.3-1_amd64.deb` и установите:
+- **Windows (x64)**: скачайте `yandex-music-rs-v0.1.4-windows-x86_64.exe` и запустите (переносной файл, установка не требуется).
+- **Linux (Debian / Ubuntu x64)**: скачайте `yandex-music-rs_0.1.4-1_amd64.deb` и установите:
```bash
- sudo apt install ./yandex-music-rs_0.1.3-1_amd64.deb
+ sudo apt install ./yandex-music-rs_0.1.4-1_amd64.deb
```
-- **Linux (generic x64)**: архив `yandex-music-rs-v0.1.3-linux-x86_64.tar.gz` с готовыми бинарниками (`yandex-music-rs` + `yandex-music-auth`).
+- **Linux (generic x64)**: архив `yandex-music-rs-v0.1.4-linux-x86_64.tar.gz` с готовыми бинарниками (`yandex-music-rs` + `yandex-music-auth`).
## Стек и возможности
diff --git a/assets/icons/navigationConcerts_selected_xs.svg b/assets/icons/navigationConcerts_selected_xs.svg
index 5216578..06aacdc 100644
--- a/assets/icons/navigationConcerts_selected_xs.svg
+++ b/assets/icons/navigationConcerts_selected_xs.svg
@@ -1,3 +1,3 @@
-
\ No newline at end of file
+
diff --git a/src/api/demo_data.rs b/src/api/demo_data.rs
index 70a3a7c..9de951a 100644
--- a/src/api/demo_data.rs
+++ b/src/api/demo_data.rs
@@ -92,6 +92,7 @@ pub fn demo_landing() -> LandingData {
AlbumSummary {
id: "rel_1".into(),
title: "YAMAKASI (Deluxe)".into(),
+ version: None,
year: Some(2026),
cover_uri: None,
artists: vec![artist("a1", "Miyagi & Эндшпиль")],
@@ -103,6 +104,7 @@ pub fn demo_landing() -> LandingData {
AlbumSummary {
id: "rel_2".into(),
title: "Ночной проспект".into(),
+ version: None,
year: Some(2026),
cover_uri: None,
artists: vec![artist("a2", "Zivert")],
@@ -114,6 +116,7 @@ pub fn demo_landing() -> LandingData {
AlbumSummary {
id: "rel_3".into(),
title: "Зеркала и эхо".into(),
+ version: None,
year: Some(2026),
cover_uri: None,
artists: vec![artist("a3", "Три дня дождя")],
@@ -125,6 +128,7 @@ pub fn demo_landing() -> LandingData {
AlbumSummary {
id: "rel_4".into(),
title: "Midnight Horizons".into(),
+ version: None,
year: Some(2026),
cover_uri: None,
artists: vec![artist("a4", "The Weeknd")],
@@ -136,6 +140,7 @@ pub fn demo_landing() -> LandingData {
AlbumSummary {
id: "rel_5".into(),
title: "Синтетика".into(),
+ version: None,
year: Some(2026),
cover_uri: None,
artists: vec![artist("a5", "Saluki")],
@@ -147,6 +152,7 @@ pub fn demo_landing() -> LandingData {
AlbumSummary {
id: "rel_6".into(),
title: "Тихий океан".into(),
+ version: None,
year: Some(2026),
cover_uri: None,
artists: vec![artist("a6", "Баста")],
@@ -234,6 +240,7 @@ pub fn demo_landing() -> LandingData {
AlbumSummary {
id: "pod_1".into(),
title: "Подкаст «Запуск завтра»".into(),
+ version: None,
year: Some(2026),
cover_uri: None,
artists: vec![artist("p1", "Самат Галимов")],
@@ -245,6 +252,7 @@ pub fn demo_landing() -> LandingData {
AlbumSummary {
id: "pod_2".into(),
title: "Дневники Лоры Палны".into(),
+ version: None,
year: Some(2026),
cover_uri: None,
artists: vec![artist("p2", "Студия Терменвокс")],
@@ -256,6 +264,7 @@ pub fn demo_landing() -> LandingData {
AlbumSummary {
id: "pod_3".into(),
title: "Краткая история времени".into(),
+ version: None,
year: Some(2025),
cover_uri: None,
artists: vec![artist("p3", "Стивен Хокинг (Аудиокнига)")],
@@ -267,6 +276,7 @@ pub fn demo_landing() -> LandingData {
AlbumSummary {
id: "pod_4".into(),
title: "Хоббит, или Туда и обратно".into(),
+ version: None,
year: Some(2025),
cover_uri: None,
artists: vec![artist("p4", "Дж. Р. Р. Толкин")],
@@ -557,6 +567,7 @@ pub fn demo_lyrics(track: &Track) -> TrackLyrics {
is_synced: true,
lines,
writers: Some("Яндекс Музыка Rust (Демо-режим)".into()),
+ major: None,
}
}
diff --git a/src/api/mod.rs b/src/api/mod.rs
index 470b1c4..4534a9b 100644
--- a/src/api/mod.rs
+++ b/src/api/mod.rs
@@ -670,7 +670,7 @@ impl YandexApiClient {
let res = self.get_json("/pins").await?;
let ru = self.language == "ru";
let mut out = Vec::new();
- let mut seen_likes = false;
+ let mut seen_keys: HashSet<(String, String)> = HashSet::new();
let arr = res["pins"].as_array().or_else(|| res.as_array());
if let Some(items) = arr {
for item in items {
@@ -679,30 +679,37 @@ impl YandexApiClient {
match kind {
"playlist" | "playlist_item" | "liked_playlist_item" | "personal_playlist_item" => {
if let Some(pl) = parse_playlist(data) {
- let is_likes = pl.kind == "3"
- || kind == "liked_playlist_item"
- || pl.title == "Мне нравится"
- || pl.title == "My Favorites";
- if is_likes {
- if seen_likes {
- continue;
- }
- seen_likes = true;
+ // Only explicit `liked_playlist_item` is guaranteed to be the user's own system Favorites.
+ // A friend's "Мне нравится" playlist ALSO has `pl.kind == "3"` (with a different `owner_uid`),
+ // so preserve `owner_uid:kind` here and let `AppState::normalize_pins` collapse only `my_uid:3`!
+ let is_system_likes = kind == "liked_playlist_item";
+ let pin_kind = if is_system_likes {
+ "likes".to_string()
+ } else {
+ "playlist".to_string()
+ };
+ let pin_id = if is_system_likes {
+ "likes".to_string()
+ } else {
+ format!("{}:{}", pl.owner_uid, pl.kind)
+ };
+ if !seen_keys.insert((pin_kind.clone(), pin_id.clone())) {
+ continue;
}
+ let likes_title = if ru { "Мне нравится" } else { "My Favorites" };
+ let title = if is_system_likes
+ || (pl.kind == "3" && pl.title.trim().is_empty())
+ {
+ likes_title.into()
+ } else {
+ pl.title
+ };
out.push(PinnedItem {
- id: if is_likes {
- "likes".into()
- } else {
- format!("{}:{}", pl.owner_uid, pl.kind)
- },
- kind: if is_likes { "likes".into() } else { "playlist".into() },
- title: if is_likes {
- if ru { "Мне нравится".into() } else { "My Favorites".into() }
- } else {
- pl.title
- },
+ id: pin_id,
+ kind: pin_kind,
+ title,
subtitle: if ru { "Плейлист".into() } else { "Playlist".into() },
- cover_uri: if is_likes { None } else { pl.cover_uri },
+ cover_uri: if is_system_likes { None } else { pl.cover_uri },
owner_uid: Some(pl.owner_uid),
});
}
@@ -1739,74 +1746,186 @@ impl YandexApiClient {
Ok(out)
}
- pub async fn fetch_liked_albums(&self, uid: u64) -> Result> {
- let res = match self
- .get_json(&format!(
- "/users/{}/likes/albums/page?rich=true&page=0&pageSize=100",
- uid
- ))
- .await
- {
- Ok(v) => v,
- Err(_) => {
- self.get_json(&format!("/users/{}/likes/albums?rich=true", uid))
- .await?
- }
- };
- let arr = res["albums"]
- .as_array()
- .or_else(|| res["items"].as_array())
- .or_else(|| res.as_array());
- let mut out = Vec::new();
- if let Some(items) = arr {
- for item in items {
- let node = if item.get("album").is_some() {
- &item["album"]
- } else {
- item
- };
- if let Some(alb) = parse_album(node) {
- out.push(alb);
+ pub async fn fetch_albums_by_ids(&self, ids: &[String]) -> Result> {
+ if ids.is_empty() {
+ return Ok(Vec::new());
+ }
+ let mut out = Vec::with_capacity(ids.len());
+ let mut seen = HashSet::new();
+ for chunk in ids.chunks(100) {
+ let joined = chunk.join(",");
+ if let Ok(res) = self
+ .post_form("/albums", &[("album-ids", joined)])
+ .await
+ {
+ let arr = res.as_array().or_else(|| res["albums"].as_array());
+ if let Some(items) = arr {
+ for item in items {
+ if let Some(alb) = parse_album(item) {
+ if seen.insert(alb.id.clone()) {
+ out.push(alb);
+ }
+ }
+ }
}
}
}
Ok(out)
}
- pub async fn fetch_liked_artists(&self, uid: u64) -> Result> {
- let res = match self
- .get_json(&format!(
- "/users/{}/likes/artists/page?page=0&pageSize=100",
- uid
- ))
- .await
- {
- Ok(v) => v,
- Err(_) => {
- self.get_json(&format!("/users/{}/likes/artists", uid))
- .await?
- }
- };
- let arr = res["artists"]
- .as_array()
- .or_else(|| res["items"].as_array())
- .or_else(|| res.as_array());
- let mut out = Vec::new();
- if let Some(items) = arr {
- for item in items {
- let node = if item.get("artist").is_some() {
- &item["artist"]
- } else {
- item
- };
- if let Some(art) = parse_artist(node) {
- out.push(art);
+ pub async fn fetch_artists_by_ids(&self, ids: &[String]) -> Result> {
+ if ids.is_empty() {
+ return Ok(Vec::new());
+ }
+ let mut out = Vec::with_capacity(ids.len());
+ let mut seen = HashSet::new();
+ for chunk in ids.chunks(100) {
+ let joined = chunk.join(",");
+ if let Ok(res) = self
+ .post_form("/artists", &[("artist-ids", joined)])
+ .await
+ {
+ let arr = res.as_array().or_else(|| res["artists"].as_array());
+ if let Some(items) = arr {
+ for item in items {
+ if let Some(art) = parse_artist(item) {
+ if seen.insert(art.id.clone()) {
+ out.push(art);
+ }
+ }
+ }
}
}
}
Ok(out)
}
+ pub async fn fetch_liked_albums(&self, uid: u64) -> Result> {
+ let mut out: Vec = Vec::new();
+ let mut seen_ids: HashSet = HashSet::new();
+ let mut bare_ids: Vec = Vec::new();
+ let mut seen_bare: HashSet = HashSet::new();
+
+ for page in 0..5u32 {
+ let path = format!(
+ "/users/{}/likes/albums/page?rich=true&metaType=music&page={}&pageSize=100",
+ uid, page
+ );
+ let Ok(res) = self.get_json(&path).await else {
+ break;
+ };
+ let (raw_count, page_albs, page_bare) = parse_liked_albums_entries(&res);
+ for alb in page_albs {
+ if seen_ids.insert(alb.id.clone()) {
+ out.push(alb);
+ }
+ }
+ for bid in page_bare {
+ if !seen_ids.contains(&bid) && seen_bare.insert(bid.clone()) {
+ bare_ids.push(bid);
+ }
+ }
+ if raw_count < 100 {
+ break;
+ }
+ }
+
+ // Fallback if `/likes/albums/page` failed or returned nothing
+ if out.is_empty() && bare_ids.is_empty() {
+ if let Ok(res) = self
+ .get_json(&format!("/users/{}/likes/albums?rich=true", uid))
+ .await
+ {
+ let (_, page_albs, page_bare) = parse_liked_albums_entries(&res);
+ for alb in page_albs {
+ if seen_ids.insert(alb.id.clone()) {
+ out.push(alb);
+ }
+ }
+ for bid in page_bare {
+ if !seen_ids.contains(&bid) && seen_bare.insert(bid.clone()) {
+ bare_ids.push(bid);
+ }
+ }
+ }
+ }
+
+ if !bare_ids.is_empty() {
+ if let Ok(hydrated) = self.fetch_albums_by_ids(&bare_ids).await {
+ for alb in hydrated {
+ if seen_ids.insert(alb.id.clone()) {
+ out.push(alb);
+ }
+ }
+ }
+ }
+
+ Ok(out)
+ }
+
+ pub async fn fetch_liked_artists(&self, uid: u64) -> Result> {
+ let mut out: Vec = Vec::new();
+ let mut seen_ids: HashSet = HashSet::new();
+ let mut bare_ids: Vec = Vec::new();
+ let mut seen_bare: HashSet = HashSet::new();
+
+ for page in 0..5u32 {
+ let path = format!(
+ "/users/{}/likes/artists/page?page={}&pageSize=100",
+ uid, page
+ );
+ let Ok(res) = self.get_json(&path).await else {
+ break;
+ };
+ let (raw_count, page_arts, page_bare) = parse_liked_artists_entries(&res);
+ for art in page_arts {
+ if seen_ids.insert(art.id.clone()) {
+ out.push(art);
+ }
+ }
+ for bid in page_bare {
+ if !seen_ids.contains(&bid) && seen_bare.insert(bid.clone()) {
+ bare_ids.push(bid);
+ }
+ }
+ if raw_count < 100 {
+ break;
+ }
+ }
+
+ // Fallback if `/likes/artists/page` failed or returned empty!
+ if out.is_empty() && bare_ids.is_empty() {
+ if let Ok(res) = self
+ .get_json(&format!("/users/{}/likes/artists", uid))
+ .await
+ {
+ let (_, page_arts, page_bare) = parse_liked_artists_entries(&res);
+ for art in page_arts {
+ if seen_ids.insert(art.id.clone()) {
+ out.push(art);
+ }
+ }
+ for bid in page_bare {
+ if !seen_ids.contains(&bid) && seen_bare.insert(bid.clone()) {
+ bare_ids.push(bid);
+ }
+ }
+ }
+ }
+
+ if !bare_ids.is_empty() {
+ if let Ok(hydrated) = self.fetch_artists_by_ids(&bare_ids).await {
+ for art in hydrated {
+ if seen_ids.insert(art.id.clone()) {
+ out.push(art);
+ }
+ }
+ }
+ }
+
+ Ok(out)
+ }
+
pub async fn fetch_bookshelf_liked(&self) -> Result> {
let mut out: Vec = Vec::new();
let mut seen: HashSet = HashSet::new();
@@ -1967,10 +2086,7 @@ impl YandexApiClient {
.as_array()
.map(|a| a.iter().filter_map(parse_track).collect())
.unwrap_or_default();
- let albums = res["albums"]
- .as_array()
- .map(|a| a.iter().filter_map(parse_album).collect())
- .unwrap_or_default();
+ let albums = parse_artist_detail_albums(&res);
let similar_artists = res["similarArtists"]
.as_array()
.map(|a| a.iter().filter_map(parse_artist).collect())
@@ -2478,6 +2594,7 @@ impl YandexApiClient {
is_synced: false,
lines,
writers,
+ major: None,
});
}
}
@@ -2515,6 +2632,11 @@ impl YandexApiClient {
.filter(|u| !u.is_empty())
.ok_or_else(|| anyhow!("No lyrics downloadUrl ({})", format))?;
let writers = parse_writers_field(&res["writers"]);
+ let major = res["major"]["prettyName"]
+ .as_str()
+ .map(str::trim)
+ .filter(|s| !s.is_empty())
+ .map(String::from);
let resp = self.http.get(download_url).send().await?;
if !resp.status().is_success() {
return Err(anyhow!(
@@ -2533,6 +2655,7 @@ impl YandexApiClient {
is_synced: parsed_synced && format == "LRC",
lines,
writers,
+ major,
})
}
@@ -3310,9 +3433,103 @@ fn parse_artist(v: &Value) -> Option {
})
}
+fn parse_liked_albums_entries(res: &Value) -> (usize, Vec, Vec) {
+ let arr = res["albums"]
+ .as_array()
+ .or_else(|| res["items"].as_array())
+ .or_else(|| res["library"]["albums"].as_array())
+ .or_else(|| res.as_array());
+ let Some(items) = arr else {
+ return (0, Vec::new(), Vec::new());
+ };
+ let mut albs = Vec::new();
+ let mut bare_ids = Vec::new();
+ for item in items {
+ let parsed = if item["data"]["album"].is_object() {
+ parse_album_with_fallback_artists(&item["data"]["album"], item["data"].get("artists"))
+ } else if item["album"].is_object() {
+ parse_album_with_fallback_artists(&item["album"], item.get("artists"))
+ } else if item["data"].is_object() {
+ parse_album_with_fallback_artists(&item["data"], item["data"].get("artists"))
+ } else {
+ parse_album(item)
+ };
+ if let Some(alb) = parsed {
+ albs.push(alb);
+ } else if let Some(bid) = value_id(&item["id"])
+ .or_else(|| value_id(&item["album"]["id"]))
+ .or_else(|| value_id(&item["data"]["id"]))
+ {
+ bare_ids.push(bid);
+ }
+ }
+ (items.len(), albs, bare_ids)
+}
+
+fn parse_liked_artists_entries(res: &Value) -> (usize, Vec, Vec) {
+ let arr = res["artists"]
+ .as_array()
+ .or_else(|| res["items"].as_array())
+ .or_else(|| res["library"]["artists"].as_array())
+ .or_else(|| res.as_array());
+ let Some(items) = arr else {
+ return (0, Vec::new(), Vec::new());
+ };
+ let mut arts = Vec::new();
+ let mut bare_ids = Vec::new();
+ for item in items {
+ let node = if item["data"]["artist"].is_object() {
+ &item["data"]["artist"]
+ } else if item["artist"].is_object() {
+ &item["artist"]
+ } else if item["data"].is_object() {
+ &item["data"]
+ } else {
+ item
+ };
+ if let Some(art) = parse_artist(node) {
+ arts.push(art);
+ } else if let Some(bid) = value_id(&node["id"]).or_else(|| value_id(&item["id"])) {
+ bare_ids.push(bid);
+ }
+ }
+ (items.len(), arts, bare_ids)
+}
+
+fn parse_artist_detail_albums(res: &Value) -> Vec {
+ let mut out = Vec::new();
+ let mut seen_ids = HashSet::new();
+ for key in ["albums", "alsoAlbums", "discography"] {
+ if let Some(arr) = res[key].as_array() {
+ for item in arr {
+ if let Some(alb) = parse_album(item) {
+ if seen_ids.insert(alb.id.clone()) {
+ out.push(alb);
+ }
+ }
+ if let Some(dups) = item["duplicates"].as_array() {
+ for dup in dups {
+ if let Some(alb) = parse_album(dup) {
+ if seen_ids.insert(alb.id.clone()) {
+ out.push(alb);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ out
+}
+
fn parse_album(v: &Value) -> Option {
let title = v["title"].as_str()?.to_string();
let id = value_id(&v["id"])?;
+ let version = v["version"]
+ .as_str()
+ .map(str::trim)
+ .filter(|s| !s.is_empty())
+ .map(String::from);
let year = v["year"].as_u64().map(|y| y as u32);
let cover_uri = v["coverUri"]
.as_str()
@@ -3334,6 +3551,7 @@ fn parse_album(v: &Value) -> Option {
Some(AlbumSummary {
id,
title,
+ version,
year,
cover_uri,
artists,
@@ -3854,4 +4072,79 @@ mod tests {
assert_eq!(tabs[0].items[0].seeds, vec!["language:english"]);
assert_eq!(tabs[0].items[0].color_hex.as_deref(), Some("#3B82F6"));
}
+
+ #[test]
+ fn test_duplicate_title_albums_and_liked_library_parsers() {
+ let artist_res = json!({
+ "albums": [
+ {
+ "id": 1001,
+ "title": "After Hours",
+ "year": 2020,
+ "duplicates": [
+ {
+ "id": 1002,
+ "title": "After Hours",
+ "version": "Deluxe",
+ "year": 2020
+ }
+ ]
+ }
+ ],
+ "alsoAlbums": [
+ {
+ "id": 1003,
+ "title": "After Hours (Deluxe)",
+ "version": "Deluxe",
+ "year": 2020
+ },
+ {
+ "id": 1001,
+ "title": "After Hours",
+ "year": 2020
+ }
+ ]
+ });
+
+ let albs = parse_artist_detail_albums(&artist_res);
+ // Strictly deduped by ID (1001, 1002, 1003), NEVER by title!
+ assert_eq!(albs.len(), 3);
+ assert_eq!(albs[0].id, "1001");
+ assert_eq!(albs[0].full_title(), "After Hours");
+ assert_eq!(albs[1].id, "1002");
+ assert_eq!(albs[1].full_title(), "After Hours (Deluxe)");
+ // Version already in title -> no double "(Deluxe) (Deluxe)"
+ assert_eq!(albs[2].id, "1003");
+ assert_eq!(albs[2].full_title(), "After Hours (Deluxe)");
+
+ // Liked albums mixed shapes + bare ID record
+ let liked_albs_res = json!({
+ "albums": [
+ { "album": { "id": 10, "title": "Same Title" } },
+ { "data": { "id": 11, "title": "Same Title", "version": "Slowed" } },
+ { "id": 12 }
+ ]
+ });
+ let (cnt, parsed_albs, bare_alb_ids) = parse_liked_albums_entries(&liked_albs_res);
+ assert_eq!(cnt, 3);
+ assert_eq!(parsed_albs.len(), 2);
+ assert_eq!(parsed_albs[0].full_title(), "Same Title");
+ assert_eq!(parsed_albs[1].full_title(), "Same Title (Slowed)");
+ assert_eq!(bare_alb_ids, vec!["12"]);
+
+ // Liked artists mixed shapes + bare ID record
+ let liked_arts_res = json!({
+ "artists": [
+ { "artist": { "id": 20, "name": "Artist One" } },
+ { "data": { "artist": { "id": 21, "name": "Artist Two" } } },
+ { "id": 22 }
+ ]
+ });
+ let (acnt, parsed_arts, bare_art_ids) = parse_liked_artists_entries(&liked_arts_res);
+ assert_eq!(acnt, 3);
+ assert_eq!(parsed_arts.len(), 2);
+ assert_eq!(parsed_arts[0].name, "Artist One");
+ assert_eq!(parsed_arts[1].name, "Artist Two");
+ assert_eq!(bare_art_ids, vec!["22"]);
+ }
}
diff --git a/src/api/models.rs b/src/api/models.rs
index fca575f..67344a5 100644
--- a/src/api/models.rs
+++ b/src/api/models.rs
@@ -24,6 +24,8 @@ pub struct ArtistSummary {
pub struct AlbumSummary {
pub id: String,
pub title: String,
+ #[serde(default)]
+ pub version: Option,
pub year: Option,
pub cover_uri: Option,
pub artists: Vec,
@@ -35,6 +37,24 @@ pub struct AlbumSummary {
pub content_type: Option,
}
+impl AlbumSummary {
+ /// Display title including edition/version (e.g. `"Album (Deluxe)"`) when `version` is non-empty
+ /// and not already present in `title`, so duplicate-title editions stay clearly distinguishable.
+ pub fn full_title(&self) -> String {
+ match self
+ .version
+ .as_deref()
+ .map(str::trim)
+ .filter(|v| !v.is_empty())
+ {
+ Some(ver) if !self.title.to_lowercase().contains(&ver.to_lowercase()) => {
+ format!("{} ({})", self.title, ver)
+ }
+ _ => self.title.clone(),
+ }
+ }
+}
+
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Track {
pub id: String,
@@ -158,6 +178,8 @@ pub struct TrackLyrics {
pub is_synced: bool,
pub lines: Vec,
pub writers: Option,
+ #[serde(default)]
+ pub major: Option,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
diff --git a/src/app/state.rs b/src/app/state.rs
index 652d210..fb5e30e 100644
--- a/src/app/state.rs
+++ b/src/app/state.rs
@@ -1461,8 +1461,24 @@ impl AppState {
let api_c = api.clone();
let tx_c = tx.clone();
rt.spawn(async move {
+ let mut merged = Vec::new();
+ let mut seen = HashSet::new();
if let Ok(pls) = api_c.fetch_user_playlists(uid).await {
- let _ = tx_c.send(ApiEvent::UserPlaylistsLoaded(pls));
+ for pl in pls {
+ if seen.insert((pl.owner_uid.clone(), pl.kind.clone())) {
+ merged.push(pl);
+ }
+ }
+ }
+ if let Ok(liked_pls) = api_c.fetch_liked_playlists(uid).await {
+ for pl in liked_pls {
+ if seen.insert((pl.owner_uid.clone(), pl.kind.clone())) {
+ merged.push(pl);
+ }
+ }
+ }
+ if !merged.is_empty() {
+ let _ = tx_c.send(ApiEvent::UserPlaylistsLoaded(merged));
}
});
}
@@ -1779,7 +1795,10 @@ impl AppState {
match ev {
ApiEvent::AccountLoaded(Ok(acc)) => {
self.show_toast(t.toast_welcome(&acc.display_name));
+ let uid = acc.uid;
self.account = Some(acc);
+ normalize_pins(&mut self.config.pinned_items, Some(uid), t.is_ru());
+ self.save_config();
self.ensure_words_for_current_track();
if self.concerts.is_empty() && !self.concerts_loading {
self.refresh_concerts();
@@ -1901,20 +1920,8 @@ impl AppState {
self.bookshelf_items = items;
}
ApiEvent::PinsLoaded(mut pins) => {
- let mut seen_likes = false;
- pins.retain(|p| {
- let is_likes = p.kind == "likes"
- || p.id == "likes"
- || p.title == "Мне нравится"
- || p.title == "My Favorites";
- if is_likes {
- if seen_likes {
- return false;
- }
- seen_likes = true;
- }
- true
- });
+ let my_uid = self.account.as_ref().map(|a| a.uid);
+ normalize_pins(&mut pins, my_uid, t.is_ru());
self.config.pinned_items = pins;
self.save_config();
}
@@ -3039,6 +3046,26 @@ pub fn is_newer_version(remote: &str, current: &str) -> bool {
}
}
+/// Normalize pinned items so only the signed-in user's own `kind == "3"` (`{my_uid}:3`)
+/// collapses into system `kind: "likes", id: "likes"`, while friends' `"Мне нравится"` playlists
+/// (`{friend_uid}:3`) are ALWAYS preserved as distinct `"playlist"` pins!
+fn normalize_pins(pins: &mut Vec, my_uid: Option, ru: bool) {
+ if let Some(uid) = my_uid {
+ let my_likes_id = format!("{}:3", uid);
+ let likes_title = if ru { "Мне нравится" } else { "My Favorites" };
+ for p in pins.iter_mut() {
+ if p.kind == "playlist" && p.id == my_likes_id {
+ p.id = "likes".into();
+ p.kind = "likes".into();
+ p.cover_uri = None;
+ p.title = likes_title.into();
+ }
+ }
+ }
+ let mut seen: HashSet<(String, String)> = HashSet::new();
+ pins.retain(|p| seen.insert((p.kind.clone(), p.id.clone())));
+}
+
#[cfg(test)]
mod tests {
use super::*;
@@ -3054,4 +3081,41 @@ mod tests {
assert!(!is_newer_version("v0.0.9", "0.1.0"));
assert!(!is_newer_version("", "0.1.0"));
}
+
+ #[test]
+ fn test_normalize_pins_keeps_friends_favorites_playlist() {
+ let mut pins = vec![
+ PinnedItem {
+ id: "likes".into(),
+ kind: "likes".into(),
+ title: "Мне нравится".into(),
+ subtitle: "Плейлист".into(),
+ cover_uri: None,
+ owner_uid: Some("1001".into()),
+ },
+ PinnedItem {
+ id: "1001:3".into(),
+ kind: "playlist".into(),
+ title: "Мне нравится".into(),
+ subtitle: "Плейлист".into(),
+ cover_uri: None,
+ owner_uid: Some("1001".into()),
+ },
+ PinnedItem {
+ id: "2002:3".into(),
+ kind: "playlist".into(),
+ title: "Мне нравится".into(),
+ subtitle: "Плейлист".into(),
+ cover_uri: None,
+ owner_uid: Some("2002".into()),
+ },
+ ];
+ normalize_pins(&mut pins, Some(1001), true);
+ assert_eq!(pins.len(), 2, "Own likes + friend's kind=3 likes must BOTH remain");
+ assert_eq!(pins[0].kind, "likes");
+ assert_eq!(pins[0].id, "likes");
+ assert_eq!(pins[1].kind, "playlist");
+ assert_eq!(pins[1].id, "2002:3");
+ assert_eq!(pins[1].owner_uid.as_deref(), Some("2002"));
+ }
}
diff --git a/src/covers.rs b/src/covers.rs
index 4407d93..06a9534 100644
--- a/src/covers.rs
+++ b/src/covers.rs
@@ -16,6 +16,8 @@ pub struct CoverEntry {
pub texture_id: TextureId,
pub dominant_color: Color,
pub hue: f32,
+ pub width: u32,
+ pub height: u32,
pub last_used_frame: u64,
}
@@ -148,6 +150,8 @@ impl CoverCache {
texture_id: tex_id,
dominant_color: dom,
hue,
+ width: width as u32,
+ height: height as u32,
last_used_frame: frame_id,
},
);
@@ -175,6 +179,8 @@ impl CoverCache {
texture_id: tex_id,
dominant_color: dom,
hue,
+ width: width as u32,
+ height: height as u32,
last_used_frame: frame_id,
},
);
@@ -208,6 +214,8 @@ impl CoverCache {
texture_id: tex_id,
dominant_color: done.dominant_color,
hue: done.hue,
+ width: done.width,
+ height: done.height,
last_used_frame: frame_id,
},
);
@@ -246,6 +254,17 @@ impl CoverCache {
/// Reuses an already-cached higher-resolution entry (`200x200` / `400x400`) when available
/// because our Vulkan SDF renderer samples full hardware mipmap chains cleanly at any size!
pub fn get_or_fetch(&mut self, uri: &str, size_px: u32) -> Option<(TextureId, Color, f32)> {
+ self.get_or_fetch_with_size(uri, size_px)
+ .map(|(tex, dom, hue, _, _)| (tex, dom, hue))
+ }
+
+ /// Returns `(TextureId, dominant_color, hue, width, height)` if loaded, or triggers background fetch.
+ /// Exposes decoded pixel dimensions so `draw_cover_art` can apply exact `object-fit: cover` UV cropping.
+ pub fn get_or_fetch_with_size(
+ &mut self,
+ uri: &str,
+ size_px: u32,
+ ) -> Option<(TextureId, Color, f32, u32, u32)> {
if uri.is_empty() {
return None;
}
@@ -253,7 +272,13 @@ impl CoverCache {
let url = Self::format_url(uri, size_px);
if let Some(entry) = self.cache.get_mut(&url) {
entry.last_used_frame = frame_id;
- return Some((entry.texture_id, entry.dominant_color, entry.hue));
+ return Some((
+ entry.texture_id,
+ entry.dominant_color,
+ entry.hue,
+ entry.width,
+ entry.height,
+ ));
}
// Cross-resolution mipmap reuse: if a higher-resolution variant is already cached,
@@ -272,7 +297,13 @@ impl CoverCache {
}
if let Some(entry) = self.cache.get_mut(&hi_url) {
entry.last_used_frame = frame_id;
- return Some((entry.texture_id, entry.dominant_color, entry.hue));
+ return Some((
+ entry.texture_id,
+ entry.dominant_color,
+ entry.hue,
+ entry.width,
+ entry.height,
+ ));
}
if self.in_flight.contains(&hi_url) {
return None;
@@ -335,7 +366,9 @@ fn decode_and_analyze(bytes: &[u8], target_px: u32) -> Option<(u32, u32, Vec
let (ow, oh) = (dyn_img.width(), dyn_img.height());
let max_dim = target_px.max(128);
if ow > max_dim || oh > max_dim {
- dyn_img = dyn_img.resize_exact(max_dim, max_dim, image::imageops::FilterType::Lanczos3);
+ // Preserve original aspect ratio so non-square concert posters / banners never stretch;
+ // `draw_cover_art` applies CSS `object-fit: cover` UV cropping using `(width, height)`.
+ dyn_img = dyn_img.resize(max_dim, max_dim, image::imageops::FilterType::Lanczos3);
}
let rgba = dyn_img.to_rgba8();
let (w, h) = rgba.dimensions();
diff --git a/src/engine/mod.rs b/src/engine/mod.rs
index 2a284a4..3a071ba 100644
--- a/src/engine/mod.rs
+++ b/src/engine/mod.rs
@@ -368,6 +368,28 @@ impl UiContext {
.draw_text_wrapped(dl, &mut self.textures, text, style, rect, max_lines, align)
}
+ /// Draw wrapped multi-line text vertically centered inside `rect` and uniformly scaled
+ /// around `rect.center()` by `scale` (CSS `transform: scale(...)` without wrap-jump).
+ pub fn draw_text_wrapped_scaled(
+ &mut self,
+ text: &str,
+ style: TextStyle,
+ rect: Rect,
+ scale: f32,
+ align: TextAlign,
+ ) -> Vec2 {
+ let dl = &mut self.layers[self.current_layer.index()];
+ self.text.draw_text_wrapped_scaled(
+ dl,
+ &mut self.textures,
+ text,
+ style,
+ rect,
+ scale,
+ align,
+ )
+ }
+
pub fn draw_rich_text(
&mut self,
spans: &[RichSpan<'_>],
diff --git a/src/engine/scroll.rs b/src/engine/scroll.rs
index 9755e10..c8f5c22 100644
--- a/src/engine/scroll.rs
+++ b/src/engine/scroll.rs
@@ -135,7 +135,7 @@ impl ScrollState {
if horizontal {
let dx = if input.wheel_delta.x.abs() > 0.01 {
-input.wheel_delta.x
- } else if !vertical || input.modifiers.shift {
+ } else if input.modifiers.shift {
-input.wheel_delta.y
} else {
0.0
diff --git a/src/engine/text.rs b/src/engine/text.rs
index 3c578c2..22053a0 100644
--- a/src/engine/text.rs
+++ b/src/engine/text.rs
@@ -452,6 +452,68 @@ impl TextEngine {
size
}
+ /// Draw wrapped multi-line text vertically centered inside `rect` and uniformly scaled
+ /// around `rect.center()` by `scale` (1-to-1 CSS `transform: scale(...)` with zero wrap-jump
+ /// or fractional-size glyph atlas churn).
+ #[allow(clippy::too_many_arguments)]
+ pub fn draw_text_wrapped_scaled(
+ &mut self,
+ dl: &mut DisplayList,
+ textures: &mut TextureRegistry,
+ text: &str,
+ style: TextStyle,
+ rect: Rect,
+ scale: f32,
+ align: TextAlign,
+ ) -> Vec2 {
+ if text.is_empty() || style.color.a == 0 || rect.w <= 1.0 || scale <= 0.001 {
+ return Vec2::ZERO;
+ }
+ let (key, size) = self.get_or_shape(text, style, Some(rect.w), None, false, align);
+ let origin = Pos2::new(rect.x, rect.center_y() - size.y * 0.5);
+ if (scale - 1.0).abs() < 0.0005 {
+ self.emit_cached_buffer(dl, textures, key, origin, style.color, None);
+ return size;
+ }
+ let Some((buffer, _)) = self.shape_cache.get(&key) else {
+ return size;
+ };
+
+ let dpi = self.scale_factor;
+ let inv_dpi = 1.0 / dpi;
+ let origin_px = (origin.x * dpi).round();
+ let center = rect.center();
+
+ let mut glyphs_to_draw = Vec::with_capacity(64);
+ for run in buffer.layout_runs() {
+ let baseline_py = ((origin.y + run.line_y) * dpi).floor();
+ for glyph in run.glyphs.iter() {
+ let phys = glyph.physical((0.0, 0.0), dpi);
+ glyphs_to_draw.push((phys, baseline_py));
+ }
+ }
+ for (phys, baseline_py) in glyphs_to_draw {
+ if let Some(entry) = self.atlas.get_or_insert(
+ phys.cache_key,
+ &mut self.font_system,
+ &mut self.swash_cache,
+ textures,
+ ) {
+ let gx = (origin_px + (phys.x + entry.left) as f32) * inv_dpi;
+ let gy = (baseline_py + (phys.y - entry.top) as f32) * inv_dpi;
+ let gw = entry.width as f32 * inv_dpi;
+ let gh = entry.height as f32 * inv_dpi;
+
+ let sx = center.x + (gx - center.x) * scale;
+ let sy = center.y + (gy - center.y) * scale;
+ let sw = gw * scale;
+ let sh = gh * scale;
+ dl.push_glyph(Rect::from_xywh(sx, sy, sw, sh), entry.uv, style.color);
+ }
+ }
+ size
+ }
+
/// Draw multi-span rich text (e.g. clickable `SeparatedArtists` or `Title + Version`) inside `rect`.
/// Returns screen-space bounding `Rect`s for every span whose `metadata != 0` so callers can
/// perform exact per-span hover & click hit-testing!
diff --git a/src/engine/widgets.rs b/src/engine/widgets.rs
index b440305..e07daed 100644
--- a/src/engine/widgets.rs
+++ b/src/engine/widgets.rs
@@ -374,7 +374,32 @@ pub fn draw_plus_badge(
(resp, rect)
}
-/// Draw cover artwork with SDF rounded-rect / circular clip:
+/// Compute exact CSS `object-fit: cover` UV sub-rect so images never stretch when
+/// `(tex_w / tex_h)` differs from `dst.w / dst.h`.
+/// Uses `focal_y` (e.g. `0.35`) when cropping vertically so portrait faces/heads stay framed,
+/// and `0.5` when cropping horizontally.
+#[inline]
+pub fn cover_fit_uv(tex_w: u32, tex_h: u32, dst: Rect, focal_y: f32) -> Rect {
+ if tex_w == 0 || tex_h == 0 || dst.w <= 0.0 || dst.h <= 0.0 {
+ return Rect::UNIT_UV;
+ }
+ let tex_ar = tex_w as f32 / tex_h as f32;
+ let dst_ar = dst.w / dst.h;
+ if (tex_ar - dst_ar).abs() < 0.015 {
+ return Rect::UNIT_UV;
+ }
+ if tex_ar > dst_ar {
+ let uw = (dst_ar / tex_ar).clamp(0.01, 1.0);
+ let u = (1.0 - uw) * 0.5;
+ Rect::from_xywh(u, 0.0, uw, 1.0)
+ } else {
+ let vh = (tex_ar / dst_ar).clamp(0.01, 1.0);
+ let v = (1.0 - vh) * focal_y.clamp(0.0, 1.0);
+ Rect::from_xywh(0.0, v, 1.0, vh)
+ }
+}
+
+/// Draw cover artwork with SDF rounded-rect / circular clip and CSS `object-fit: cover` UV crop:
/// - When `special_likes == true`: exact crimson vignette `#8D0F10 -> #59090A` + centered official `heart.png`
/// with SDF rounded-rect clip (ZERO `+9.5%` y-shift bug!). If a real CDN cover URI is loaded, uses it.
/// - Otherwise: renders real fetched cover texture with SDF rounded/circle clip, or theme-aware neutral placeholder.
@@ -399,9 +424,10 @@ pub fn draw_cover_art(
if special_likes {
// Prefer real CDN cover if provided & already loaded
if let Some(u) = uri {
- let px = rect.width().ceil() as u32;
- if let Some((tex_id, dom, hue)) = covers.get_or_fetch(u, px) {
- ctx.dl().push_image(rect, tex_id, cr, Color::WHITE);
+ let px = rect.width().max(rect.height()).ceil() as u32;
+ if let Some((tex_id, dom, hue, tw, th)) = covers.get_or_fetch_with_size(u, px) {
+ let uv = cover_fit_uv(tw, th, rect, 0.35);
+ ctx.dl().push_image_uv(rect, tex_id, uv, cr, Color::WHITE);
return (dom, hue);
}
}
@@ -428,9 +454,10 @@ pub fn draw_cover_art(
}
if let Some(u) = uri {
- let px = rect.width().ceil() as u32;
- if let Some((tex_id, dom, hue)) = covers.get_or_fetch(u, px) {
- ctx.dl().push_image(rect, tex_id, cr, Color::WHITE);
+ let px = rect.width().max(rect.height()).ceil() as u32;
+ if let Some((tex_id, dom, hue, tw, th)) = covers.get_or_fetch_with_size(u, px) {
+ let uv = cover_fit_uv(tw, th, rect, 0.35);
+ ctx.dl().push_image_uv(rect, tex_id, uv, cr, Color::WHITE);
return (dom, hue);
}
}
@@ -1101,8 +1128,9 @@ pub fn stacked_mix_card(
let card_r = Rect::from_xywh(plate_x, plate_y + 8.0, plate_w, plate_w);
let mut drew_tex = false;
if let Some(u) = cover_uri {
- if let Some((tex_id, _, _)) = covers.get_or_fetch(u, 200) {
- ctx.dl().push_image(card_r, tex_id, 6.0, Color::WHITE);
+ if let Some((tex_id, _, _, tw, th)) = covers.get_or_fetch_with_size(u, 200) {
+ let uv = cover_fit_uv(tw, th, card_r, 0.35);
+ ctx.dl().push_image_uv(card_r, tex_id, uv, 6.0, Color::WHITE);
drew_tex = true;
}
}
@@ -1181,8 +1209,9 @@ pub fn artist_promo_card(
// 1. Full-bleed artist photo (or theme-aware gradient placeholder)
let mut has_photo = false;
if let Some(u) = artist_photo_uri {
- if let Some((tex_id, _, _)) = covers.get_or_fetch(u, 400) {
- ctx.dl().push_image(img_r, tex_id, 8.0, Color::WHITE);
+ if let Some((tex_id, _, _, tw, th)) = covers.get_or_fetch_with_size(u, 400) {
+ let uv = cover_fit_uv(tw, th, img_r, 0.35);
+ ctx.dl().push_image_uv(img_r, tex_id, uv, 8.0, Color::WHITE);
has_photo = true;
}
}
diff --git a/src/views/collection.rs b/src/views/collection.rs
index d7653e9..c81e35b 100644
--- a/src/views/collection.rs
+++ b/src/views/collection.rs
@@ -352,7 +352,7 @@ pub fn render_collection(
cx += card_w + gap;
}
- for pl in playlists.iter().take(24) {
+ for (idx, pl) in playlists.iter().take(60).enumerate() {
let cr = Rect::from_xywh(cx, y, card_w, card_h);
if cr.right() >= row_vp.left() - 24.0 && cr.left() <= row_vp.right() + 24.0 {
let sub = t.count_tracks(pl.track_count as usize);
@@ -363,14 +363,17 @@ pub fn render_collection(
ctx,
pal,
covers,
- WidgetId::from_pair("col_ov_pl", format!("{}_{}", pl.owner_uid, pl.kind)),
+ WidgetId::from_pair(
+ "col_ov_pl",
+ (idx, format!("{}_{}", pl.owner_uid, pl.kind)),
+ ),
cr,
&pl.title,
&sub,
pl.cover_uri.as_deref(),
&format!("upl_{}_{}", pl.owner_uid, pl.kind),
false,
- false,
+ pl.kind == "3" && pl.cover_uri.is_none(),
);
if let Some(pos) = m.right_clicked_pos {
shell.open_entity_menu(EntityContextMenuState {
@@ -407,7 +410,7 @@ pub fn render_collection(
ctx.end_scroll_h(
h_id,
pal,
- (playlists.len().min(24) + 1) as f32 * (card_w + gap),
+ (playlists.len().min(60) + 1) as f32 * (card_w + gap),
false,
);
y += card_h + 26.0;
@@ -454,9 +457,10 @@ pub fn render_collection(
let sx = ctx.begin_scroll_h(h_id, row_vp, 0.0);
let mut cx = x - sx;
- for alb in albums.iter().take(24) {
+ for (idx, alb) in albums.iter().take(60).enumerate() {
let cr = Rect::from_xywh(cx, y, card_w, card_h);
if cr.right() >= row_vp.left() - 24.0 && cr.left() <= row_vp.right() + 24.0 {
+ let alb_title = alb.full_title();
let sub = alb
.artists
.first()
@@ -466,9 +470,9 @@ pub fn render_collection(
ctx,
pal,
covers,
- WidgetId::from_pair("col_ov_alb", &alb.id),
+ WidgetId::from_pair("col_ov_alb", (idx, &alb.id)),
cr,
- &alb.title,
+ &alb_title,
sub,
alb.cover_uri.as_deref(),
&format!("alb_{}", alb.id),
@@ -479,7 +483,7 @@ pub fn render_collection(
shell.open_entity_menu(EntityContextMenuState {
kind: "album".into(),
id: alb.id.clone(),
- title: alb.title.clone(),
+ title: alb_title.clone(),
subtitle: t.album().into(),
cover_uri: alb.cover_uri.clone(),
owner_uid: None,
@@ -491,12 +495,12 @@ pub fn render_collection(
} else if m.play_clicked {
actions.push(AppAction::PlayAlbum {
id: alb.id.clone(),
- title: alb.title.clone(),
+ title: alb_title,
});
} else if m.clicked {
actions.push(AppAction::Navigate(Route::Album {
id: alb.id.clone(),
- title: alb.title.clone(),
+ title: alb_title,
}));
}
}
@@ -505,7 +509,7 @@ pub fn render_collection(
ctx.end_scroll_h(
h_id,
pal,
- albums.len().min(24) as f32 * (card_w + gap),
+ albums.len().min(60) as f32 * (card_w + gap),
false,
);
y += card_h + 26.0;
@@ -793,7 +797,7 @@ pub fn render_collection(
continue;
}
let sub = t.count_tracks(pl.track_count as usize);
- let wid = WidgetId::from_pair("col_pl", format!("{}_{}", pl.owner_uid, pl.kind));
+ let wid = WidgetId::from_pair("col_pl", (i, format!("{}_{}", pl.owner_uid, pl.kind)));
let m = media_card(
ctx,
pal,
@@ -805,7 +809,7 @@ pub fn render_collection(
pl.cover_uri.as_deref(),
&format!("upl_{}_{}", pl.owner_uid, pl.kind),
false,
- false,
+ pl.kind == "3" && pl.cover_uri.is_none(),
);
// Own playlists (not Liked kind=3) get quick Rename & Delete action icons on hover!
@@ -928,6 +932,7 @@ pub fn render_collection(
card_h,
);
if cr.bottom() >= rect.top() - 40.0 && cr.top() <= rect.bottom() + 40.0 {
+ let alb_title = alb.full_title();
let sub = alb
.artists
.first()
@@ -937,9 +942,9 @@ pub fn render_collection(
ctx,
pal,
covers,
- WidgetId::from_pair("col_alb", &alb.id),
+ WidgetId::from_pair("col_alb", (idx, &alb.id)),
cr,
- &alb.title,
+ &alb_title,
sub,
alb.cover_uri.as_deref(),
&format!("alb_{}", alb.id),
@@ -950,7 +955,7 @@ pub fn render_collection(
shell.open_entity_menu(EntityContextMenuState {
kind: "album".into(),
id: alb.id.clone(),
- title: alb.title.clone(),
+ title: alb_title.clone(),
subtitle: t.album().into(),
cover_uri: alb.cover_uri.clone(),
owner_uid: None,
@@ -962,12 +967,12 @@ pub fn render_collection(
} else if m.play_clicked {
actions.push(AppAction::PlayAlbum {
id: alb.id.clone(),
- title: alb.title.clone(),
+ title: alb_title,
});
} else if m.clicked {
actions.push(AppAction::Navigate(Route::Album {
id: alb.id.clone(),
- title: alb.title.clone(),
+ title: alb_title,
}));
}
}
diff --git a/src/views/detail.rs b/src/views/detail.rs
index 6deb089..260a7a0 100644
--- a/src/views/detail.rs
+++ b/src/views/detail.rs
@@ -144,6 +144,7 @@ pub fn render_detail(
};
let p_id = format!("{}:{}", owner_uid, kind);
let p_seed = format!("pl_{}_{}", owner_uid, kind);
+ let is_likes_art = kind == "3" && pl_cov.is_none();
(
EntityKind::Playlist {
owner_uid: owner_uid.clone(),
@@ -156,7 +157,7 @@ pub fn render_detail(
pl_cov,
p_seed,
false,
- false,
+ is_likes_art,
"playlist",
p_id,
Some(owner_uid),
@@ -902,9 +903,10 @@ pub fn render_detail(
let h_id = WidgetId::new("artist_albums_hscroll");
let sx = ctx.begin_scroll_h(h_id, vp, 0.0);
let mut cx = x - sx;
- for alb in art_detail.albums.iter().take(16) {
+ for (idx, alb) in art_detail.albums.iter().take(48).enumerate() {
let cr = Rect::from_xywh(cx, y, card_w, card_h);
if cr.right() >= vp.left() - 80.0 && cr.left() <= vp.right() + 80.0 {
+ let alb_title = alb.full_title();
let yr = alb
.year
.map(|yr| yr.to_string())
@@ -913,9 +915,9 @@ pub fn render_detail(
ctx,
pal,
covers,
- WidgetId::from_pair("art_alb", &alb.id),
+ WidgetId::from_pair("art_alb", (idx, &alb.id)),
cr,
- &alb.title,
+ &alb_title,
&yr,
alb.cover_uri.as_deref(),
&format!("artalb_{}", alb.id),
@@ -925,12 +927,12 @@ pub fn render_detail(
if m.play_clicked {
actions.push(AppAction::PlayAlbum {
id: alb.id.clone(),
- title: alb.title.clone(),
+ title: alb_title,
});
} else if m.clicked {
actions.push(AppAction::Navigate(Route::Album {
id: alb.id.clone(),
- title: alb.title.clone(),
+ title: alb_title,
}));
}
}
@@ -939,7 +941,7 @@ pub fn render_detail(
ctx.end_scroll_h(
h_id,
pal,
- art_detail.albums.len().min(16) as f32 * (card_w + 16.0),
+ art_detail.albums.len().min(48) as f32 * (card_w + 16.0),
false,
);
}
diff --git a/src/views/for_you.rs b/src/views/for_you.rs
index ec0c6c4..5890b7d 100644
--- a/src/views/for_you.rs
+++ b/src/views/for_you.rs
@@ -465,7 +465,7 @@ pub fn render_for_you(
let playlists = app.landing.personal_playlists.clone();
let mut cx = x - scroll_x;
- for pl in &playlists {
+ for (idx, pl) in playlists.iter().enumerate() {
let cr = Rect::from_xywh(cx, y, card_w, card_h);
if cr.right() >= row_vp.left() - 20.0 && cr.left() <= row_vp.right() + 20.0 {
let sub = pl.description.as_deref().unwrap_or(t.playlist());
@@ -473,7 +473,10 @@ pub fn render_for_you(
ctx,
pal,
covers,
- WidgetId::from_pair("fy_pl", format!("{}_{}", pl.owner_uid, pl.kind)),
+ WidgetId::from_pair(
+ "fy_pl",
+ (idx, format!("{}_{}", pl.owner_uid, pl.kind)),
+ ),
cr,
&pl.title,
sub,
@@ -652,14 +655,17 @@ pub fn render_for_you(
let playlists = app.landing.popular_playlists.clone();
let mut cx = x - scroll_x;
- for pl in &playlists {
+ for (idx, pl) in playlists.iter().enumerate() {
let cr = Rect::from_xywh(cx, y, card_w, card_h);
if cr.right() >= row_vp.left() - 20.0 && cr.left() <= row_vp.right() + 20.0 {
let m = media_card(
ctx,
pal,
covers,
- WidgetId::from_pair("tr_pl", format!("{}_{}", pl.owner_uid, pl.kind)),
+ WidgetId::from_pair(
+ "tr_pl",
+ (idx, format!("{}_{}", pl.owner_uid, pl.kind)),
+ ),
cr,
&pl.title,
&pl.owner_name,
@@ -954,8 +960,9 @@ fn render_new_releases_carousel(
if row_vp.bottom() >= viewport.top() - 120.0 && row_vp.top() <= viewport.bottom() + 120.0 {
let scroll_x = ctx.begin_scroll_h(h_id, row_vp, 0.0);
let mut cx = x - scroll_x;
- for item in &items {
+ for (idx, item) in items.iter().enumerate() {
let alb = &item.album;
+ let alb_title = alb.full_title();
let outer_r = Rect::from_xywh(cx, y, card_w, card_h);
if outer_r.right() >= row_vp.left() - 80.0 && outer_r.left() <= row_vp.right() + 80.0 {
// 1. Huge 236x236 circular artist portrait overlapping the bottom card by 56px
@@ -1012,7 +1019,7 @@ fn render_new_releases_carousel(
.artists
.first()
.map(|a| a.name.as_str())
- .unwrap_or(alb.title.as_str());
+ .unwrap_or(alb_title.as_str());
let art_lbl_r = Rect::from_xywh(
circle_r.left() + 18.0,
y + portrait_d - overlap - 54.0,
@@ -1028,14 +1035,14 @@ fn render_new_releases_carousel(
);
let port_click_r = Rect::from_xywh(circle_r.left(), circle_r.top(), portrait_d, portrait_d - overlap);
- let port_resp = ctx.interact(WidgetId::from_pair(salt, format!("port_{}", alb.id)), port_click_r);
+ let port_resp = ctx.interact(WidgetId::from_pair(salt, (idx, format!("port_{}", alb.id))), port_click_r);
if port_resp.hovered {
ctx.set_cursor(CursorKind::Pointer);
}
// 2. Bottom 80px colored rounded release card (`radius: 14px`)
let card_r = Rect::from_xywh(cx, y + portrait_d - overlap, card_w, bottom_h);
- let card_resp = ctx.interact(WidgetId::from_pair(salt, format!("card_{}", alb.id)), card_r);
+ let card_resp = ctx.interact(WidgetId::from_pair(salt, (idx, format!("card_{}", alb.id))), card_r);
let card_bg = if card_resp.hovered {
card_tint.lerp(Color::WHITE, 0.08)
} else {
@@ -1074,7 +1081,7 @@ fn render_new_releases_carousel(
// Right 38x38 crisp white circular Play/Pause button
let play_c = Pos2::new(card_r.right() - 28.0, card_r.center_y());
let play_r = Rect::from_center_size(play_c, Vec2::splat(38.0));
- let play_resp = ctx.interact(WidgetId::from_pair(salt, format!("play_{}", alb.id)), play_r);
+ let play_resp = ctx.interact(WidgetId::from_pair(salt, (idx, format!("play_{}", alb.id))), play_r);
let play_rad = if play_resp.hovered { 20.0 } else { 19.0 };
ctx.dl().push_circle(play_c, play_rad, Color::WHITE);
let alb_playing = app.is_context_playing(&format!("album:{}", alb.id));
@@ -1092,7 +1099,7 @@ fn render_new_releases_carousel(
let tx_l = cov_r.right() + 12.0;
let tx_w = (play_r.left() - tx_l - 8.0).max(40.0);
ctx.draw_text_ellipsis(
- &alb.title,
+ &alb_title,
TextStyle::bold(14.5, Color::WHITE),
Rect::from_xywh(tx_l, card_r.top() + 18.0, tx_w, 20.0),
TextAlign::Left,
diff --git a/src/views/overlays.rs b/src/views/overlays.rs
index eea7cde..1cd5781 100644
--- a/src/views/overlays.rs
+++ b/src/views/overlays.rs
@@ -80,6 +80,8 @@ pub struct ShellUiState {
pub queue_drag: Option,
pub fs_lyrics_scroll_y: f32,
pub fs_lyrics_manual_until: f64,
+ pub fs_lyrics_upper_until: f64,
+ pub fs_lyrics_last_mouse: Option,
pub fs_lyrics_track_id: String,
}
@@ -640,37 +642,9 @@ pub fn render_fullscreen_player(
ctx.register_blocker(screen);
ctx.dl().push_rect(screen, 0.0, bg_color);
- // Top-right circular `v` collapse button (`FullscreenPlayerDesktop_closeButton`)
- let close_r = Rect::from_center_size(
- Pos2::new(screen.right() - 44.0, screen.top() + 56.0),
- Vec2::splat(40.0),
- );
- let close_resp = ctx.interact(WidgetId::new("fs_close"), close_r);
- ctx.dl().push_circle(
- close_r.center(),
- if close_resp.hovered { 21.0 } else { 20.0 },
- if close_resp.hovered {
- css_rgba(255, 255, 255, 36)
- } else {
- css_rgba(255, 255, 255, 22)
- },
- );
- ctx.draw_icon(
- Icon::ArrowDown,
- Rect::from_center_size(close_r.center(), Vec2::splat(24.0)),
- Color::WHITE,
- );
- if close_resp.hovered {
- ctx.set_cursor(CursorKind::Pointer);
- ctx.show_tooltip(close_r, i18n.close());
- }
- if close_resp.clicked {
- actions.push(AppAction::SetFullscreen(false));
- }
-
- let Some(tr) = track else {
- return;
- };
+ // Render track player + 50/50 split BEFORE top-right `v` collapse button so
+ // SyncLyrics top gradient fade mask never slices over `FullscreenPlayerDesktop_closeButton`!
+ if let Some(tr) = track {
// Mutually exclusive right split modes (SyncLyrics OR PlayQueue) WITHOUT closing fullscreen!
let is_split = app.fullscreen_lyrics_open || app.fullscreen_queue_open;
@@ -692,7 +666,8 @@ pub fn render_fullscreen_player(
let cx_center = screen.center_x();
let cx_left = screen.left() + screen.width() * 0.25;
let cx = cx_center + (cx_left - cx_center) * split_t;
- let cov_cy = screen.center_y() - 36.0;
+ // Center the entire (poster + 110px info) block symmetrically around `screen.center_y()`
+ let cov_cy = screen.center_y() - 55.0;
let cov_r = Rect::from_center_size(Pos2::new(cx, cov_cy), Vec2::splat(cov_sz));
// Soft cover elevation shadow
@@ -956,7 +931,7 @@ pub fn render_fullscreen_player(
}
// Below Cover: Clickable Track Title + Explicit + Individually Clickable Artists
- let title_y = cov_r.bottom() + 20.0;
+ let title_y = cov_r.bottom() + 24.0;
let meta_w = cov_sz.max(320.0);
let full_title = tr.full_title();
let measured_tw = ctx
@@ -1003,7 +978,7 @@ pub fn render_fullscreen_player(
}
// Individually clickable artists below title (`SeparatedArtists`)!
- let art_r = Rect::from_center_size(Pos2::new(cx, title_y + 34.0), Vec2::new(meta_w, 22.0));
+ let art_r = Rect::from_xywh(cx - meta_w * 0.5, title_y + 26.0, meta_w, 22.0);
if let Some((aid, aname)) = separated_artists(
ctx,
pal,
@@ -1020,7 +995,7 @@ pub fn render_fullscreen_player(
}
// Progress bar (`ChangeTimecode`: 4px `#E6E6E6` fill/thumb + hover timecodes + smooth drag seek)
- let bar_y = title_y + 64.0;
+ let bar_y = cov_r.bottom() + 86.0;
let bar_hit = Rect::from_center_size(Pos2::new(cx, bar_y), Vec2::new(cov_sz, 22.0));
let bar_resp = ctx.interact(WidgetId::new("fs_progress"), bar_hit);
let bar_r = Rect::from_center_size(Pos2::new(cx, bar_y), Vec2::new(cov_sz, 4.0));
@@ -1090,13 +1065,24 @@ pub fn render_fullscreen_player(
ctx.dl().push_circle(Pos2::new(fill_x, bar_y), 6.0, fill_col);
}
- // Right-Half 50/50 Animated Pane: SyncLyrics OR PlayQueue!
+ // Right-Half 50/50 Animated Pane (`FullscreenPlayerDesktopContent_additionalContent`): SyncLyrics OR PlayQueue!
if split_t > 0.02 {
- let right_rect = Rect::from_min_max(
- Pos2::new(screen.left() + screen.width() * 0.48, screen.top() + 56.0),
- Pos2::new(screen.right() - 48.0, screen.bottom() - 40.0),
- );
+ let indent = if screen.width() > 1060.0 {
+ 44.0
+ } else if screen.width() > 960.0 {
+ 20.0
+ } else {
+ 10.0
+ };
+ let right_left = screen.left() + screen.width() * 0.50 - indent;
+ let right_right = (right_left + screen.width() * 0.50).min(screen.right());
+ let right_bottom = screen.bottom() - (screen.height() * 0.09).max(56.0);
+
if app.fullscreen_queue_open {
+ let right_rect = Rect::from_min_max(
+ Pos2::new(right_left, screen.top() + 56.0),
+ Pos2::new((right_right - 48.0).max(right_left + 120.0), right_bottom),
+ );
ctx.draw_text_ellipsis(
i18n.queue(),
TextStyle::headline(22.0, Color::WHITE.with_alpha_f32(split_t)),
@@ -1119,12 +1105,17 @@ pub fn render_fullscreen_player(
actions,
);
} else {
+ let lyr_rect = Rect::from_min_max(
+ Pos2::new(right_left, screen.top() + 32.0),
+ Pos2::new(right_right, right_bottom),
+ );
render_fullscreen_sync_lyrics(
ctx,
app.current_lyrics.as_ref(),
tr,
position_ms,
- right_rect,
+ is_playing,
+ lyr_rect,
bg_color,
split_t,
ru,
@@ -1133,13 +1124,41 @@ pub fn render_fullscreen_player(
);
}
}
- // Bottom-right Volume / Mute button with upward 44×216 `ym_volume_capsule` hover popover!
- // Smoothly shifts into the left player column when `split_t > 0` so neither the button nor
- // its upward popover ever collides with `right_rect` (SyncLyrics / Queue split pane).
- let vol_x_centered = screen.right() - 44.0;
- let vol_x_split = (screen.left() + screen.width() * 0.48 - 34.0).max(screen.left() + 44.0);
- let vol_x = vol_x_centered + (vol_x_split - vol_x_centered) * split_t;
- let vol_center = Pos2::new(vol_x, screen.bottom() - 44.0);
+ } // end `if let Some(tr) = track`
+
+ // Top-right circular `v` collapse button (`FullscreenPlayerDesktop_closeButton`, z-index: header)
+ let close_r = Rect::from_center_size(
+ Pos2::new(screen.right() - 44.0, screen.top() + 56.0),
+ Vec2::splat(40.0),
+ );
+ let close_resp = ctx.interact(WidgetId::new("fs_close"), close_r);
+ ctx.dl().push_circle(
+ close_r.center(),
+ if close_resp.hovered { 21.0 } else { 20.0 },
+ if close_resp.hovered {
+ css_rgba(255, 255, 255, 36)
+ } else {
+ css_rgba(255, 255, 255, 22)
+ },
+ );
+ ctx.draw_icon(
+ Icon::ArrowDown,
+ Rect::from_center_size(close_r.center(), Vec2::splat(24.0)),
+ Color::WHITE,
+ );
+ if close_resp.hovered {
+ ctx.set_cursor(CursorKind::Pointer);
+ ctx.show_tooltip(close_r, i18n.close());
+ }
+ if close_resp.clicked {
+ actions.push(AppAction::SetFullscreen(false));
+ }
+
+ if track.is_none() {
+ return;
+ }
+ // Bottom-right Volume / Mute button anchored cleanly at bottom-right aligned with top-right `v`!
+ let vol_center = Pos2::new(screen.right() - 44.0, screen.bottom() - 40.0);
let vol_btn_r = Rect::from_center_size(vol_center, Vec2::splat(40.0));
let vol_resp = ctx.interact(WidgetId::new("fs_vol_btn"), vol_btn_r);
let vol_val = app.config.volume;
@@ -1207,12 +1226,19 @@ pub fn render_fullscreen_player(
});
}
+/// 1-to-1 Official `SyncLyrics` (`83ceed5f9f3f6e01.css` + `9631.422e0bf38581fe75.js`):
+/// - `40vh` active anchor, `32px` Swiper spacing, `base_sz` `(2.5vw clamped 32..48px)`, `scale(1.2)` active line
+/// - `INTRO` 4 staggered pulsing dots + `PREPARE` `3/2/1` countdown slot above line 0
+/// - `withVisibleUpperLyrics` (3s on mouse move) & `withVisibleScrolledLyrics` (3s on wheel scroll)
+/// - Exact opacity ladder (`1.0` active, `0.30` next, `0.10` upcoming / upper-visible, `0.0` hidden past)
+/// - Official `SyncLyricsFooter` (`Авторы:` / `Writers:` + `Источник:` / `Source:`) + `80px` top/bottom fades
#[allow(clippy::too_many_arguments)]
fn render_fullscreen_sync_lyrics(
ctx: &mut UiContext,
lyrics: Option<&TrackLyrics>,
track: &Track,
position_ms: u64,
+ is_playing: bool,
lyr_rect: Rect,
bg_color: Color,
split_t: f32,
@@ -1224,6 +1250,8 @@ fn render_fullscreen_sync_lyrics(
shell.fs_lyrics_track_id = track.id.clone();
shell.fs_lyrics_scroll_y = 0.0;
shell.fs_lyrics_manual_until = 0.0;
+ shell.fs_lyrics_upper_until = 0.0;
+ shell.fs_lyrics_last_mouse = None;
}
let Some(lyr) = lyrics.filter(|l| !l.lines.is_empty()) else {
@@ -1241,52 +1269,85 @@ fn render_fullscreen_sync_lyrics(
return;
};
- let active_idx = if lyr.is_synced {
- lyr.lines
- .iter()
- .rposition(|l| l.time_ms <= position_ms)
- .unwrap_or(0)
+ let screen = ctx.screen_rect();
+ let screen_w = screen.width();
+ let base_sz = (screen_w * 0.025).clamp(32.0, 48.0).round();
+ let active_sz = (base_sz * 1.2).round();
+ let base_lh = (base_sz * 1.25).round();
+ let active_lh = (active_sz * 1.25).round();
+ let max_line_w = (lyr_rect.width() * 0.80).max(200.0);
+ let line_gap = 32.0f32; // exact Swiper `spaceBetween: 32`
+
+ // Exact `--sync-lyrics-scroller-inset-top-vh: 40vh` anchor
+ let anchor_y = (screen.top() + screen.height() * 0.40)
+ .clamp(lyr_rect.top() + 48.0, lyr_rect.bottom() - 80.0);
+
+ // Exact state machine: INTRO / PREPARE / PLAYING
+ let start_ms = lyr.lines.first().map_or(0, |l| l.time_ms);
+ let is_prepare = lyr.is_synced
+ && start_ms >= 3000
+ && position_ms < start_ms
+ && (start_ms - position_ms) <= 3000;
+ let is_intro = lyr.is_synced && start_ms > 0 && position_ms < start_ms && !is_prepare;
+ let active_idx: Option = if lyr.is_synced && !is_intro && !is_prepare {
+ lyr.lines.iter().rposition(|l| l.time_ms <= position_ms)
} else {
- usize::MAX
+ None
};
- let screen_w = ctx.screen_rect().width();
- let base_sz = (screen_w * 0.022).clamp(24.0, 32.0);
- let active_sz = base_sz * 1.15;
- let max_line_w = (lyr_rect.width() - 48.0).max(200.0);
-
- // Pre-measure lines
+ // Pre-measure every line at fixed `base_sz` / `base_lh` (zero wrap-jumping during `scale(1.2)`)
+ let measure_style = TextStyle::headline(base_sz, Color::WHITE).with_line_height(base_lh);
let mut line_heights = Vec::with_capacity(lyr.lines.len());
let mut line_y = Vec::with_capacity(lyr.lines.len());
let mut cur_y = 0.0f32;
- for (i, line) in lyr.lines.iter().enumerate() {
- let is_active = i == active_idx;
- let sz = if is_active { active_sz } else { base_sz };
+ for line in &lyr.lines {
let txt = if line.text.trim().is_empty() {
"• • •"
} else {
line.text.as_str()
};
- let measured = ctx.measure_text(txt, TextStyle::headline(sz, Color::WHITE), Some(max_line_w));
- let h = measured.y.max(sz * 1.25);
+ let measured = ctx.measure_text(txt, measure_style, Some(max_line_w));
+ let h = measured.y.max(base_lh);
line_y.push(cur_y + h * 0.5);
line_heights.push(h);
- cur_y += h + 22.0;
+ cur_y += h + line_gap;
}
let total_h = cur_y;
+ let counter_y = -(line_gap + 22.0);
+ let min_scroll = if is_intro || is_prepare { counter_y } else { 0.0 };
let now_t = ctx.input.time;
let dt = ctx.input.dt;
+
+ // Mouse movement (`> 2px`) reveals past upper lines for 3s (`withVisibleUpperLyrics`)
+ if let Some(pos) = ctx.input.pointer_pos {
+ if let Some(prev) = shell.fs_lyrics_last_mouse {
+ if pos.distance(prev) > 2.0 {
+ shell.fs_lyrics_upper_until = now_t + 3.0;
+ shell.fs_lyrics_last_mouse = Some(pos);
+ }
+ } else {
+ shell.fs_lyrics_last_mouse = Some(pos);
+ }
+ }
+
+ // Wheel scroll enters manual browse mode for 3s (`withVisibleScrolledLyrics`)
let wheel_dy = if ctx.is_hovered(lyr_rect) {
ctx.input.wheel_delta.y
} else {
0.0
};
if wheel_dy.abs() > 0.25 {
- shell.fs_lyrics_scroll_y = (shell.fs_lyrics_scroll_y - wheel_dy).clamp(0.0, total_h.max(0.0));
+ shell.fs_lyrics_scroll_y = (shell.fs_lyrics_scroll_y - wheel_dy).clamp(min_scroll, total_h.max(0.0));
shell.fs_lyrics_manual_until = now_t + 3.0;
- } else if lyr.is_synced && active_idx < line_y.len() && now_t >= shell.fs_lyrics_manual_until {
- let target_y = line_y[active_idx];
+ } else if lyr.is_synced && now_t >= shell.fs_lyrics_manual_until {
+ let target_y = if is_intro || is_prepare {
+ counter_y
+ } else if let Some(act) = active_idx {
+ line_y[act]
+ } else {
+ 0.0
+ };
let alpha = 1.0 - (-dt * 7.5).exp();
shell.fs_lyrics_scroll_y += (target_y - shell.fs_lyrics_scroll_y) * alpha;
if (target_y - shell.fs_lyrics_scroll_y).abs() > 0.4 {
@@ -1295,82 +1356,190 @@ fn render_fullscreen_sync_lyrics(
}
let manual_scrolled = now_t < shell.fs_lyrics_manual_until;
- let center_y = lyr_rect.center_y();
+ let upper_visible = now_t < shell.fs_lyrics_upper_until;
let lyr_cx = lyr_rect.center_x();
ctx.push_clip(lyr_rect, 0.0);
+
+ // Counter / Loader slot above line 0 (`INTRO`: 4 staggered pulsing dots; `PREPARE`: "3"/"2"/"1")
+ if is_intro || is_prepare {
+ let cy_screen = anchor_y + (counter_y - shell.fs_lyrics_scroll_y);
+ if cy_screen >= lyr_rect.top() - 40.0 && cy_screen <= lyr_rect.bottom() + 40.0 {
+ if is_prepare {
+ let rem_ms = start_ms.saturating_sub(position_ms);
+ let digit = ((rem_ms.saturating_sub(1)) / 1000 + 1).clamp(1, 3);
+ ctx.draw_text_ellipsis(
+ &digit.to_string(),
+ TextStyle::headline(base_sz, Color::WHITE.with_alpha_f32(0.50 * split_t)),
+ Rect::from_center_size(Pos2::new(lyr_cx, cy_screen), Vec2::new(80.0, base_lh)),
+ TextAlign::Center,
+ );
+ } else {
+ let spacing = 20.0f32;
+ let start_x = lyr_cx - spacing * 1.5;
+ for k in 0..4 {
+ let (dy, dot_a) = if is_playing {
+ let phase = (now_t as f32 * 4.2 - k as f32 * 0.55).sin();
+ (-phase.max(0.0) * 6.0, (0.30 + 0.55 * (phase * 0.5 + 0.5)) * split_t)
+ } else {
+ (0.0, 0.35 * split_t)
+ };
+ ctx.dl().push_circle(
+ Pos2::new(start_x + k as f32 * spacing, cy_screen + dy),
+ 5.5,
+ Color::WHITE.with_alpha_f32(dot_a),
+ );
+ }
+ if is_playing {
+ ctx.request_repaint();
+ }
+ }
+ }
+ }
+
for (i, line) in lyr.lines.iter().enumerate() {
- let y_screen = center_y + (line_y[i] - shell.fs_lyrics_scroll_y);
+ let y_screen = anchor_y + (line_y[i] - shell.fs_lyrics_scroll_y);
let h = line_heights[i];
- if y_screen + h * 0.5 < lyr_rect.top() - 40.0 || y_screen - h * 0.5 > lyr_rect.bottom() + 40.0 {
+ let is_active = !manual_scrolled && active_idx == Some(i);
+
+ let target_op: f32 = if !lyr.is_synced || manual_scrolled {
+ 1.0
+ } else if is_intro || is_prepare {
+ if i == 0 { 0.30 } else { 0.10 }
+ } else if let Some(act) = active_idx {
+ if i == act {
+ 1.0
+ } else if i == act + 1 {
+ 0.30
+ } else if i > act + 1 {
+ 0.10
+ } else if upper_visible {
+ 0.10
+ } else {
+ 0.0
+ }
+ } else {
+ 0.10
+ };
+
+ let op_t = ctx.animate_f32(WidgetId::from_pair("fs_lyr_op", i), target_op, 0.45);
+ let act_t = ctx.animate_bool(WidgetId::from_pair("fs_lyr_act", i), is_active, 0.45);
+
+ if y_screen + h * 0.65 < lyr_rect.top() - 48.0
+ || y_screen - h * 0.65 > lyr_rect.bottom() + 48.0
+ {
continue;
}
- let is_active = i == active_idx;
- let is_next = active_idx != usize::MAX && i == active_idx + 1;
- let hit_r = Rect::from_center_size(Pos2::new(lyr_cx, y_screen), Vec2::new(max_line_w, h + 12.0));
+ let line_visible = op_t > 0.02 || manual_scrolled || upper_visible || !lyr.is_synced;
+ let hit_r = Rect::from_center_size(Pos2::new(lyr_cx, y_screen), Vec2::new(max_line_w, h + 14.0));
let resp = ctx.interact(WidgetId::from_pair("fs_lyr_ln", i), hit_r);
- let act_t = ctx.animate_bool(WidgetId::from_pair("fs_lyr_act", i), is_active, 0.35);
let hov_t = ctx.animate_bool(
WidgetId::from_pair("fs_lyr_hov", i),
- resp.hovered && lyr.is_synced,
+ resp.hovered && lyr.is_synced && line_visible,
0.18,
);
- let base_alpha = if !lyr.is_synced || manual_scrolled {
- 0.90f32
- } else if is_next {
- 0.34
- } else {
- 0.16
- };
- let alpha = (base_alpha + (1.0 - base_alpha) * act_t)
- .max(0.90 * hov_t)
- * split_t;
- let sz = base_sz + (active_sz - base_sz) * act_t;
- let col = Color::WHITE.with_alpha_f32(alpha);
- let txt = if line.text.trim().is_empty() {
- "• • •"
- } else {
- line.text.as_str()
- };
+ let alpha = op_t.max(0.85 * hov_t) * split_t;
+ if alpha > 0.005 {
+ let col = Color::WHITE.with_alpha_f32(alpha);
+ let txt = if line.text.trim().is_empty() {
+ "• • •"
+ } else {
+ line.text.as_str()
+ };
- let draw_r = Rect::from_center_size(Pos2::new(lyr_cx, y_screen), Vec2::new(max_line_w, h + 6.0));
- ctx.draw_text_wrapped(txt, TextStyle::headline(sz, col), draw_r, None, TextAlign::Center);
+ if act_t < 0.01 {
+ ctx.draw_text_wrapped_scaled(
+ txt,
+ TextStyle::headline(base_sz, col).with_line_height(base_lh),
+ Rect::from_center_size(Pos2::new(lyr_cx, y_screen), Vec2::new(max_line_w, h)),
+ 1.0,
+ TextAlign::Center,
+ );
+ } else {
+ let sc = (1.0 + 0.2 * act_t) / 1.2;
+ ctx.draw_text_wrapped_scaled(
+ txt,
+ TextStyle::headline(active_sz, col).with_line_height(active_lh),
+ Rect::from_center_size(
+ Pos2::new(lyr_cx, y_screen),
+ Vec2::new(max_line_w * 1.2, h * 1.2),
+ ),
+ sc,
+ TextAlign::Center,
+ );
+ }
+ }
- if lyr.is_synced {
+ if lyr.is_synced && line_visible {
if resp.hovered {
ctx.set_cursor(CursorKind::Pointer);
}
if resp.clicked {
- actions.push(AppAction::SeekMs(line.time_ms));
+ actions.push(AppAction::SeekMs(line.time_ms.saturating_add(10)));
shell.fs_lyrics_manual_until = 0.0;
}
}
}
- // Writers footer
- if let Some(ref writers) = lyr.writers {
- let fy = center_y + (total_h + 24.0 - shell.fs_lyrics_scroll_y);
- if fy >= lyr_rect.top() - 40.0 && fy <= lyr_rect.bottom() + 40.0 {
+ // Official `SyncLyricsFooter`: Writers + Source (`major`) attribution at `0.50` alpha
+ let has_writers = lyr.writers.as_deref().map_or(false, |s| !s.trim().is_empty());
+ let has_major = lyr.major.as_deref().map_or(false, |s| !s.trim().is_empty());
+ if has_writers || has_major {
+ let footer_pad_top = (screen_w * 0.0625).clamp(48.0, 96.0);
+ let footer_sz = (screen_w * 0.0125).clamp(15.0, 20.0);
+ let footer_col = Color::WHITE.with_alpha_f32(0.50 * split_t);
+ let footer_style = TextStyle::medium(footer_sz, footer_col);
+ let mut fy = anchor_y + (total_h + footer_pad_top - shell.fs_lyrics_scroll_y);
+
+ if let Some(ref writers) = lyr.writers.as_deref().filter(|s| !s.trim().is_empty()) {
let txt = if ru {
format!("Авторы: {}", writers)
} else {
format!("Writers: {}", writers)
};
- ctx.draw_text_wrapped(
- &txt,
- TextStyle::regular(14.0, Color::WHITE.with_alpha_f32(0.5 * split_t)),
- Rect::from_center_size(Pos2::new(lyr_cx, fy), Vec2::new(max_line_w, 40.0)),
- Some(2),
- TextAlign::Center,
- );
+ let mh = ctx
+ .measure_text(&txt, footer_style, Some(max_line_w))
+ .y
+ .max(footer_sz * 1.35);
+ if fy + mh >= lyr_rect.top() - 40.0 && fy <= lyr_rect.bottom() + 40.0 {
+ ctx.draw_text_wrapped(
+ &txt,
+ footer_style,
+ Rect::from_xywh(lyr_cx - max_line_w * 0.5, fy, max_line_w, mh + 4.0),
+ Some(3),
+ TextAlign::Center,
+ );
+ }
+ fy += mh + 8.0;
+ }
+
+ if let Some(ref major) = lyr.major.as_deref().filter(|s| !s.trim().is_empty()) {
+ let txt = if ru {
+ format!("Источник: {}", major)
+ } else {
+ format!("Source: {}", major)
+ };
+ let mh = ctx
+ .measure_text(&txt, footer_style, Some(max_line_w))
+ .y
+ .max(footer_sz * 1.35);
+ if fy + mh >= lyr_rect.top() - 40.0 && fy <= lyr_rect.bottom() + 40.0 {
+ ctx.draw_text_wrapped(
+ &txt,
+ footer_style,
+ Rect::from_xywh(lyr_cx - max_line_w * 0.5, fy, max_line_w, mh + 4.0),
+ Some(2),
+ TextAlign::Center,
+ );
+ }
}
}
- // Smooth top & bottom gradient fade masks into `bg_color`
- let fade_h = 84.0f32.min(lyr_rect.height() * 0.22);
+ // Official `80px` (`5rem`) top & bottom gradient fade masks into `bg_color`
+ let fade_h = 80.0f32.min(lyr_rect.height() * 0.25);
let bg_clear = bg_color.with_alpha(0);
ctx.dl().push_gradient_rect(
Rect::from_xywh(lyr_rect.left(), lyr_rect.top(), lyr_rect.width(), fade_h),
diff --git a/src/views/podcasts_kids.rs b/src/views/podcasts_kids.rs
index 43603a4..94a8ce9 100644
--- a/src/views/podcasts_kids.rs
+++ b/src/views/podcasts_kids.rs
@@ -1194,7 +1194,7 @@ pub fn render_concerts(
ctx.request_repaint();
let t_sec = app.start_time.elapsed().as_secs_f32() * 3.0;
- // 3 featured shimmer poster cards
+ // 3 featured shimmer poster cards (matching official 0.963 TopConcertsCarousel aspect ratio)
let gap = 16.0;
let f_cols = if avail_w >= 860.0 {
3usize
@@ -1203,16 +1203,17 @@ pub fn render_concerts(
} else {
1
};
- let f_w = ((avail_w - gap * (f_cols as f32 - 1.0)) / f_cols as f32).max(220.0);
+ let f_w = ((avail_w - gap * (f_cols as f32 - 1.0)) / f_cols as f32).clamp(240.0, 440.0);
+ let f_h = (f_w / 0.963).clamp(240.0, 320.0);
for i in 0..f_cols {
let col = shimmer_color(pal, t_sec + i as f32 * 0.55);
ctx.dl().push_rect(
- Rect::from_xywh(x + i as f32 * (f_w + gap), y, f_w, 210.0),
+ Rect::from_xywh(x + i as f32 * (f_w + gap), y, f_w, f_h),
16.0,
col,
);
}
- y += 236.0;
+ y += f_h + 26.0;
// 4 shimmer feed rows
for i in 0..4 {
@@ -1276,7 +1277,7 @@ pub fn render_concerts(
}
.max(1);
let f_w = ((avail_w - gap * (f_cols as f32 - 1.0)) / f_cols as f32).clamp(240.0, 440.0);
- let f_h = 216.0;
+ let f_h = (f_w / 0.963).clamp(240.0, 320.0);
ctx.draw_text_ellipsis(
if ru { "Рекомендуем" } else { "Featured" },
diff --git a/src/views/search.rs b/src/views/search.rs
index 77e10ce..9f059aa 100644
--- a/src/views/search.rs
+++ b/src/views/search.rs
@@ -339,8 +339,9 @@ pub fn render_search(
false,
false,
);
+ let balb_title = balb.full_title();
ctx.draw_text_ellipsis(
- &balb.title,
+ &balb_title,
TextStyle::bold(16.5, pal.text_bright),
Rect::from_xywh(text_x, card_r.top() + 22.0, text_w, 24.0),
TextAlign::Left,
@@ -726,8 +727,9 @@ pub fn render_search(
let h_id = WidgetId::new("search_albums_hscroll");
let sx = ctx.begin_scroll_h(h_id, row_vp, 0.0);
let mut cx = x - sx;
- for alb in res.albums.iter().take(12) {
+ for (idx, alb) in res.albums.iter().take(12).enumerate() {
let cr = Rect::from_xywh(cx, y, card_w, card_h);
+ let alb_title = alb.full_title();
let sub = alb
.artists
.first()
@@ -737,9 +739,9 @@ pub fn render_search(
ctx,
pal,
covers,
- WidgetId::from_pair("s_alb", &alb.id),
+ WidgetId::from_pair("s_alb", (idx, &alb.id)),
cr,
- &alb.title,
+ &alb_title,
sub,
alb.cover_uri.as_deref(),
&format!("alb_{}", alb.id),
@@ -749,12 +751,12 @@ pub fn render_search(
if m.play_clicked {
actions.push(AppAction::PlayAlbum {
id: alb.id.clone(),
- title: alb.title.clone(),
+ title: alb_title,
});
} else if m.clicked {
actions.push(AppAction::Navigate(Route::Album {
id: alb.id.clone(),
- title: alb.title.clone(),
+ title: alb_title,
}));
}
cx += card_w + 16.0;
@@ -776,6 +778,7 @@ pub fn render_search(
card_h,
);
if cr.bottom() >= body_vp.top() - 40.0 && cr.top() <= body_vp.bottom() + 40.0 {
+ let alb_title = alb.full_title();
let sub = alb
.artists
.first()
@@ -785,9 +788,9 @@ pub fn render_search(
ctx,
pal,
covers,
- WidgetId::from_pair("s_alb_grid", &alb.id),
+ WidgetId::from_pair("s_alb_grid", (idx, &alb.id)),
cr,
- &alb.title,
+ &alb_title,
sub,
alb.cover_uri.as_deref(),
&format!("alb_{}", alb.id),
@@ -797,12 +800,12 @@ pub fn render_search(
if m.play_clicked {
actions.push(AppAction::PlayAlbum {
id: alb.id.clone(),
- title: alb.title.clone(),
+ title: alb_title,
});
} else if m.clicked {
actions.push(AppAction::Navigate(Route::Album {
id: alb.id.clone(),
- title: alb.title.clone(),
+ title: alb_title,
}));
}
}
@@ -831,13 +834,16 @@ pub fn render_search(
let h_id = WidgetId::new("search_playlists_hscroll");
let sx = ctx.begin_scroll_h(h_id, row_vp, 0.0);
let mut cx = x - sx;
- for pl in res.playlists.iter().take(12) {
+ for (idx, pl) in res.playlists.iter().take(12).enumerate() {
let cr = Rect::from_xywh(cx, y, card_w, card_h);
let m = media_card(
ctx,
pal,
covers,
- WidgetId::from_pair("s_pl", format!("{}_{}", pl.owner_uid, pl.kind)),
+ WidgetId::from_pair(
+ "s_pl",
+ (idx, format!("{}_{}", pl.owner_uid, pl.kind)),
+ ),
cr,
&pl.title,
&pl.owner_name,
@@ -889,7 +895,7 @@ pub fn render_search(
covers,
WidgetId::from_pair(
"s_pl_grid",
- format!("{}_{}", pl.owner_uid, pl.kind),
+ (idx, format!("{}_{}", pl.owner_uid, pl.kind)),
),
cr,
&pl.title,
diff --git a/src/views/sidebar.rs b/src/views/sidebar.rs
index 0e7f8c4..b8943a3 100644
--- a/src/views/sidebar.rs
+++ b/src/views/sidebar.rs
@@ -287,6 +287,8 @@ pub fn render_sidebar(
};
let cover_rect = Rect::from_center_size(cover_center, Vec2::splat(40.0));
let is_circle = pin.kind == "artist" || is_wave;
+ let is_likes_art = pin.kind == "likes"
+ || (pin.kind == "playlist" && pin.id.ends_with(":3") && pin.cover_uri.is_none());
draw_cover_art(
ctx,
pal,
@@ -296,7 +298,7 @@ pub fn render_sidebar(
&pin.id,
4.0,
is_circle,
- pin.kind == "likes",
+ is_likes_art,
);
// Hover Play/Pause overlay on ALL pinned items (playlists, albums, favorites, artists & waves!)
diff --git a/tests/parity_extended.rs b/tests/parity_extended.rs
index a963dd9..09950e7 100644
--- a/tests/parity_extended.rs
+++ b/tests/parity_extended.rs
@@ -1890,6 +1890,7 @@ fn test_ext_17_for_you_collection_concerts_words_fullscreen() {
let mk_album = |id: &str, title: &str, artist: &str| AlbumSummary {
id: id.into(),
title: title.into(),
+ version: None,
year: Some(2026),
cover_uri: None,
artists: vec![ArtistSummary {
@@ -2170,9 +2171,9 @@ fn test_ext_17_for_you_collection_concerts_words_fullscreen() {
let img = render_single_frame(&mut vk, &mut shell, 0.032);
let _ = img.save(out_dir.join("concerts_official.png"));
- // Verify Top 3 colored poster cards + upcoming feed rendered cleanly
+ // Verify Top 3 poster cards (aspect 0.963, h~320px) + cashback pills + yellow price CTAs rendered cleanly
let mut poster_chromatic_px = 0usize;
- for y in 160..420 {
+ for y in 160..540 {
for x in 250..1240 {
let [r, g, b] = img.get_pixel(x, y).0;
if r.max(g).max(b).saturating_sub(r.min(g).min(b)) >= 20 {
@@ -2244,3 +2245,273 @@ fn test_ext_17_for_you_collection_concerts_words_fullscreen() {
);
}
}
+
+#[test]
+fn test_ext_18_qa_sync_lyrics_scroll_concerts_duplicate_albums() {
+ use std::sync::atomic::Ordering;
+ use yandex_music_rs::api::models::{AlbumSummary, LyricLine, TrackLyrics};
+ use yandex_music_rs::app::CollectionTab;
+ use yandex_music_rs::engine::input::{InputState, ZLayer};
+ use yandex_music_rs::engine::scroll::ScrollState;
+ use yandex_music_rs::engine::types::{Pos2, Rect};
+ use yandex_music_rs::engine::widgets::cover_fit_uv;
+
+ let rt = tokio::runtime::Runtime::new().unwrap();
+ let mut vk = HeadlessVulkanRenderer::new(NATIVE_W, NATIVE_H).expect("Vulkan init failed");
+ let out_dir = output_dir();
+ let _ = std::fs::create_dir_all(&out_dir);
+
+ // 1. 1-to-1 Official FullscreenPlayerDesktop 50/50 SyncLyrics (`fullscreen_sync_lyrics_official.png`)
+ {
+ let mut shell = make_base_shell(
+ rt.handle().clone(),
+ vk.gpu_name.clone(),
+ Route::LikedTracks,
+ ThemeMode::Dark,
+ Language::Ru,
+ 0.0,
+ );
+ if let Some(tr) = shell.app.queue.get_mut(0) {
+ tr.derived_average_hex = Some("#1A2238".into());
+ }
+ shell.app.current_lyrics = Some(TrackLyrics {
+ track_id: "t_1".into(),
+ is_synced: true,
+ lines: vec![
+ LyricLine { time_ms: 4_000, text: "Первая строчка уходит вверх".into() },
+ LyricLine { time_ms: 10_000, text: "Вторая строчка уже прозвучала".into() },
+ LyricLine { time_ms: 16_000, text: "Третья строчка перед текущей".into() },
+ LyricLine { time_ms: 21_000, text: "Активная яркая строка прямо по центру".into() },
+ LyricLine { time_ms: 28_000, text: "Следующая строчка ждёт своей очереди".into() },
+ LyricLine { time_ms: 35_000, text: "Пятая строчка чуть дальше вниз".into() },
+ LyricLine { time_ms: 42_000, text: "Шестая строчка в приглушённом цвете".into() },
+ LyricLine { time_ms: 49_000, text: "Финальная строчка композиции".into() },
+ ],
+ writers: Some("Test Writer".into()),
+ major: Some("Genius".into()),
+ });
+ shell.app.fullscreen_open = true;
+ shell.app.fullscreen_lyrics_open = true;
+ shell.app.audio.state.position_ms.store(22_000, Ordering::SeqCst);
+ shell.app.audio.state.is_playing.store(true, Ordering::SeqCst);
+ shell.shell.fs_lyrics_upper_until = 0.0;
+ shell.shell.fs_lyrics_manual_until = 0.0;
+
+ // Settle 0.45s split + opacity animations cleanly with mouse idle
+ let mut img = render_single_frame(&mut vk, &mut shell, 0.0);
+ for f in 1..25 {
+ img = render_single_frame(&mut vk, &mut shell, f as f64 * 0.05);
+ }
+ let _ = img.save(out_dir.join("fullscreen_sync_lyrics_official.png"));
+
+ // Verify bright white active line near 40vh (y=250..410, x=600..1220)
+ let mut active_bright_px = 0usize;
+ for y in 250..410 {
+ for x in 600..1220 {
+ let [r, g, b] = img.get_pixel(x, y).0;
+ if r >= 200 && g >= 200 && b >= 200 {
+ active_bright_px += 1;
+ }
+ }
+ }
+ assert!(
+ active_bright_px >= 600,
+ "[fullscreen_sync_lyrics] Expected bright white active line near 40vh, found {} px",
+ active_bright_px
+ );
+
+ // Verify past lines above active (y=60..210, x=640..1180) are hidden (0 bright white px) when mouse is idle
+ let mut past_bright_px = 0usize;
+ for y in 60..210 {
+ for x in 640..1180 {
+ let [r, g, b] = img.get_pixel(x, y).0;
+ if r >= 170 && g >= 170 && b >= 170 {
+ past_bright_px += 1;
+ }
+ }
+ }
+ assert_eq!(
+ past_bright_px, 0,
+ "[fullscreen_sync_lyrics] Past upper lines must be hidden (opacity 0.0) when mouse is idle, found {} bright px",
+ past_bright_px
+ );
+
+ // Verify Volume button is anchored in the bottom-right corner (center ~(1236, 760)), NOT bottom-center
+ let mut vol_corner_bright_px = 0usize;
+ for y in 740..780 {
+ for x in 1216..1256 {
+ let [r, g, b] = img.get_pixel(x, y).0;
+ if r >= 160 && g >= 160 && b >= 160 {
+ vol_corner_bright_px += 1;
+ }
+ }
+ }
+ assert!(
+ vol_corner_bright_px >= 25,
+ "[fullscreen_sync_lyrics] Expected Volume icon anchored in bottom-right corner (1236,760), found {} bright px",
+ vol_corner_bright_px
+ );
+ }
+
+ // 2. Horizontal Scroll Isolation: plain vertical wheel MUST NOT scroll horizontal-only carousels!
+ {
+ let vp = Rect::from_xywh(0.0, 0.0, 600.0, 200.0);
+ let mut st = ScrollState::new();
+ st.content_size = Vec2::new(2000.0, 200.0);
+
+ let mut inp = InputState::new();
+ inp.pointer_pos = Some(Pos2::new(200.0, 100.0));
+ inp.wheel_delta = Vec2::new(0.0, -120.0);
+ st.update(&inp, ZLayer::Base, vp, false, true);
+ assert!(
+ st.target.x.abs() < 0.001,
+ "Horizontal-only ScrollState must ignore plain vertical wheel_delta.y, got target.x={}",
+ st.target.x
+ );
+
+ // Shift + vertical wheel scrolls horizontally
+ inp.modifiers.shift = true;
+ st.update(&inp, ZLayer::Base, vp, false, true);
+ assert!(
+ st.target.x > 50.0,
+ "Shift + wheel_delta.y must scroll horizontally, got target.x={}",
+ st.target.x
+ );
+
+ // Trackpad horizontal wheel_delta.x scrolls horizontally without Shift
+ st.reset();
+ inp.modifiers.shift = false;
+ inp.wheel_delta = Vec2::new(-120.0, 0.0);
+ st.update(&inp, ZLayer::Base, vp, false, true);
+ assert!(
+ st.target.x > 50.0,
+ "Horizontal wheel_delta.x must scroll horizontally, got target.x={}",
+ st.target.x
+ );
+ }
+
+ // 3. `object-fit: cover` (`cover_fit_uv`) preserves aspect ratio with zero stretching
+ {
+ let uv_wide = cover_fit_uv(400, 400, Rect::from_xywh(0.0, 0.0, 300.0, 150.0), 0.35);
+ assert!(
+ (uv_wide.w - 1.0).abs() < 1e-4 && (uv_wide.h - 0.5).abs() < 1e-4,
+ "400x400 in 300x150 expected uv (w=1.0, h=0.5), got {:?}",
+ uv_wide
+ );
+ let uv_portrait = cover_fit_uv(200, 400, Rect::from_xywh(0.0, 0.0, 200.0, 200.0), 0.35);
+ assert!(
+ (uv_portrait.w - 1.0).abs() < 1e-4 && (uv_portrait.h - 0.5).abs() < 1e-4,
+ "200x400 in 200x200 expected uv (w=1.0, h=0.5), got {:?}",
+ uv_portrait
+ );
+ }
+
+ // 4. Concerts Active Icon (`Icon::ConcertsSelected`) rasterizes with symmetric filled ticket silhouette
+ {
+ let opt = resvg::usvg::Options::default();
+ let tree = resvg::usvg::Tree::from_data(Icon::ConcertsSelected.raw_svg(), &opt)
+ .expect("ConcertsSelected SVG parse failed");
+ let sz = 48u32;
+ let mut pixmap = resvg::tiny_skia::Pixmap::new(sz, sz).unwrap();
+ let sx = sz as f32 / tree.size().width();
+ let sy = sz as f32 / tree.size().height();
+ resvg::render(
+ &tree,
+ resvg::tiny_skia::Transform::from_scale(sx, sy),
+ &mut pixmap.as_mut(),
+ );
+ let data = pixmap.data();
+ let mut left_cov = 0u64;
+ let mut right_cov = 0u64;
+ for y in 0..sz {
+ for x in 0..sz {
+ let a = data[((y * sz + x) * 4 + 3) as usize] as u64;
+ if x < sz / 2 {
+ left_cov += a;
+ } else {
+ right_cov += a;
+ }
+ }
+ }
+ let total = left_cov + right_cov;
+ assert!(
+ total > 40_000,
+ "ConcertsSelected SVG coverage too small ({})",
+ total
+ );
+ let asym = (left_cov as i64 - right_cov as i64).unsigned_abs() as f64 / total as f64;
+ assert!(
+ asym < 0.05,
+ "ConcertsSelected SVG is asymmetric (left={}, right={}, asym={:.3})",
+ left_cov,
+ right_cov,
+ asym
+ );
+ }
+
+ // 5. Duplicate-Title Albums render distinctly in Collection overview + Albums sub-view with zero panics
+ {
+ let mk_dup = |id: &str, version: Option<&str>| AlbumSummary {
+ id: id.into(),
+ title: "Same Title Album".into(),
+ version: version.map(String::from),
+ year: Some(2025),
+ cover_uri: None,
+ artists: vec![ArtistSummary {
+ id: "art_dup".into(),
+ name: "Test Artist".into(),
+ cover_uri: None,
+ genres: vec![],
+ }],
+ track_count: 10,
+ genre: Some("pop".into()),
+ is_explicit: false,
+ content_type: Some("album".into()),
+ };
+ let std_alb = mk_dup("alb_std", None);
+ let dlx_alb = mk_dup("alb_dlx", Some("Deluxe"));
+ assert_eq!(std_alb.full_title(), "Same Title Album");
+ assert_eq!(dlx_alb.full_title(), "Same Title Album (Deluxe)");
+
+ let mut shell = make_base_shell(
+ rt.handle().clone(),
+ vk.gpu_name.clone(),
+ Route::Collection,
+ ThemeMode::Dark,
+ Language::Ru,
+ 0.0,
+ );
+ shell.app.liked_albums = vec![std_alb, dlx_alb];
+ shell.app.collection_tab = CollectionTab::Tracks;
+ let _ = render_single_frame(&mut vk, &mut shell, 0.0);
+ let _ = render_single_frame(&mut vk, &mut shell, 0.016);
+
+ shell.app.collection_tab = CollectionTab::Albums;
+ let _ = render_single_frame(&mut vk, &mut shell, 0.032);
+ let img_albums = render_single_frame(&mut vk, &mut shell, 0.048);
+
+ // Confirm both album cards rendered distinct non-empty content in the Albums grid (x=250..650, y=130..360)
+ let mut card1_lit = 0usize;
+ let mut card2_lit = 0usize;
+ for y in 130..360 {
+ for x in 250..430 {
+ let [r, g, b] = img_albums.get_pixel(x, y).0;
+ if r > 30 || g > 30 || b > 30 {
+ card1_lit += 1;
+ }
+ }
+ for x in 450..630 {
+ let [r, g, b] = img_albums.get_pixel(x, y).0;
+ if r > 30 || g > 30 || b > 30 {
+ card2_lit += 1;
+ }
+ }
+ }
+ assert!(
+ card1_lit > 2_000 && card2_lit > 2_000,
+ "Expected both duplicate-title album cards to render distinctly (card1={}, card2={})",
+ card1_lit,
+ card2_lit
+ );
+ }
+}