feat: 1:1 For You, My Collection, Concerts, Books & Podcasts, WordsCardFullscreen and release v0.1.2

This commit is contained in:
marwy 2026-11-27 14:29:09 +03:00
parent 8e7ec9142f
commit e9aa253f72
12 changed files with 4393 additions and 593 deletions

View file

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