Compare commits

..

No commits in common. "84d9c6756cb6120adc71dc6c57cc4a08311daee4" and "8e7ec9142f62cb47adcfdc92ba98e448eb1a7469" have entirely different histories.

14 changed files with 585 additions and 4490 deletions

View file

@ -1,35 +1,12 @@
# Инструкция для AI-агентов (Git, коммиты и релизы на git.tatar) # Инструкция для AI-агентов (Git, коммиты и релизы на git.tatar)
Этот репозиторий хостится на **Forgejo** (`https://git.tatar/marwy/yandex-music-rs`). Этот репозиторий хостится на **Forgejo** (`https://git.tatar/marwy/yandex-music-rs`).
Авторизация на `https://git.tatar` должна храниться в Windows Credential Manager как **бессрочный Personal Access Token (PAT)** с `credential.https://git.tatar.provider = generic` (НЕ через OAuth-окно GCM — OAuth-токен Forgejo протухает через ~1 час, после чего `git push` удаляет запись из Credential Manager). В системе (Windows Credential Manager) уже сохранён рабочий токен для `https://git.tatar` (`git:https://git.tatar`).
> **ВАЖНО:** > **ВАЖНО:**
> 1. **НИКОГДА не используй браузер** для создания релизов, загрузки ассетов или настройки репозитория на `git.tatar` — браузер не авторизован и упрётся в страницу логина. Все операции с `git.tatar` выполняются через **Forgejo REST API v1** с токеном из `git credential fill`. > 1. **НИКОГДА не используй браузер** для создания релизов, загрузки ассетов или настройки репозитория на `git.tatar` — браузер не авторизован и упрётся в страницу логина. Все операции с `git.tatar` выполняются через **Forgejo REST API v1** с токеном из `git credential fill`.
> 2. **НИКОГДА не печатай токен** в stdout, логи, файлы или ответы пользователю. > 2. **НИКОГДА не печатай токен** в stdout, логи, файлы или ответы пользователю.
> 3. **НИКОГДА не коммить** `target/`, `original_yandex_music/`, `Yandex_Music_*.exe`, локальные `.deb`/`.exe`/`.tar.gz` и личные OAuth-токены Яндекс Музыки. > 3. **НИКОГДА не коммить** `target/`, `original_yandex_music/`, `Yandex_Music_*.exe`, локальные `.deb`/`.exe`/`.tar.gz` и личные OAuth-токены Яндекс Музыки.
> 4. **Перед `git push` проверяй токен без интерактива** (`$env:GCM_INTERACTIVE = "never"` + `GET https://git.tatar/api/v1/user`): если токен отсутствует или истёк (401), не вешай `git push` на невидимом окне GCM — сразу попроси пользователя сохранить бессрочный PAT из `https://git.tatar/user/settings/applications` (см. раздел 0).
---
## 0. Первичная настройка бессрочного токена (делается пользователем 1 раз)
Если токен отсутствует или протух (401), пользователь создаёт **Access Token** на `https://git.tatar/user/settings/applications` (права: `write:repository`, `read:user`) и сохраняет его один раз:
```powershell
git config --global credential.https://git.tatar.provider generic
"protocol=https`nhost=git.tatar`nusername=marwy`npassword=<TOKEN>`n" | git credential approve
```
Проверка из агента (никогда не выводить `$token`, всегда ставить `GCM_INTERACTIVE=never`):
```powershell
$env:GCM_INTERACTIVE = "never"
$credOut = "protocol=https`nhost=git.tatar`n`n" | git credential fill 2>$null
$token = ($credOut | Where-Object { $_ -like 'password=*' }) -replace '^password=',''
if (-not $token) { throw "No token in Credential Manager (need PAT for git.tatar)" }
$u = Invoke-RestMethod -Uri "https://git.tatar/api/v1/user" -Headers @{ Authorization = "token $token" }
Write-Output ("AUTH_OK: " + $u.login)
```
--- ---

2
Cargo.lock generated
View file

@ -6325,7 +6325,7 @@ checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9"
[[package]] [[package]]
name = "yandex-music-rs" name = "yandex-music-rs"
version = "0.1.2" version = "0.1.1"
dependencies = [ dependencies = [
"aes", "aes",
"anyhow", "anyhow",

View file

@ -1,6 +1,6 @@
[package] [package]
name = "yandex-music-rs" name = "yandex-music-rs"
version = "0.1.2" version = "0.1.1"
edition = "2021" edition = "2021"
description = "Native high-performance, ultra-low-RAM Yandex Music desktop client in Rust + ash Vulkan SDF + taffy + cosmic-text" description = "Native high-performance, ultra-low-RAM Yandex Music desktop client in Rust + ash Vulkan SDF + taffy + cosmic-text"

View file

@ -10,12 +10,12 @@
Готовые сборки доступны на странице [Releases](https://git.tatar/marwy/yandex-music-rs/releases): Готовые сборки доступны на странице [Releases](https://git.tatar/marwy/yandex-music-rs/releases):
- **Windows (x64)**: скачайте `yandex-music-rs-v0.1.2-windows-x86_64.exe` и запустите (переносной файл, установка не требуется). - **Windows (x64)**: скачайте `yandex-music-rs-v0.1.1-windows-x86_64.exe` и запустите (переносной файл, установка не требуется).
- **Linux (Debian / Ubuntu x64)**: скачайте `yandex-music-rs_0.1.2-1_amd64.deb` и установите: - **Linux (Debian / Ubuntu x64)**: скачайте `yandex-music-rs_0.1.1-1_amd64.deb` и установите:
```bash ```bash
sudo apt install ./yandex-music-rs_0.1.2-1_amd64.deb sudo apt install ./yandex-music-rs_0.1.1-1_amd64.deb
``` ```
- **Linux (generic x64)**: архив `yandex-music-rs-v0.1.2-linux-x86_64.tar.gz` с готовым бинарником. - **Linux (generic x64)**: архив `yandex-music-rs-v0.1.1-linux-x86_64.tar.gz` с готовым бинарником.
## Стек и возможности ## Стек и возможности

View file

@ -330,8 +330,6 @@ pub fn demo_landing() -> LandingData {
vibe_tracks, vibe_tracks,
podcasts, podcasts,
kids_playlists, kids_playlists,
rich_new_releases: Vec::new(),
vibe_pick_tabs: Vec::new(),
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -184,53 +184,6 @@ pub struct LandingData {
pub vibe_tracks: Vec<Track>, pub vibe_tracks: Vec<Track>,
pub podcasts: Vec<AlbumSummary>, pub podcasts: Vec<AlbumSummary>,
pub kids_playlists: Vec<PlaylistSummary>, pub kids_playlists: Vec<PlaylistSummary>,
#[serde(default)]
pub rich_new_releases: Vec<NewReleaseItem>,
#[serde(default)]
pub vibe_pick_tabs: Vec<VibePickTab>,
}
/// Rich editorial new release item from `GET /landing/skeleton/web_main` (`NEW_RELEASES`).
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct NewReleaseItem {
pub album: AlbumSummary,
#[serde(default)]
pub artist_cover_uri: Option<String>,
#[serde(default)]
pub cover_color: Option<String>,
#[serde(default)]
pub release_date: Option<String>,
}
/// Single My Vibe wave pick item from `WAVES` / `SETS_BY_WAVES` skeleton block.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct VibePickItem {
pub title: String,
pub header: String,
pub seeds: Vec<String>,
#[serde(default)]
pub color_hex: Option<String>,
#[serde(default)]
pub background_image_url: Option<String>,
#[serde(default)]
pub image_url: Option<String>,
}
/// Category tab inside `More Picks` (`Ещё подборки`) from `WAVES` / `SETS_BY_WAVES`.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct VibePickTab {
pub title: String,
pub items: Vec<VibePickItem>,
}
/// Section block on the Books & Podcasts (`non_music`) landing page.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct NonMusicSection {
pub id: String,
pub title: String,
pub block_type: String,
pub albums: Vec<AlbumSummary>,
pub playlists: Vec<PlaylistSummary>,
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
@ -311,7 +264,7 @@ pub struct PlayTelemetryEvent {
pub batch_id: Option<String>, pub batch_id: Option<String>,
} }
/// Concert item returned by `GET /concerts/feed` or `GET /landing/skeleton/concerts` /// Concert item returned by `GET /concerts/feed`
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ConcertItem { pub struct ConcertItem {
pub id: String, pub id: String,
@ -322,18 +275,6 @@ pub struct ConcertItem {
pub date: String, pub date: String,
pub cover_uri: Option<String>, pub cover_uri: Option<String>,
pub afisha_url: Option<String>, pub afisha_url: Option<String>,
#[serde(default)]
pub min_price: Option<u64>,
#[serde(default)]
pub currency: Option<String>,
#[serde(default)]
pub cashback_percent: Option<u32>,
#[serde(default)]
pub cashback_title: Option<String>,
#[serde(default)]
pub cover_color: Option<String>,
#[serde(default)]
pub event_kind: Option<String>,
} }
fn default_wheel_item_type() -> String { fn default_wheel_item_type() -> String {

View file

@ -248,12 +248,6 @@ pub enum AppAction {
title: String, title: String,
seeds: Vec<String>, seeds: Vec<String>,
}, },
StartVibeStation {
title: String,
seeds: Vec<String>,
},
RefreshConcerts,
RefreshNonMusic,
ApplyVibeSettings { ApplyVibeSettings {
mood: Option<String>, mood: Option<String>,
activity: Option<String>, activity: Option<String>,
@ -393,7 +387,6 @@ pub(crate) enum ApiEvent {
AccountLoaded(Result<UserAccount, String>), AccountLoaded(Result<UserAccount, String>),
LandingLoaded(LandingData), LandingLoaded(LandingData),
ConcertsLoaded(Vec<ConcertItem>), ConcertsLoaded(Vec<ConcertItem>),
NonMusicLoaded(Vec<NonMusicSection>, Vec<AlbumSummary>),
SearchHistoryLoaded(Vec<String>), SearchHistoryLoaded(Vec<String>),
LikedTracksLoaded(Vec<Track>), LikedTracksLoaded(Vec<Track>),
FavoriteFiltersLoaded(Vec<TrackFilterChip>), FavoriteFiltersLoaded(Vec<TrackFilterChip>),
@ -481,9 +474,6 @@ pub struct AppState {
pub account: Option<UserAccount>, pub account: Option<UserAccount>,
pub landing: LandingData, pub landing: LandingData,
pub concerts: Vec<ConcertItem>, pub concerts: Vec<ConcertItem>,
pub concerts_loading: bool,
pub non_music_sections: Vec<NonMusicSection>,
pub non_music_loading: bool,
pub liked_tracks: Vec<Track>, pub liked_tracks: Vec<Track>,
pub liked_ids: HashSet<String>, pub liked_ids: HashSet<String>,
pub disliked_ids: HashSet<String>, pub disliked_ids: HashSet<String>,
@ -637,9 +627,6 @@ impl AppState {
account: None, account: None,
landing: LandingData::default(), landing: LandingData::default(),
concerts: Vec::new(), concerts: Vec::new(),
concerts_loading: false,
non_music_sections: Vec::new(),
non_music_loading: false,
liked_tracks: Vec::new(), liked_tracks: Vec::new(),
liked_ids: HashSet::new(), liked_ids: HashSet::new(),
disliked_ids: HashSet::new(), disliked_ids: HashSet::new(),
@ -787,9 +774,6 @@ impl AppState {
account, account,
landing, landing,
concerts: Vec::new(), concerts: Vec::new(),
concerts_loading: false,
non_music_sections: Vec::new(),
non_music_loading: false,
liked_tracks, liked_tracks,
liked_ids, liked_ids,
disliked_ids: HashSet::new(), disliked_ids: HashSet::new(),
@ -1305,16 +1289,9 @@ impl AppState {
let api = self.api.clone(); let api = self.api.clone();
let tx = self.tx_api.clone(); let tx = self.tx_api.clone();
self.runtime.spawn(async move { self.runtime.spawn(async move {
let concerts = api.fetch_concerts_feed().await.unwrap_or_default(); if let Ok(concerts) = api.fetch_concerts_feed().await {
let _ = tx.send(ApiEvent::ConcertsLoaded(concerts)); let _ = tx.send(ApiEvent::ConcertsLoaded(concerts));
}); }
}
{
let api = self.api.clone();
let tx = self.tx_api.clone();
self.runtime.spawn(async move {
let (sections, albums) = api.fetch_non_music_landing().await.unwrap_or_default();
let _ = tx.send(ApiEvent::NonMusicLoaded(sections, albums));
}); });
} }
{ {
@ -1660,53 +1637,12 @@ impl AppState {
} }
}); });
} }
Route::Concerts => {
self.detail_loading = false;
if self.concerts.is_empty() && !self.concerts_loading {
self.refresh_concerts();
}
}
Route::Podcasts => {
self.detail_loading = false;
if self.non_music_sections.is_empty() && !self.non_music_loading {
self.refresh_non_music();
}
}
_ => { _ => {
self.detail_loading = false; self.detail_loading = false;
} }
} }
} }
pub fn refresh_concerts(&mut self) {
self.concerts_loading = true;
let api = self.api.clone();
let tx = self.tx_api.clone();
self.runtime.spawn(async move {
let concerts = api.fetch_concerts_feed().await.unwrap_or_default();
let _ = tx.send(ApiEvent::ConcertsLoaded(concerts));
});
}
pub fn refresh_non_music(&mut self) {
self.non_music_loading = true;
let api = self.api.clone();
let tx = self.tx_api.clone();
self.runtime.spawn(async move {
let (sections, albums) = api.fetch_non_music_landing().await.unwrap_or_default();
let _ = tx.send(ApiEvent::NonMusicLoaded(sections, albums));
});
if self.api.has_token() {
let api = self.api.clone();
let tx = self.tx_api.clone();
self.runtime.spawn(async move {
if let Ok(shelf) = api.fetch_bookshelf_liked().await {
let _ = tx.send(ApiEvent::BookshelfLoaded(shelf));
}
});
}
}
pub fn launch_oauth_login(&mut self) { pub fn launch_oauth_login(&mut self) {
self.show_toast(self.i18n().toast_opening_oauth()); self.show_toast(self.i18n().toast_opening_oauth());
let tx = self.tx_api.clone(); let tx = self.tx_api.clone();
@ -1781,12 +1717,6 @@ impl AppState {
self.show_toast(t.toast_welcome(&acc.display_name)); self.show_toast(t.toast_welcome(&acc.display_name));
self.account = Some(acc); self.account = Some(acc);
self.ensure_words_for_current_track(); self.ensure_words_for_current_track();
if self.concerts.is_empty() && !self.concerts_loading {
self.refresh_concerts();
}
if self.non_music_sections.is_empty() && !self.non_music_loading {
self.refresh_non_music();
}
} }
ApiEvent::AccountLoaded(Err(e)) => { ApiEvent::AccountLoaded(Err(e)) => {
self.show_toast(if t.is_ru() { self.show_toast(if t.is_ru() {
@ -1796,19 +1726,7 @@ impl AppState {
}); });
} }
ApiEvent::ConcertsLoaded(concerts) => { ApiEvent::ConcertsLoaded(concerts) => {
self.concerts_loading = false; self.concerts = concerts;
if !concerts.is_empty() || self.concerts.is_empty() {
self.concerts = concerts;
}
}
ApiEvent::NonMusicLoaded(sections, albums) => {
self.non_music_loading = false;
if !sections.is_empty() {
self.non_music_sections = sections;
}
if !albums.is_empty() {
self.landing.podcasts = albums;
}
} }
ApiEvent::SearchHistoryLoaded(hist) => { ApiEvent::SearchHistoryLoaded(hist) => {
self.config.search_history = hist; self.config.search_history = hist;
@ -1859,10 +1777,6 @@ impl AppState {
self.queue_index = 0; self.queue_index = 0;
} }
} }
let mut data = data;
if data.podcasts.is_empty() && !self.landing.podcasts.is_empty() {
data.podcasts = self.landing.podcasts.clone();
}
self.landing = data; self.landing = data;
} }
ApiEvent::LikedTracksLoaded(tracks) => { ApiEvent::LikedTracksLoaded(tracks) => {
@ -2505,12 +2419,7 @@ impl AppState {
} }
AppAction::ActivateWheelItem(item) => self.activate_wheel_item(item), AppAction::ActivateWheelItem(item) => self.activate_wheel_item(item),
AppAction::ReshuffleWheel => self.reshuffle_wheel(), AppAction::ReshuffleWheel => self.reshuffle_wheel(),
AppAction::StartVibeBySeeds { title, seeds } AppAction::StartVibeBySeeds { title, seeds } => self.start_vibe_by_seeds(title, seeds),
| AppAction::StartVibeStation { title, seeds } => {
self.start_vibe_by_seeds(title, seeds);
}
AppAction::RefreshConcerts => self.refresh_concerts(),
AppAction::RefreshNonMusic => self.refresh_non_music(),
AppAction::ApplyVibeSettings { AppAction::ApplyVibeSettings {
mood, mood,
activity, activity,

View file

@ -135,8 +135,7 @@ fn build_window_attrs(init_w: f64, init_h: f64) -> WindowAttributes {
.with_inner_size(LogicalSize::new(init_w, init_h)) .with_inner_size(LogicalSize::new(init_w, init_h))
.with_min_inner_size(LogicalSize::new(768.0, 650.0)) .with_min_inner_size(LogicalSize::new(768.0, 650.0))
.with_decorations(false) // Custom frameless 32px Yandex TitleBar! .with_decorations(false) // Custom frameless 32px Yandex TitleBar!
.with_resizable(true) .with_resizable(true);
.with_visible(false); // Stay hidden until DWM + first pure-black/splash frame is presented!
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
{ {
use winit::platform::wayland::WindowAttributesExtWayland; use winit::platform::wayland::WindowAttributesExtWayland;
@ -629,17 +628,6 @@ impl ApplicationHandler for AppRunner {
self.window_focused = true; self.window_focused = true;
self.window_occluded = false; self.window_occluded = false;
self.last_frame_hash = None; self.last_frame_hash = None;
// Present the first theme-matched + splash frame into the swapchain BEFORE making the
// window visible so there is zero white OS/DWM flash on startup!
// (On Linux/Wayland where an unmapped window may report 0x0, skip pre-render and reveal.)
let init_size = window.inner_size();
if init_size.width > 0 && init_size.height > 0 {
self.render(event_loop);
self.last_frame_hash = None;
}
window.set_visible(true);
window.focus_window();
window.request_redraw(); window.request_redraw();
} }
@ -892,76 +880,6 @@ fn apply_win11_dwm_style(window: &Window, is_dark: bool) {
&round as *const _ as *const _, &round as *const _ as *const _,
std::mem::size_of::<u32>() as u32, std::mem::size_of::<u32>() as u32,
); );
// DWMWA_CAPTION_COLOR (35): pure black in dark mode, pure white in light mode
const DWMWA_CAPTION_COLOR: u32 = 35;
let caption_color: u32 = if is_dark { 0x0000_0000 } else { 0x00FF_FFFF };
DwmSetWindowAttribute(
hwnd,
DWMWA_CAPTION_COLOR,
&caption_color as *const _ as *const _,
std::mem::size_of::<u32>() as u32,
);
// Replace Win32 class background brush (BLACK_BRUSH=4 / WHITE_BRUSH=0) & prime
// the client backing surface so Win32 never flashes white before or during resize.
#[repr(C)]
struct WinRect {
left: i32,
top: i32,
right: i32,
bottom: i32,
}
#[link(name = "gdi32")]
extern "system" {
fn GetStockObject(i: i32) -> *mut std::ffi::c_void;
}
#[link(name = "user32")]
extern "system" {
#[cfg(target_pointer_width = "64")]
fn SetClassLongPtrW(
hwnd: *mut std::ffi::c_void,
index: i32,
new_long: isize,
) -> isize;
#[cfg(target_pointer_width = "32")]
fn SetClassLongW(
hwnd: *mut std::ffi::c_void,
index: i32,
new_long: i32,
) -> i32;
fn GetClientRect(hwnd: *mut std::ffi::c_void, rect: *mut WinRect) -> i32;
fn GetDC(hwnd: *mut std::ffi::c_void) -> *mut std::ffi::c_void;
fn FillRect(
hdc: *mut std::ffi::c_void,
rect: *const WinRect,
hbr: *mut std::ffi::c_void,
) -> i32;
fn ReleaseDC(hwnd: *mut std::ffi::c_void, hdc: *mut std::ffi::c_void) -> i32;
}
const WHITE_BRUSH: i32 = 0;
const BLACK_BRUSH: i32 = 4;
const GCLP_HBRBACKGROUND: i32 = -10;
let brush = GetStockObject(if is_dark { BLACK_BRUSH } else { WHITE_BRUSH });
if !brush.is_null() {
#[cfg(target_pointer_width = "64")]
SetClassLongPtrW(hwnd, GCLP_HBRBACKGROUND, brush as isize);
#[cfg(target_pointer_width = "32")]
SetClassLongW(hwnd, GCLP_HBRBACKGROUND, brush as i32);
let mut rc = WinRect {
left: 0,
top: 0,
right: 0,
bottom: 0,
};
if GetClientRect(hwnd, &mut rc) != 0 {
let hdc = GetDC(hwnd);
if !hdc.is_null() {
FillRect(hdc, &rc, brush);
ReleaseDC(hwnd, hdc);
}
}
}
} }
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,3 @@
use std::cell::Cell;
use crate::api::models::{NewReleaseItem, VibePickItem, VibePickTab};
use crate::app::state::{AppAction, AppState, CollectionTab, ForYouTab, Route}; use crate::app::state::{AppAction, AppState, CollectionTab, ForYouTab, Route};
use crate::covers::CoverCache; use crate::covers::CoverCache;
use crate::engine::input::WidgetId; use crate::engine::input::WidgetId;
@ -12,11 +9,7 @@ use crate::engine::widgets::{
}; };
use crate::engine::UiContext; use crate::engine::UiContext;
use crate::icons::Icon; use crate::icons::Icon;
use crate::views::overlays::{EntityContextMenuState, ShellUiState}; use crate::views::overlays::ShellUiState;
thread_local! {
static FOR_YOU_PICKS_TAB: Cell<usize> = const { Cell::new(0) };
}
/// Exact Yandex Music Desktop 5.129.0 "For you and Trends" page (`vibe_wheel_foryou_spec.md` §4): /// Exact Yandex Music Desktop 5.129.0 "For you and Trends" page (`vibe_wheel_foryou_spec.md` §4):
/// - Persistent heading ("Для вас и Тренды" / "For you and Trends") + IN-PLACE switcher tabs ("Для вас" / "Тренды") /// - Persistent heading ("Для вас и Тренды" / "For you and Trends") + IN-PLACE switcher tabs ("Для вас" / "Тренды")
@ -503,15 +496,10 @@ pub fn render_for_you(
y += card_h + 26.0; y += card_h + 26.0;
} }
// 5. "New Releases >" (1-to-1 official `NewRelease` + `NewReleaseCard` circular portrait + colored release card!) // 5. "New Releases"
if !app.landing.rich_new_releases.is_empty() || !app.landing.new_releases.is_empty() { if !app.landing.new_releases.is_empty() {
y = render_new_releases_carousel( y = render_new_releases_carousel(ctx, pal, covers, app, x, y, avail_w, "fy_rel", actions);
ctx, pal, covers, app, shell, rect, x, y, avail_w, "fy_rel", actions,
);
} }
// 6. Official "More Picks" / "Ещё подборки" (`Waves` / `SETS_BY_WAVES`)
y = render_more_picks_section(ctx, pal, app, rect, x, y, avail_w, actions);
} }
ForYouTab::Trends => { ForYouTab::Trends => {
@ -618,14 +606,12 @@ pub fn render_for_you(
} }
// 2. New Releases Carousel // 2. New Releases Carousel
if !app.landing.rich_new_releases.is_empty() || !app.landing.new_releases.is_empty() { if !app.landing.new_releases.is_empty() {
y = render_new_releases_carousel( y = render_new_releases_carousel(
ctx, ctx,
pal, pal,
covers, covers,
app, app,
shell,
rect,
x, x,
y, y,
avail_w, avail_w,
@ -692,162 +678,9 @@ pub fn render_for_you(
} }
y += 20.0; y += 20.0;
let _ = CornerRadii::ZERO;
let total_h = y - (rect.top() - scroll_y); let total_h = y - (rect.top() - scroll_y);
ctx.end_scroll_v(scroll_id, pal, total_h, true); ctx.end_scroll_v(scroll_id, pal, total_h, true);
// Sticky Frosted Top Switcher Bar when scrolled (`scroll_y > 72.0` -> zero impact on `scroll_y == 0` parity!)
if scroll_y > 72.0 {
let fade_in = ((scroll_y - 72.0) / 36.0).clamp(0.0, 1.0);
let bar_r = Rect::from_xywh(
rect.left() - 25.0,
rect.top() - 12.0,
rect.width() + 50.0,
66.0,
);
// Subtle atmospheric gradient glow behind the frosted sticky bar
let glow_c = if pal.is_dark {
Color::rgb(0x4E, 0x35, 0x62)
} else {
Color::rgb(0xD8, 0xD2, 0xE8)
};
ctx.dl().push_gradient_rect(
bar_r,
CornerRadii::top(12.0),
glow_c.with_alpha((54.0 * fade_in).round() as u8),
glow_c.with_alpha(0),
Vec2::new(0.0, 1.0),
);
let glass_tint = if pal.is_dark {
css_rgba(18, 18, 18, (186.0 * fade_in).round() as u8)
} else {
css_rgba(255, 255, 255, (206.0 * fade_in).round() as u8)
};
ctx.dl().push_backdrop_blur(
bar_r,
CornerRadii::top(12.0),
2.0,
glass_tint,
0.0,
Color::TRANSPARENT,
);
ctx.dl().push_rect(
Rect::from_xywh(bar_r.left(), bar_r.bottom() - 1.0, bar_r.width(), 1.0),
0.0,
pal.border_subtle.scale_alpha(fade_in),
);
let mut sx = x;
let sy = bar_r.center_y() - 19.0;
for (tab_kind, label) in [
(ForYouTab::ForYou, t.for_you()),
(ForYouTab::Trends, t.trends()),
] {
let active = app.for_you_tab == tab_kind;
let tw = ctx
.measure_text(label, TextStyle::bold(14.5, pal.text_primary), None)
.x
+ 32.0;
let pr = Rect::from_xywh(sx, sy, tw.max(88.0), 38.0);
let resp = ctx.interact(WidgetId::from_pair("fy_sticky_tab", tab_kind as u8), pr);
if active || resp.hovered {
ctx.dl().push_rect(
pr,
19.0,
if active {
pal.surface_hover
} else {
pal.surface_secondary
},
);
}
ctx.draw_text_ellipsis(
label,
TextStyle::bold(
14.5,
if active || resp.hovered {
pal.text_bright
} else {
pal.text_secondary
},
),
pr,
TextAlign::Center,
);
if resp.hovered {
ctx.set_cursor(CursorKind::Pointer);
}
if resp.clicked && !active {
actions.push(AppAction::SetForYouTab(tab_kind));
}
sx = pr.right() + 8.0;
}
}
}
fn rich_dark_tint(raw: Color) -> Color {
// Rich dark-saturated card tint (~24% lightness) keeping high contrast for white album text
let r = (raw.r as f32 / 255.0).clamp(0.0, 1.0);
let g = (raw.g as f32 / 255.0).clamp(0.0, 1.0);
let b = (raw.b as f32 / 255.0).clamp(0.0, 1.0);
let max_c = r.max(g).max(b);
let min_c = r.min(g).min(b);
let avg = (max_c + min_c) * 0.5;
// Slightly boost chroma then scale luminance into ~0.22..0.28 range
let sat_r = (avg + (r - avg) * 1.25).clamp(0.0, 1.0);
let sat_g = (avg + (g - avg) * 1.25).clamp(0.0, 1.0);
let sat_b = (avg + (b - avg) * 1.25).clamp(0.0, 1.0);
let luma = (0.299 * sat_r + 0.587 * sat_g + 0.114 * sat_b).max(0.01);
let scale = (0.24 / luma).clamp(0.28, 0.95);
Color::rgb(
((sat_r * scale).clamp(0.08, 0.48) * 255.0).round() as u8,
((sat_g * scale).clamp(0.08, 0.48) * 255.0).round() as u8,
((sat_b * scale).clamp(0.08, 0.48) * 255.0).round() as u8,
)
}
fn format_release_subtitle(item: &NewReleaseItem, ru: bool) -> String {
let is_single = item
.album
.content_type
.as_deref()
.map_or(false, |ct| ct.eq_ignore_ascii_case("single"))
|| (item.album.track_count > 0 && item.album.track_count <= 3);
let kind = if is_single {
if ru { "сингл" } else { "single" }
} else if ru {
"альбом"
} else {
"album"
};
if let Some(ref rd) = item.release_date {
let date_part = rd.split('T').next().unwrap_or(rd);
let parts: Vec<&str> = date_part.split('-').collect();
if parts.len() >= 3 {
if let (Ok(m), Ok(d)) = (parts[1].parse::<usize>(), parts[2].parse::<u32>()) {
if (1..=12).contains(&m) && d > 0 {
const MONTHS_RU: [&str; 12] = [
"января", "февраля", "марта", "апреля", "мая", "июня", "июля", "августа",
"сентября", "октября", "ноября", "декабря",
];
const MONTHS_EN: [&str; 12] = [
"January", "February", "March", "April", "May", "June", "July", "August",
"September", "October", "November", "December",
];
return if ru {
format!("{} · {} {}", kind, d, MONTHS_RU[m - 1])
} else {
format!("{} · {} {}", kind, MONTHS_EN[m - 1], d)
};
}
}
}
}
if let Some(yr) = item.album.year {
format!("{} · {}", kind, yr)
} else {
kind.to_string()
}
} }
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
@ -856,8 +689,6 @@ fn render_new_releases_carousel(
pal: &YmPalette, pal: &YmPalette,
covers: &mut CoverCache, covers: &mut CoverCache,
app: &AppState, app: &AppState,
shell: &mut ShellUiState,
viewport: Rect,
x: f32, x: f32,
mut y: f32, mut y: f32,
avail_w: f32, avail_w: f32,
@ -865,589 +696,58 @@ fn render_new_releases_carousel(
actions: &mut Vec<AppAction>, actions: &mut Vec<AppAction>,
) -> f32 { ) -> f32 {
let t = app.i18n(); let t = app.i18n();
let ru = t.is_ru();
let items: Vec<NewReleaseItem> = if !app.landing.rich_new_releases.is_empty() {
app.landing.rich_new_releases.clone()
} else {
app.landing
.new_releases
.iter()
.cloned()
.map(|album| NewReleaseItem {
artist_cover_uri: album.artists.first().and_then(|a| a.cover_uri.clone()),
cover_color: None,
release_date: None,
album,
})
.collect()
};
if items.is_empty() {
return y;
}
let h_id = WidgetId::new(salt);
let card_w = 286.0_f32;
let gap = 18.0_f32;
let portrait_d = 236.0_f32;
let overlap = 56.0_f32;
let bottom_h = 80.0_f32;
let card_h = portrait_d - overlap + bottom_h; // 260.0
let total_w = items.len() as f32 * (card_w + gap);
// Header row: "New Releases >" + circular `<` `>` carousel arrows on right
let head_txt = t.new_releases();
let head_tw = ctx
.measure_text(head_txt, TextStyle::headline(24.0, pal.text_primary), None)
.x;
ctx.draw_text_ellipsis( ctx.draw_text_ellipsis(
head_txt, t.new_releases(),
TextStyle::headline(24.0, pal.text_primary),
Rect::from_xywh(x, y, head_tw + 4.0, 30.0),
TextAlign::Left,
);
ctx.draw_icon(
Icon::ArrowRight,
Rect::from_center_size(Pos2::new(x + head_tw + 16.0, y + 15.0), Vec2::splat(22.0)),
pal.text_secondary,
);
let (can_left, can_right) = ctx
.scrolls
.get(h_id)
.map(|s| (s.can_scroll_left(), s.can_scroll_right()))
.unwrap_or((false, total_w > avail_w + 10.0));
let l_btn_c = Pos2::new(x + avail_w - 54.0, y + 15.0);
let r_btn_c = Pos2::new(x + avail_w - 16.0, y + 15.0);
for (c, ic, enabled, is_right) in [
(l_btn_c, Icon::ArrowLeftXxs, can_left, false),
(r_btn_c, Icon::ArrowRightXxs, can_right, true),
] {
let br = Rect::from_center_size(c, Vec2::splat(32.0));
let resp = ctx.interact(WidgetId::from_pair(salt, if is_right { "next" } else { "prev" }), br);
let bg = if enabled && resp.hovered {
pal.surface_hover
} else {
pal.surface_secondary
};
ctx.dl().push_circle(c, 16.0, bg);
ctx.draw_icon(
ic,
Rect::from_center_size(c, Vec2::splat(18.0)),
if enabled {
if resp.hovered { pal.text_bright } else { pal.text_primary }
} else {
pal.text_disabled
},
);
if enabled && resp.hovered {
ctx.set_cursor(CursorKind::Pointer);
}
if enabled && resp.clicked {
let delta = if is_right { (card_w + gap) * 2.0 } else { -(card_w + gap) * 2.0 };
ctx.scrolls.scroll_by_x(h_id, delta);
ctx.request_repaint();
}
}
y += 42.0;
let row_vp = Rect::from_xywh(x, y, avail_w, card_h);
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 {
let alb = &item.album;
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
let circle_r = Rect::from_xywh(
cx + (card_w - portrait_d) * 0.5,
y,
portrait_d,
portrait_d,
);
let portrait_uri = item
.artist_cover_uri
.as_deref()
.or(alb.cover_uri.as_deref());
let (portrait_dom, _) = draw_cover_art(
ctx,
pal,
covers,
circle_r,
portrait_uri,
&format!("nr_art_{}", alb.id),
portrait_d * 0.5,
true,
false,
);
// Resolve rich dark-saturated tint from `cover_color` or cover dominant color
let raw_tint = item
.cover_color
.as_deref()
.and_then(Color::from_hex_str)
.or_else(|| {
alb.cover_uri
.as_deref()
.and_then(|u| covers.get_or_fetch(u, 200))
.map(|(_, dom, _)| dom)
})
.unwrap_or(portrait_dom);
let card_tint = rich_dark_tint(raw_tint);
// Smooth lower gradient fade over lower 42% of circular portrait
ctx.push_clip(circle_r, portrait_d * 0.5);
let scrim_h = portrait_d * 0.46;
ctx.dl().push_gradient_rect(
Rect::from_xywh(circle_r.left(), circle_r.bottom() - scrim_h, portrait_d, scrim_h),
0.0,
card_tint.with_alpha(0),
card_tint.with_alpha(232),
Vec2::new(0.0, 1.0),
);
ctx.pop_clip();
// Bold white centered Artist Name above the card overlap
let artist_name = alb
.artists
.first()
.map(|a| a.name.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,
portrait_d - 36.0,
50.0,
);
ctx.draw_text_wrapped(
artist_name,
TextStyle::headline(21.0, Color::WHITE).with_line_height(24.0),
art_lbl_r,
Some(2),
TextAlign::Center,
);
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);
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_bg = if card_resp.hovered {
card_tint.lerp(Color::WHITE, 0.08)
} else {
card_tint
};
ctx.dl().push_shadow(
card_r,
14.0,
12.0,
0.0,
Vec2::new(0.0, 4.0),
css_rgba(0, 0, 0, 72),
);
ctx.dl().push_rect_bordered(
card_r,
14.0,
card_bg,
1.0,
css_rgba(255, 255, 255, 26),
);
// Left 62x62 rounded (8px) album cover
let cov_r = Rect::from_xywh(card_r.left() + 9.0, card_r.top() + 9.0, 62.0, 62.0);
draw_cover_art(
ctx,
pal,
covers,
cov_r,
alb.cover_uri.as_deref(),
&format!("nr_alb_{}", alb.id),
8.0,
false,
false,
);
// 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_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));
ctx.draw_icon(
if alb_playing {
Icon::PauseFilledXs
} else {
Icon::PlayFilledXs
},
Rect::from_center_size(play_c, Vec2::splat(18.0)),
Color::rgb(0x14, 0x14, 0x14),
);
// Middle bold white title + muted release subtitle
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,
TextStyle::bold(14.5, Color::WHITE),
Rect::from_xywh(tx_l, card_r.top() + 18.0, tx_w, 20.0),
TextAlign::Left,
);
let sub = format_release_subtitle(item, ru);
ctx.draw_text_ellipsis(
&sub,
TextStyle::medium(12.5, css_rgba(255, 255, 255, 172)),
Rect::from_xywh(tx_l, card_r.top() + 42.0, tx_w, 18.0),
TextAlign::Left,
);
if play_resp.hovered || card_resp.hovered {
ctx.set_cursor(CursorKind::Pointer);
}
if card_resp.right_clicked {
let pos = ctx
.input
.pointer_pos
.unwrap_or(Pos2::new(card_r.center_x(), card_r.bottom()));
shell.open_entity_menu(EntityContextMenuState {
kind: "album".into(),
id: alb.id.clone(),
title: alb.title.clone(),
subtitle: sub,
cover_uri: alb.cover_uri.clone(),
owner_uid: None,
is_own_playlist: false,
tracks: Vec::new(),
anchor: pos,
share_url: format!("https://music.yandex.ru/album/{}", alb.id),
});
} else if play_resp.clicked {
actions.push(AppAction::PlayAlbum {
id: alb.id.clone(),
title: alb.title.clone(),
});
} else if card_resp.clicked {
actions.push(AppAction::Navigate(Route::Album {
id: alb.id.clone(),
title: alb.title.clone(),
}));
} else if port_resp.clicked {
if let Some(first) = alb.artists.first() {
actions.push(AppAction::Navigate(Route::Artist {
id: first.id.clone(),
name: first.name.clone(),
}));
} else {
actions.push(AppAction::Navigate(Route::Album {
id: alb.id.clone(),
title: alb.title.clone(),
}));
}
}
}
cx += card_w + gap;
}
ctx.end_scroll_h(h_id, pal, total_w, false);
}
y + card_h + 34.0
}
fn fallback_vibe_pick_tabs(ru: bool) -> Vec<VibePickTab> {
let mk = |title: &str, header: &str, seed: &str, hex: &str| VibePickItem {
title: title.into(),
header: header.into(),
seeds: vec![seed.into()],
color_hex: Some(hex.into()),
background_image_url: None,
image_url: None,
};
if ru {
vec![
VibePickTab {
title: "топ".into(),
items: vec![
mk("Английский", "Моя волна по языку", "language:english", "#3F68F9"),
mk("Электроника", "Моя волна по жанру", "genre:electronics", "#8341EF"),
mk("Бодрое", "Моя волна по настроению", "mood:energetic", "#FF5C4D"),
mk("Для работы", "Моя волна по занятию", "activity:work", "#0D9488"),
mk("Незнакомое", "Моя волна по характеру", "diversity:discover", "#D97706"),
],
},
VibePickTab {
title: "по языку".into(),
items: vec![
mk("Английский", "Моя волна по языку", "language:english", "#3F68F9"),
mk("Русский", "Моя волна по языку", "language:russian", "#E11D48"),
mk("Без слов", "Моя волна по языку", "language:without-words", "#0F766E"),
],
},
VibePickTab {
title: "по жанру".into(),
items: vec![
mk("Электроника", "Моя волна по жанру", "genre:electronics", "#7C3AED"),
mk("Хип-хоп", "Моя волна по жанру", "genre:hiphop", "#EA580C"),
mk("Рок", "Моя волна по жанру", "genre:rock", "#DC2626"),
mk("Поп", "Моя волна по жанру", "genre:pop", "#DB2777"),
],
},
VibePickTab {
title: "по настроению".into(),
items: vec![
mk("Бодрое", "Моя волна по настроению", "mood:energetic", "#F97316"),
mk("Спокойное", "Моя волна по настроению", "mood:calm", "#2563EB"),
mk("Весёлое", "Моя волна по настроению", "mood:fun", "#EAB308"),
],
},
VibePickTab {
title: "по занятию".into(),
items: vec![
mk("Для работы", "Моя волна по занятию", "activity:work", "#0D9488"),
mk("Тренировка", "Моя волна по занятию", "activity:workout", "#E11D48"),
mk("В дорогу", "Моя волна по занятию", "activity:road-trip", "#4F46E5"),
],
},
VibePickTab {
title: "по характеру".into(),
items: vec![
mk("Незнакомое", "Моя волна по характеру", "diversity:discover", "#8B5CF6"),
mk("Любимое", "Моя волна по характеру", "diversity:favorite", "#EC4899"),
mk("Популярное", "Моя волна по характеру", "diversity:popular", "#059669"),
],
},
]
} else {
vec![
VibePickTab {
title: "top".into(),
items: vec![
mk("English", "My Vibe by language", "language:english", "#3F68F9"),
mk("Electronic", "My Vibe by genre", "genre:electronics", "#8341EF"),
mk("Energetic", "My Vibe by mood", "mood:energetic", "#FF5C4D"),
mk("Focus & Work", "My Vibe by activity", "activity:work", "#0D9488"),
mk("Discover", "My Vibe by character", "diversity:discover", "#D97706"),
],
},
VibePickTab {
title: "by language".into(),
items: vec![
mk("English", "My Vibe by language", "language:english", "#3F68F9"),
mk("Russian", "My Vibe by language", "language:russian", "#E11D48"),
mk("Instrumental", "My Vibe by language", "language:without-words", "#0F766E"),
],
},
VibePickTab {
title: "by genre".into(),
items: vec![
mk("Electronic", "My Vibe by genre", "genre:electronics", "#7C3AED"),
mk("Hip-Hop", "My Vibe by genre", "genre:hiphop", "#EA580C"),
mk("Rock", "My Vibe by genre", "genre:rock", "#DC2626"),
mk("Pop", "My Vibe by genre", "genre:pop", "#DB2777"),
],
},
VibePickTab {
title: "by mood".into(),
items: vec![
mk("Energetic", "My Vibe by mood", "mood:energetic", "#F97316"),
mk("Calm", "My Vibe by mood", "mood:calm", "#2563EB"),
mk("Upbeat", "My Vibe by mood", "mood:fun", "#EAB308"),
],
},
VibePickTab {
title: "by activity".into(),
items: vec![
mk("Work", "My Vibe by activity", "activity:work", "#0D9488"),
mk("Workout", "My Vibe by activity", "activity:workout", "#E11D48"),
mk("Road trip", "My Vibe by activity", "activity:road-trip", "#4F46E5"),
],
},
VibePickTab {
title: "by character".into(),
items: vec![
mk("Discover", "My Vibe by character", "diversity:discover", "#8B5CF6"),
mk("Favorites", "My Vibe by character", "diversity:favorite", "#EC4899"),
mk("Popular", "My Vibe by character", "diversity:popular", "#059669"),
],
},
]
}
}
#[allow(clippy::too_many_arguments)]
fn render_more_picks_section(
ctx: &mut UiContext,
pal: &YmPalette,
app: &AppState,
viewport: Rect,
x: f32,
mut y: f32,
avail_w: f32,
actions: &mut Vec<AppAction>,
) -> f32 {
let ru = app.i18n().is_ru();
let tabs: Vec<VibePickTab> = if !app.landing.vibe_pick_tabs.is_empty() {
app.landing.vibe_pick_tabs.clone()
} else {
fallback_vibe_pick_tabs(ru)
};
if tabs.is_empty() {
return y;
}
ctx.draw_text_ellipsis(
if ru { "Ещё подборки" } else { "More Picks" },
TextStyle::headline(24.0, pal.text_primary), TextStyle::headline(24.0, pal.text_primary),
Rect::from_xywh(x, y, avail_w, 30.0), Rect::from_xywh(x, y, avail_w, 30.0),
TextAlign::Left, TextAlign::Left,
); );
y += 40.0; y += 40.0;
let active_idx = FOR_YOU_PICKS_TAB.with(|c| c.get()).min(tabs.len() - 1); let card_w = 164.0;
let card_h = card_w + 54.0;
// Horizontal category filter tabs (`32px` active pill, clean secondary text inactive)
let tabs_vp = Rect::from_xywh(x, y, avail_w, 34.0);
let tabs_h_id = WidgetId::new("fy_picks_tabs_hscroll");
let tabs_sx = ctx.begin_scroll_h(tabs_h_id, tabs_vp, 0.0);
let mut tx = x - tabs_sx;
for (idx, tab) in tabs.iter().enumerate() {
let is_act = idx == active_idx;
let style = TextStyle::medium(
14.0,
if is_act { pal.text_bright } else { pal.text_secondary },
);
let tw = ctx.measure_text(&tab.title, style, None).x + 24.0;
let tr = Rect::from_xywh(tx, y, tw.max(52.0), 32.0);
let resp = ctx.interact(WidgetId::from_pair("fy_pick_tab", idx), tr);
if is_act {
ctx.dl().push_rect(tr, 16.0, pal.surface_hover);
} else if resp.hovered {
ctx.dl().push_rect(tr, 16.0, pal.surface_secondary);
}
ctx.draw_text_ellipsis(
&tab.title,
TextStyle::medium(
14.0,
if is_act || resp.hovered {
pal.text_bright
} else {
pal.text_secondary
},
),
tr,
TextAlign::Center,
);
if resp.hovered {
ctx.set_cursor(CursorKind::Pointer);
}
if resp.clicked {
FOR_YOU_PICKS_TAB.with(|c| c.set(idx));
}
tx = tr.right() + 8.0;
}
ctx.end_scroll_h(tabs_h_id, pal, (tx + tabs_sx) - x, false);
y += 46.0;
// Vibrant gradient-tinted glossy Vibe-Station cards (`260x70`, `radius: 16px`)
const CURATED_PALETTE: &[Color] = &[
Color::rgb(0x3F, 0x68, 0xF9),
Color::rgb(0x83, 0x41, 0xEF),
Color::rgb(0xE1, 0x3A, 0x52),
Color::rgb(0x0D, 0x94, 0x88),
Color::rgb(0xD9, 0x77, 0x06),
Color::rgb(0xDB, 0x27, 0x77),
];
let card_w = 260.0_f32;
let card_h = 70.0_f32;
let gap = 14.0_f32;
let row_vp = Rect::from_xywh(x, y, avail_w, card_h); let row_vp = Rect::from_xywh(x, y, avail_w, card_h);
let items = &tabs[active_idx].items; let h_id = WidgetId::new(salt);
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 h_id = WidgetId::from_pair("fy_picks_cards", active_idx);
let sx = ctx.begin_scroll_h(h_id, row_vp, 0.0);
let mut cx = x - sx;
for (idx, item) in items.iter().enumerate() {
let cr = Rect::from_xywh(cx, y, card_w, card_h);
if cr.right() >= row_vp.left() - 60.0 && cr.left() <= row_vp.right() + 60.0 {
let resp = ctx.interact(WidgetId::from_pair("fy_pick_card", (active_idx, idx)), cr);
let base_c = item
.color_hex
.as_deref()
.and_then(Color::from_hex_str)
.unwrap_or(CURATED_PALETTE[idx % CURATED_PALETTE.len()]);
let c_left = base_c.lerp(Color::BLACK, if resp.hovered { 0.14 } else { 0.24 });
let c_right = base_c.lerp(Color::BLACK, if resp.hovered { 0.36 } else { 0.48 });
ctx.dl()
.push_gradient_rect(cr, 16.0, c_left, c_right, Vec2::new(1.0, 0.4));
// Subtle glossy top sheen
ctx.dl().push_gradient_rect(
Rect::from_xywh(cr.left(), cr.top(), cr.width(), cr.height() * 0.48),
CornerRadii::top(16.0),
css_rgba(255, 255, 255, if resp.hovered { 42 } else { 28 }),
css_rgba(255, 255, 255, 0),
Vec2::new(0.0, 1.0),
);
ctx.dl().push_rect_bordered(
cr,
16.0,
Color::TRANSPARENT,
1.0,
css_rgba(255, 255, 255, 28),
);
// Eyebrow ("Моя волна по языку" / "My Vibe by language") let releases = app.landing.new_releases.clone();
if !item.header.is_empty() { let mut cx = x - scroll_x;
ctx.draw_text_ellipsis( for alb in &releases {
&item.header, let cr = Rect::from_xywh(cx, y, card_w, card_h);
TextStyle::medium(12.0, css_rgba(255, 255, 255, 196)), if cr.right() >= row_vp.left() - 20.0 && cr.left() <= row_vp.right() + 20.0 {
Rect::from_xywh(cr.left() + 14.0, cr.top() + 13.0, cr.width() - 28.0, 16.0), let art = alb
TextAlign::Center, .artists
); .first()
} .map(|a| a.name.as_str())
.unwrap_or(t.album());
// Centered bold white `▶` + station title (`17px` Headline) let m = media_card(
let title_style = TextStyle::headline(17.0, Color::WHITE); ctx,
let tw = ctx pal,
.measure_text(&item.title, title_style, None) covers,
.x WidgetId::from_pair(salt, &alb.id),
.min(cr.width() - 52.0); cr,
let inner_w = 16.0 + 6.0 + tw; &alb.title,
let tx_start = cr.center_x() - inner_w * 0.5; art,
let row_y = if item.header.is_empty() { alb.cover_uri.as_deref(),
cr.center_y() &format!("alb_{}", alb.id),
} else { false,
cr.top() + 45.0 false,
}; );
ctx.draw_icon( if m.play_clicked {
Icon::PlayFilledXs, actions.push(AppAction::PlayAlbum {
Rect::from_center_size(Pos2::new(tx_start + 8.0, row_y), Vec2::splat(14.0)), id: alb.id.clone(),
Color::WHITE, title: alb.title.clone(),
); });
ctx.draw_text_ellipsis( } else if m.clicked {
&item.title, actions.push(AppAction::Navigate(Route::Album {
title_style, id: alb.id.clone(),
Rect::from_xywh(tx_start + 22.0, row_y - 11.0, tw + 4.0, 22.0), title: alb.title.clone(),
TextAlign::Left, }));
);
if resp.hovered {
ctx.set_cursor(CursorKind::Pointer);
}
if resp.clicked && !item.seeds.is_empty() {
actions.push(AppAction::StartVibeBySeeds {
title: item.title.clone(),
seeds: item.seeds.clone(),
});
}
} }
cx += card_w + gap;
} }
ctx.end_scroll_h(h_id, pal, items.len() as f32 * (card_w + gap), false); cx += card_w + 16.0;
} }
let total_w = (releases.len() as f32) * (card_w + 16.0);
ctx.end_scroll_h(h_id, pal, total_w, false);
y + card_h + 26.0 y + card_h + 26.0
} }

View file

@ -14,8 +14,8 @@ use crate::engine::types::{
css_rgba, Color, CornerRadii, CursorKind, Pos2, Rect, Vec2, VIBE_TEXTURE_ID, css_rgba, Color, CornerRadii, CursorKind, Pos2, Rect, Vec2, VIBE_TEXTURE_ID,
}; };
use crate::engine::widgets::{ use crate::engine::widgets::{
draw_cover_art, ym_menu_divider, ym_menu_frame, ym_menu_item, ym_menu_item_ex, draw_cover_art, secondary_pill_button, ym_menu_divider, ym_menu_frame, ym_menu_item,
ym_volume_capsule, ym_menu_item_ex, ym_volume_capsule,
}; };
use crate::engine::UiContext; use crate::engine::UiContext;
use crate::icons::Icon; use crate::icons::Icon;
@ -1504,7 +1504,7 @@ pub fn render_my_vibe(
// 13. OFFICIAL 5.129.0 `WordsCardFullscreen` (`ZLayer::Modal` when `app.words_big_card_open`) // 13. OFFICIAL 5.129.0 `WordsCardFullscreen` (`ZLayer::Modal` when `app.words_big_card_open`)
if app.words_big_card_open { if app.words_big_card_open {
render_words_card_fullscreen(ctx, pal, covers, app, ru, active_words_card.as_ref(), actions); render_words_card_fullscreen(ctx, pal, app, ru, active_words_card.as_ref(), actions);
} }
} }
@ -1664,7 +1664,6 @@ fn render_words_card_popover(
fn render_words_card_fullscreen( fn render_words_card_fullscreen(
ctx: &mut UiContext, ctx: &mut UiContext,
pal: &YmPalette, pal: &YmPalette,
covers: &mut CoverCache,
app: &AppState, app: &AppState,
ru: bool, ru: bool,
fallback_card: Option<&WordsCard>, fallback_card: Option<&WordsCard>,
@ -1715,21 +1714,31 @@ fn render_words_card_fullscreen(
should_close = true; should_close = true;
} }
let col_w = (screen.width() - 96.0).clamp(300.0, 560.0); let col_w = (screen.width() - 96.0).clamp(300.0, 540.0);
let col_x = screen.center_x() - col_w * 0.5; let modal_h = (screen.height() - 140.0).clamp(320.0, 580.0);
let disclaimer = if ru { let content_rect = Rect::from_center_size(screen.center(), Vec2::new(col_w + 48.0, modal_h));
"AI может ошибаться, проверяйте важное" let col_x = content_rect.center_x() - col_w * 0.5;
} else { let mut y = content_rect.top() + 18.0;
"AI may make mistakes, be sure to double-check important information"
}; // Top AI sparkle badge with soft meteor glow
let disclaimer_y = screen.bottom() - 38.0; let sp_c = Pos2::new(content_rect.center_x(), y + 20.0);
let content_rect = Rect::from_min_max( let meteor_tex = ctx.icons.get_official_meteor_glow(&mut ctx.textures);
Pos2::new(col_x - 24.0, screen.top() + 92.0), let badge_tl = Pos2::new(sp_c.x - 24.0, sp_c.y - 24.0);
Pos2::new(col_x + col_w + 24.0, disclaimer_y - 12.0), ctx.dl().push_image(
Rect::from_xywh(badge_tl.x - 180.0 * 0.25, badge_tl.y - 180.0 * 0.43, 180.0, 180.0),
meteor_tex,
0.0,
Color::WHITE.with_alpha(150),
); );
ctx.draw_icon(
Icon::AiSparkles,
Rect::from_center_size(sp_c, Vec2::splat(28.0)),
pal.text_bright,
);
y += 64.0;
if app.words_big_card_loading { if app.words_big_card_loading {
// 3 subtle animated shimmer bars centered vertically while `POST /words/big-cards` loads // 3 subtle animated shimmer bars while `POST /words/big-cards` loads
let shimmer = 0.5 + 0.5 * ((ctx.input.time as f32) * 3.2).sin(); let shimmer = 0.5 + 0.5 * ((ctx.input.time as f32) * 3.2).sin();
let a = (28.0 + 36.0 * shimmer).round() as u8; let a = (28.0 + 36.0 * shimmer).round() as u8;
let bar_col = if pal.is_dark { let bar_col = if pal.is_dark {
@ -1737,12 +1746,11 @@ fn render_words_card_fullscreen(
} else { } else {
css_rgba(0, 0, 0, a) css_rgba(0, 0, 0, a)
}; };
let sy = content_rect.center_y() - 40.0;
for (i, frac) in [0.88_f32, 1.0_f32, 0.64_f32].iter().enumerate() { for (i, frac) in [0.88_f32, 1.0_f32, 0.64_f32].iter().enumerate() {
let bw = col_w * frac; let bw = col_w * frac;
let br = Rect::from_xywh( let br = Rect::from_xywh(
screen.center_x() - bw * 0.5, content_rect.center_x() - bw * 0.5,
sy + i as f32 * 30.0, y + i as f32 * 30.0,
bw, bw,
18.0, 18.0,
); );
@ -1765,170 +1773,107 @@ fn render_words_card_fullscreen(
.or_else(|| fallback_card.map(|c| c.actions.as_slice())) .or_else(|| fallback_card.map(|c| c.actions.as_slice()))
.unwrap_or(&[]); .unwrap_or(&[]);
let bottom_reserved = if sources.is_empty() { 104.0 } else { 154.0 };
let text_vp_h = (content_rect.bottom() - y - bottom_reserved).max(120.0);
let text_vp = Rect::from_xywh(col_x, y, col_w, text_vp_h);
let text_style = TextStyle::bold(20.0, pal.text_bright).with_line_height(28.0); let text_style = TextStyle::bold(20.0, pal.text_bright).with_line_height(28.0);
let measured = ctx.measure_text(full_text, text_style, Some(col_w)); let measured = ctx.measure_text(full_text, text_style, Some(col_w));
let src_count = sources.len().min(2);
let src_block_h = if src_count > 0 { let scroll_id = WidgetId::new("wcf_text_scroll");
28.0 + src_count as f32 * 46.0 - 8.0 let scroll_y = ctx.begin_scroll_v(scroll_id, text_vp, 0.0);
let ty = if measured.y < text_vp_h {
text_vp.center_y() - measured.y * 0.5
} else { } else {
0.0 text_vp.top() - scroll_y
}; };
let fb_block_h = if fallback_card.is_some() { 22.0 + 32.0 } else { 0.0 }; ctx.draw_text_wrapped(
let max_text_h = (content_rect.height() - src_block_h - fb_block_h - 16.0).max(110.0); full_text,
let used_text_h = measured.y.min(max_text_h); text_style,
let total_stack_h = used_text_h + src_block_h + fb_block_h; Rect::from_xywh(col_x, ty, col_w, measured.y + 12.0),
let mut y = (content_rect.center_y() - total_stack_h * 0.5).max(content_rect.top()); None,
TextAlign::Center,
);
ctx.end_scroll_v(scroll_id, pal, measured.y + 16.0, false);
y = text_vp.bottom() + 16.0;
// 1. Centered 20px bold story text (scrollable if longer than viewport, ZERO floating sparkle!) // Optional source link pills
let text_vp = Rect::from_xywh(col_x, y, col_w, used_text_h + 6.0); if !sources.is_empty() {
if measured.y > max_text_h { let mut sx = col_x;
let scroll_id = WidgetId::new("wcf_text_scroll"); let max_right = col_x + col_w;
let scroll_y = ctx.begin_scroll_v(scroll_id, text_vp, 0.0); for (idx, src) in sources.iter().take(4).enumerate() {
ctx.draw_text_wrapped( let est_w = (ctx
full_text, .measure_text(&src.title, TextStyle::medium(13.5, pal.text_primary), None)
text_style, .x
Rect::from_xywh(col_x, text_vp.top() - scroll_y, col_w, measured.y + 12.0), + 50.0)
None, .clamp(80.0, col_w);
TextAlign::Center, if sx + est_w > max_right && sx > col_x {
); break;
ctx.end_scroll_v(scroll_id, pal, measured.y + 16.0, false);
} else {
ctx.draw_text_wrapped(
full_text,
text_style,
Rect::from_xywh(col_x, y, col_w, measured.y + 12.0),
None,
TextAlign::Center,
);
}
y += used_text_h;
// 2. Centered full-width-fitted source/Alice glass pill(s) (28px below text, NEVER truncates!)
if src_count > 0 {
y += 28.0;
let max_pill_w = (screen.width() - 64.0).min(520.0);
for (idx, src) in sources.iter().take(src_count).enumerate() {
let lbl_style = TextStyle::medium(14.0, pal.text_bright);
let tw = ctx.measure_text(&src.title, lbl_style, None).x;
let pill_w = (tw + 54.0).clamp(160.0, max_pill_w);
let pill_r = Rect::from_xywh(
screen.center_x() - pill_w * 0.5,
y,
pill_w,
38.0,
);
let resp = ctx.interact(WidgetId::from_pair("wcf_src_pill", idx), pill_r);
let bg = if pal.is_dark {
css_rgba(255, 255, 255, if resp.hovered { 32 } else { 18 })
} else if resp.hovered {
pal.surface_hover
} else {
pal.surface_secondary
};
let border = if pal.is_dark {
css_rgba(255, 255, 255, 28)
} else {
pal.border_subtle
};
ctx.dl().push_rect_bordered(pill_r, 19.0, bg, 1.0, border);
// Left 18x18 icon: favicon_url -> Alice purple ring -> LinkRounded
let ic_center = Pos2::new(pill_r.left() + 22.0, pill_r.center_y());
let ic_rect = Rect::from_center_size(ic_center, Vec2::splat(18.0));
let mut drew_fav = false;
if let Some(ref fav) = src.favicon_url {
if let Some((tex_id, _, _)) = covers.get_or_fetch(fav, 64) {
ctx.dl().push_image(ic_rect, tex_id, 9.0, Color::WHITE);
drew_fav = true;
}
} }
if !drew_fav { let (resp, r) = secondary_pill_button(
let tl = src.title.to_lowercase(); ctx,
if tl.contains("алис") || tl.contains("alice") { pal,
ctx.dl() WidgetId::from_pair("wcf_src", idx),
.push_circle(ic_center, 9.0, Color::rgb(0x18, 0x13, 0x26)); Pos2::new(sx, y),
ctx.dl().push_circle_stroke( Some(Icon::LinkXxs),
ic_center,
8.0,
2.2,
Color::rgb(0x8B, 0x5C, 0xF6),
);
ctx.dl()
.push_circle(ic_center, 2.6, Color::rgb(0xC4, 0xB5, 0xFD));
} else {
ctx.draw_icon(
Icon::LinkRounded,
Rect::from_center_size(ic_center, Vec2::splat(16.0)),
pal.text_bright,
);
}
}
ctx.draw_text_ellipsis(
&src.title, &src.title,
lbl_style, 34.0,
Rect::from_xywh( false,
pill_r.left() + 38.0,
pill_r.top(),
(pill_r.width() - 52.0).max(40.0),
pill_r.height(),
),
TextAlign::Left,
); );
if resp.hovered {
ctx.set_cursor(CursorKind::Pointer);
}
if resp.clicked && !src.url.is_empty() { if resp.clicked && !src.url.is_empty() {
actions.push(AppAction::OpenUrl(src.url.clone())); actions.push(AppAction::OpenUrl(src.url.clone()));
} }
y += 46.0; sx = r.right() + 8.0;
} }
y -= 8.0; y += 46.0;
} }
// 3. BORDERLESS TEXT-ONLY feedback buttons (22px below source pill, 28px gap, ZERO boxes!) // Horizontal feedback bar: 👍 More similar replies | 1px divider | 👎 Not cool
if let Some(card) = fallback_card { if let Some(card) = fallback_card {
y += 22.0;
let like_lbl = if ru { let like_lbl = if ru {
"Больше такого" "Больше такого"
} else { } else {
"More similar replies" "More similar replies"
}; };
let dislike_lbl = if ru { "Мимо" } else { "Not cool" }; let dislike_lbl = if ru { "Мимо" } else { "Not cool" };
let muted = if pal.is_dark { let btn_h = 38.0;
css_rgba(255, 255, 255, 148) let like_w = (ctx
} else { .measure_text(like_lbl, TextStyle::medium(14.0, pal.text_primary), None)
pal.text_secondary .x
}; + 54.0)
let lbl_style = TextStyle::medium(14.0, muted); .max(120.0);
let like_tw = ctx.measure_text(like_lbl, lbl_style, None).x; let dislike_w = (ctx
let dislike_tw = ctx.measure_text(dislike_lbl, lbl_style, None).x; .measure_text(dislike_lbl, TextStyle::medium(14.0, pal.text_primary), None)
let like_w = 16.0 + 7.0 + like_tw + 8.0; .x
let dislike_w = 16.0 + 7.0 + dislike_tw + 8.0; + 54.0)
let gap = 28.0_f32; .max(100.0);
let total_w = like_w + gap + dislike_w; let bar_w = like_w + 25.0 + dislike_w;
let start_x = screen.center_x() - total_w * 0.5; let bar_x = content_rect.center_x() - bar_w * 0.5;
let btn_h = 32.0;
let like_r = Rect::from_xywh(start_x, y, like_w, btn_h); let like_r = Rect::from_xywh(bar_x, y, like_w, btn_h);
let like_resp = ctx.interact(WidgetId::new("wcf_like"), like_r); let like_resp = ctx.interact(WidgetId::new("wcf_like"), like_r);
ctx.dl().push_rect(
like_r,
19.0,
if like_resp.hovered || card.is_liked() {
pal.surface_hover
} else {
pal.surface_secondary
},
);
let like_fg = if card.is_liked() || like_resp.hovered { let like_fg = if card.is_liked() || like_resp.hovered {
pal.text_bright pal.text_bright
} else { } else {
muted pal.text_primary
}; };
ctx.draw_icon( ctx.draw_icon(
Icon::ThumbUpXxs, Icon::ThumbUpXxs,
Rect::from_center_size( Rect::from_center_size(Pos2::new(like_r.left() + 22.0, like_r.center_y()), Vec2::splat(18.0)),
Pos2::new(like_r.left() + 10.0, like_r.center_y()),
Vec2::splat(16.0),
),
like_fg, like_fg,
); );
ctx.draw_text_ellipsis( ctx.draw_text_ellipsis(
like_lbl, like_lbl,
TextStyle::medium(14.0, like_fg), TextStyle::medium(14.0, like_fg),
Rect::from_xywh(like_r.left() + 24.0, like_r.top(), like_tw + 8.0, btn_h), Rect::from_xywh(like_r.left() + 38.0, like_r.top(), like_r.width() - 48.0, like_r.height()),
TextAlign::Left, TextAlign::Left,
); );
if like_resp.hovered { if like_resp.hovered {
@ -1946,30 +1891,39 @@ fn render_words_card_fullscreen(
}); });
} }
let dislike_r = Rect::from_xywh(like_r.right() + gap, y, dislike_w, btn_h); // 1px vertical divider
let div_x = like_r.right() + 12.0;
ctx.dl().push_rect(
Rect::from_xywh(div_x, y + 7.0, 1.0, 24.0),
0.0,
pal.border_subtle,
);
let dislike_r = Rect::from_xywh(div_x + 13.0, y, dislike_w, btn_h);
let dislike_resp = ctx.interact(WidgetId::new("wcf_dislike"), dislike_r); let dislike_resp = ctx.interact(WidgetId::new("wcf_dislike"), dislike_r);
ctx.dl().push_rect(
dislike_r,
19.0,
if dislike_resp.hovered || card.is_disliked() {
pal.surface_hover
} else {
pal.surface_secondary
},
);
let dislike_fg = if card.is_disliked() || dislike_resp.hovered { let dislike_fg = if card.is_disliked() || dislike_resp.hovered {
pal.text_bright pal.text_bright
} else { } else {
muted pal.text_primary
}; };
ctx.draw_icon( ctx.draw_icon(
Icon::ThumbDownXxs, Icon::ThumbDownXxs,
Rect::from_center_size( Rect::from_center_size(Pos2::new(dislike_r.left() + 22.0, dislike_r.center_y()), Vec2::splat(18.0)),
Pos2::new(dislike_r.left() + 10.0, dislike_r.center_y()),
Vec2::splat(16.0),
),
dislike_fg, dislike_fg,
); );
ctx.draw_text_ellipsis( ctx.draw_text_ellipsis(
dislike_lbl, dislike_lbl,
TextStyle::medium(14.0, dislike_fg), TextStyle::medium(14.0, dislike_fg),
Rect::from_xywh( Rect::from_xywh(dislike_r.left() + 38.0, dislike_r.top(), dislike_r.width() - 48.0, dislike_r.height()),
dislike_r.left() + 24.0,
dislike_r.top(),
dislike_tw + 8.0,
btn_h,
),
TextAlign::Left, TextAlign::Left,
); );
if dislike_resp.hovered { if dislike_resp.hovered {
@ -1982,24 +1936,23 @@ fn render_words_card_fullscreen(
state: "dislike".into(), state: "dislike".into(),
}); });
} }
y += btn_h + 18.0;
} }
}
// 4. Disclaimer pinned cleanly near the bottom (`screen.bottom() - 32.0`) // Bottom AI disclaimer
let disc_col = if pal.is_dark { let disclaimer = if ru {
css_rgba(255, 255, 255, 96) "AI может ошибаться, проверяйте важное"
} else { } else {
pal.text_secondary "AI may make mistakes, be sure to double-check important information"
}; };
ctx.draw_text_ellipsis( ctx.draw_text_wrapped(
disclaimer, disclaimer,
TextStyle::regular(12.0, disc_col), TextStyle::regular(12.5, pal.text_secondary).with_line_height(17.0),
Rect::from_center_size( Rect::from_xywh(col_x, y, col_w, 36.0),
Pos2::new(screen.center_x(), screen.bottom() - 32.0), Some(2),
Vec2::new((screen.width() - 64.0).max(200.0), 22.0), TextAlign::Center,
), );
TextAlign::Center, }
);
if ctx.input.key_pressed(Key::Escape) if ctx.input.key_pressed(Key::Escape)
|| ctx.input.clicked_outside_any(&[content_rect, close_r]) || ctx.input.clicked_outside_any(&[content_rect, close_r])

File diff suppressed because it is too large Load diff

View file

@ -1863,384 +1863,3 @@ fn test_ext_16_yandex_id_popup_and_words_card_visual_parity() {
); );
} }
} }
#[test]
fn test_ext_17_for_you_collection_concerts_words_fullscreen() {
use yandex_music_rs::api::models::{
AlbumSummary, ConcertItem, NewReleaseItem, VibePickItem, VibePickTab, WordsBigCard,
WordsCard, WordsCardSource,
};
use yandex_music_rs::engine::WidgetId;
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. Official `For You` scrolled down: sticky frosted header + circular NewReleases + More Picks (`for_you_new_releases_picks.png`)
{
let mut shell = make_base_shell(
rt.handle().clone(),
vk.gpu_name.clone(),
Route::ForYou,
ThemeMode::Dark,
Language::En,
0.0,
);
let mk_album = |id: &str, title: &str, artist: &str| AlbumSummary {
id: id.into(),
title: title.into(),
year: Some(2026),
cover_uri: None,
artists: vec![ArtistSummary {
id: format!("art_{id}"),
name: artist.into(),
cover_uri: None,
genres: vec![],
}],
track_count: 12,
genre: Some("electronic".into()),
is_explicit: false,
content_type: Some("album".into()),
};
shell.app.landing.rich_new_releases = vec![
NewReleaseItem {
album: mk_album("nr1", "Neon Horizon", "SALUKI"),
artist_cover_uri: None,
cover_color: Some("#3B4CA8".into()),
release_date: Some("2026-11-20".into()),
},
NewReleaseItem {
album: mk_album("nr2", "Velvet Pulse", "Mirele"),
artist_cover_uri: None,
cover_color: Some("#7B2D5F".into()),
release_date: Some("2026-11-18".into()),
},
NewReleaseItem {
album: mk_album("nr3", "Night Drive", "SLAVA MARLOW"),
artist_cover_uri: None,
cover_color: Some("#1E6B52".into()),
release_date: Some("2026-11-15".into()),
},
NewReleaseItem {
album: mk_album("nr4", "Solar Flare", "OG BLESS"),
artist_cover_uri: None,
cover_color: Some("#8F4A1E".into()),
release_date: Some("2026-11-12".into()),
},
];
shell.app.landing.vibe_pick_tabs = vec![
VibePickTab {
title: "Mood".into(),
items: vec![
VibePickItem {
title: "Energetic".into(),
header: "Vibe".into(),
seeds: vec!["mood:energetic".into()],
color_hex: Some("#D94E2A".into()),
background_image_url: None,
image_url: None,
},
VibePickItem {
title: "Night Focus".into(),
header: "Vibe".into(),
seeds: vec!["mood:calm".into()],
color_hex: Some("#2F55A4".into()),
background_image_url: None,
image_url: None,
},
VibePickItem {
title: "Dreamy Synth".into(),
header: "Vibe".into(),
seeds: vec!["genre:electronic".into()],
color_hex: Some("#7C3AED".into()),
background_image_url: None,
image_url: None,
},
],
},
VibePickTab {
title: "Activity".into(),
items: vec![VibePickItem {
title: "Workout".into(),
header: "Vibe".into(),
seeds: vec!["activity:workout".into()],
color_hex: Some("#0F766E".into()),
background_image_url: None,
image_url: None,
}],
},
VibePickTab {
title: "Genres".into(),
items: vec![],
},
];
// Warm up layout so scroll content height is computed, then scroll to show New Releases + More Picks + sticky switcher
let _ = render_single_frame(&mut vk, &mut shell, 0.0);
let _ = render_single_frame(&mut vk, &mut shell, 0.016);
shell
.ui
.scrolls
.jump_to_y(WidgetId::new("foryou_page_scroll"), 860.0);
let _ = render_single_frame(&mut vk, &mut shell, 0.032);
let img = render_single_frame(&mut vk, &mut shell, 0.048);
let _ = img.save(out_dir.join("for_you_new_releases_picks.png"));
// Verify colored NewRelease cards / More Picks cards rendered non-flat rich pixels in content card
let mut colored_px = 0usize;
for y in 110..680 {
for x in 250..1240 {
let [r, g, b] = img.get_pixel(x, y).0;
let max_c = r.max(g).max(b);
let min_c = r.min(g).min(b);
if max_c.saturating_sub(min_c) >= 24 {
colored_px += 1;
}
}
}
assert!(
colored_px > 5_000,
"[for_you_new_releases_picks] Expected colored New Releases / More Picks cards, found only {} chromatic px",
colored_px
);
}
// 2. Official `My Collection` vertical feed (`my_collection_official.png`)
{
let mut shell = make_base_shell(
rt.handle().clone(),
vk.gpu_name.clone(),
Route::Collection,
ThemeMode::Dark,
Language::En,
0.0,
);
let extra_tracks = [
("c_1", "MONTAGEM TENTA", "KYOR", 141_000),
("c_2", "Midnight Sun", "SuperSolar", 184_000),
("c_3", "BANG A RANG", "GSTRNM", 100_000),
("c_4", "BOSS BITCH TEKK", "wharoxmane", 107_000),
("c_5", "Neon Rain", "Mirele", 192_000),
("c_6", "Skyline Pulse", "SALUKI", 168_000),
("c_7", "Electric Horizon", "SLAVA MARLOW", 155_000),
("c_8", "Deep Focus", "OG BLESS", 210_000),
];
shell.app.liked_tracks = extra_tracks
.iter()
.map(|(id, title, art, dur)| Track {
id: (*id).into(),
title: (*title).into(),
version: None,
artists: vec![ArtistSummary {
id: format!("ca_{id}"),
name: (*art).into(),
cover_uri: None,
genres: vec![],
}],
album_id: Some(format!("calb_{id}")),
album_title: Some((*title).into()),
duration_ms: *dur,
cover_uri: None,
is_explicit: false,
has_lossless: true,
has_lyrics: true,
chart_position: None,
chart_progress: None,
preview_url: None,
r128_i: None,
r128_tp: None,
derived_average_hex: None,
derived_accent_hex: None,
})
.collect();
shell.app.liked_artists = ["SALUKI", "Mirele", "KYOR", "SuperSolar", "GSTRNM", "OG BLESS"]
.iter()
.enumerate()
.map(|(i, name)| ArtistSummary {
id: format!("la_{i}"),
name: (*name).into(),
cover_uri: None,
genres: vec![],
})
.collect();
let _ = render_single_frame(&mut vk, &mut shell, 0.0);
let _ = render_single_frame(&mut vk, &mut shell, 0.016);
let img = render_single_frame(&mut vk, &mut shell, 0.032);
let _ = img.save(out_dir.join("my_collection_official.png"));
// Verify pink-magenta colored "color" word in subtitle + crimson 3D heart icon present,
// and ZERO old yellow-bordered My Favorites hero card!
let mut pink_subtitle_px = 0usize;
for y in 75..125 {
for x in 250..520 {
let [r, g, b] = img.get_pixel(x, y).0;
if r > 170 && b > 100 && (r as u16) > (g as u16) + 50 {
pink_subtitle_px += 1;
}
}
}
assert!(
pink_subtitle_px >= 15,
"[my_collection_official] Expected magenta-colored subtitle word 'color', found {} px",
pink_subtitle_px
);
}
// 3. Official `ConcertsPage` (`concerts_official.png`)
{
let mut shell = make_base_shell(
rt.handle().clone(),
vk.gpu_name.clone(),
Route::Concerts,
ThemeMode::Dark,
Language::Ru,
0.0,
);
shell.app.concerts = vec![
ConcertItem {
id: "con_1".into(),
title: "SALUKI — Большой сольный концерт".into(),
artist_name: "SALUKI".into(),
city: "Москва".into(),
place: "VK Stadium".into(),
date: "14 дек, 20:00".into(),
cover_uri: None,
afisha_url: Some("https://afisha.yandex.ru".into()),
min_price: Some(2500),
currency: Some("RUB".into()),
cashback_percent: Some(15),
cashback_title: Some("Кешбэк 15%".into()),
cover_color: Some("#4C2A85".into()),
event_kind: Some("concert".into()),
},
ConcertItem {
id: "con_2".into(),
title: "Mirele — Акустический вечер".into(),
artist_name: "Mirele".into(),
city: "Санкт-Петербург".into(),
place: "A2 Green Concert".into(),
date: "21 дек, 19:30".into(),
cover_uri: None,
afisha_url: Some("https://afisha.yandex.ru".into()),
min_price: Some(1900),
currency: Some("RUB".into()),
cashback_percent: Some(10),
cashback_title: None,
cover_color: Some("#1D5B79".into()),
event_kind: Some("concert".into()),
},
ConcertItem {
id: "con_3".into(),
title: "SLAVA MARLOW — Live Tour".into(),
artist_name: "SLAVA MARLOW".into(),
city: "Казань".into(),
place: "Korston Club Hotel".into(),
date: "28 дек, 20:00".into(),
cover_uri: None,
afisha_url: Some("https://afisha.yandex.ru".into()),
min_price: Some(2200),
currency: Some("RUB".into()),
cashback_percent: Some(20),
cashback_title: None,
cover_color: Some("#8C2F39".into()),
event_kind: Some("concert".into()),
},
ConcertItem {
id: "con_4".into(),
title: "Электрофорез — Зимний сет".into(),
artist_name: "Электрофорез".into(),
city: "Москва".into(),
place: "Урбан".into(),
date: "5 янв, 20:00".into(),
cover_uri: None,
afisha_url: Some("https://afisha.yandex.ru".into()),
min_price: Some(1700),
currency: Some("RUB".into()),
cashback_percent: Some(10),
cashback_title: None,
cover_color: Some("#2D4F1E".into()),
event_kind: Some("concert".into()),
},
];
let _ = render_single_frame(&mut vk, &mut shell, 0.0);
let _ = render_single_frame(&mut vk, &mut shell, 0.016);
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
let mut poster_chromatic_px = 0usize;
for y in 160..420 {
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 {
poster_chromatic_px += 1;
}
}
}
assert!(
poster_chromatic_px > 10_000,
"[concerts_official] Expected Top 3 concert poster cards + cashback pills, found {} chromatic px",
poster_chromatic_px
);
}
// 4. Official `WordsCardFullscreen` (`words_fullscreen_official.png`)
{
let mut shell = make_base_shell(
rt.handle().clone(),
vk.gpu_name.clone(),
Route::MyVibe,
ThemeMode::Dark,
Language::Ru,
108.0,
);
shell.app.words_cards.insert(
"t_1".into(),
WordsCard {
id: "wc_fs_1".into(),
track_id: "t_1".into(),
text: "MONTAGEM TENTA сочетает бразильский фонк и жёсткие хардстайл-кики.".into(),
tags: vec!["FACT".into()],
action: None,
actions: vec![],
big_card_ids: vec!["bc_1".into()],
feedback_state: None,
},
);
shell.app.words_big_card_open = true;
shell.app.words_big_card_loading = false;
shell.app.words_big_card = Some(WordsBigCard {
id: "bc_1".into(),
text: "MONTAGEM TENTA (Hardstyle) — взрывной кроссовер бразильского фонка и европейского хардстайла с плотным саб-басом и стремительным ритмом.".into(),
actions: vec![WordsCardSource {
title: "Обсудить с Алисой AI".into(),
url: "https://alice.yandex.ru".into(),
favicon_url: None,
}],
});
let _ = render_single_frame(&mut vk, &mut shell, 0.0);
let _ = render_single_frame(&mut vk, &mut shell, 0.016);
let img = render_single_frame(&mut vk, &mut shell, 0.032);
let _ = img.save(out_dir.join("words_fullscreen_official.png"));
// Verify purple Alice ring (#8B5CF6) rendered inside the centered source pill
let mut alice_purple_px = 0usize;
for y in 360..600 {
for x in 560..960 {
let [r, g, b] = img.get_pixel(x, y).0;
if b > 160 && r > 90 && (b as u16) > (g as u16) + 50 {
alice_purple_px += 1;
}
}
}
assert!(
alice_purple_px >= 15,
"[words_fullscreen_official] Expected purple Alice AI icon inside source pill, found {} px",
alice_purple_px
);
}
}