forked from Furumi/furumi-tui
Find public podcasts in search and subscribe from their cards
Federated search also queries the podcast discovery overlay and lists the podcast entries of merge_search_results after the music results, marked [podcast], with the publishing devices or "subscribed" (also through a feed alias resolved off the UI thread). Enter opens the card: the publishers' claims, the origin feed URL, unverified moved-feed claims, an optional episode preview read from the feed itself, and «Подписаться», which subscribes privately with the origin URL only. «Уже подписан» opens the podcast in the Podcasts tab instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
25a9f2b0ec
commit
e038f282c2
18 files changed
+1235
-40
No files matched your search
+62
-16
@@ -947,12 +947,7 @@ fn draw_search(frame: &mut Frame, area: Rect, state: &AppState, cursor: usize) {
|
||||
let empty_results = SearchResults::default();
|
||||
let results = match &search.results {
|
||||
Some(results) => results,
|
||||
None if !state.search.fed_tracks.is_empty()
|
||||
|| !state.search.fed_artists.is_empty()
|
||||
|| state.search.fed_loading =>
|
||||
{
|
||||
&empty_results
|
||||
}
|
||||
None if state.search.has_federated() => &empty_results,
|
||||
None => {
|
||||
let hint = if search.query.is_empty() {
|
||||
"type to search artists, releases and tracks"
|
||||
@@ -967,11 +962,7 @@ fn draw_search(frame: &mut Frame, area: Rect, state: &AppState, cursor: usize) {
|
||||
return centered_line(frame, inner, line);
|
||||
}
|
||||
};
|
||||
if results.is_empty()
|
||||
&& state.search.fed_tracks.is_empty()
|
||||
&& state.search.fed_artists.is_empty()
|
||||
&& !state.search.fed_loading
|
||||
{
|
||||
if results.is_empty() && !state.search.has_federated() {
|
||||
return centered_line(frame, inner, Line::styled("nothing found", theme::dim()));
|
||||
}
|
||||
|
||||
@@ -1037,11 +1028,8 @@ fn draw_search(frame: &mut Frame, area: Rect, state: &AppState, cursor: usize) {
|
||||
}
|
||||
}
|
||||
// Federated section: artists whose card can be assembled, then tracks
|
||||
// (both marked with the owning peers).
|
||||
if !state.search.fed_tracks.is_empty()
|
||||
|| !state.search.fed_artists.is_empty()
|
||||
|| state.search.fed_loading
|
||||
{
|
||||
// (both marked with the owning peers), then public podcast cards.
|
||||
if state.search.has_federated() {
|
||||
if !rows.is_empty() {
|
||||
rows.push((Line::default(), None, None));
|
||||
}
|
||||
@@ -1100,6 +1088,23 @@ fn draw_search(frame: &mut Frame, area: Rect, state: &AppState, cursor: usize) {
|
||||
));
|
||||
index += 1;
|
||||
}
|
||||
// Podcasts carry an explicit type marker: they are not music and
|
||||
// Enter opens their public card, never plays anything.
|
||||
if !state.search.fed_podcasts.is_empty() {
|
||||
rows.push((
|
||||
Line::styled("Podcasts · public cards", theme::header_for(state)),
|
||||
None,
|
||||
None,
|
||||
));
|
||||
}
|
||||
for hit in &state.search.fed_podcasts {
|
||||
rows.push((
|
||||
podcast_hit_line(state, hit),
|
||||
Some(podcast_hit_meta(state, hit)),
|
||||
Some(index),
|
||||
));
|
||||
index += 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Absolute cursor indices covered by an active Shift-V range in the
|
||||
@@ -1145,6 +1150,47 @@ fn draw_search(frame: &mut Frame, area: Rect, state: &AppState, cursor: usize) {
|
||||
}
|
||||
}
|
||||
|
||||
/// One public podcast in the search results: the `podcast` type marker,
|
||||
/// the title and the claimed author.
|
||||
fn podcast_hit_line(
|
||||
state: &AppState,
|
||||
hit: &crate::podcasts::discovery::PodcastHit,
|
||||
) -> Line<'static> {
|
||||
let card = &hit.hit.card;
|
||||
let mut detail = String::from(" ");
|
||||
if let Some(author) = &card.author {
|
||||
detail.push_str(author);
|
||||
detail.push_str(" · ");
|
||||
}
|
||||
detail.push_str("open the card");
|
||||
Line::from(vec![
|
||||
Span::styled(
|
||||
format!("[{}] ", hit.hit.kind().as_str()),
|
||||
theme::accent_for(state),
|
||||
),
|
||||
Span::raw(card.title.clone()),
|
||||
Span::styled(detail, theme::dim()),
|
||||
])
|
||||
}
|
||||
|
||||
/// Right column of a podcast hit: subscribed here, or how many devices
|
||||
/// publish the card (not a subscriber count).
|
||||
fn podcast_hit_meta(state: &AppState, hit: &crate::podcasts::discovery::PodcastHit) -> String {
|
||||
if state.podcasts.subscribed_to(hit) {
|
||||
return "✓ subscribed".to_string();
|
||||
}
|
||||
let mut meta = match hit.hit.card.episode_count {
|
||||
Some(count) => format!("{count} ep · "),
|
||||
None => String::new(),
|
||||
};
|
||||
let publishers = hit.hit.publishers.len();
|
||||
meta.push_str(&format!(
|
||||
"{publishers} publisher{}",
|
||||
if publishers == 1 { "" } else { "s" }
|
||||
));
|
||||
meta
|
||||
}
|
||||
|
||||
fn draw_similarity_search(frame: &mut Frame, area: Rect, state: &AppState, cursor: usize) {
|
||||
let search = &state.search;
|
||||
let status = if search.fed_loading {
|
||||
|
||||
+137
@@ -4,6 +4,7 @@ mod federation;
|
||||
pub(crate) mod global;
|
||||
mod logs;
|
||||
mod playlists;
|
||||
mod podcast_card;
|
||||
mod podcasts;
|
||||
mod popup;
|
||||
#[cfg(test)]
|
||||
@@ -217,6 +218,142 @@ mod tests {
|
||||
assert!(screen.contains("not published:"), "{screen}");
|
||||
}
|
||||
|
||||
/// Search view with a federated artist and two public podcast cards;
|
||||
/// the first podcast is subscribed on this device.
|
||||
fn search_with_podcasts() -> AppState {
|
||||
use crate::podcasts::discovery::{PodcastHit, test_hit};
|
||||
let mut state =
|
||||
podcast_fixtures::ready_state(vec![podcast_fixtures::row("Test Show", 0, 3, 0)]);
|
||||
state.active_tab = Tab::Global;
|
||||
state.search.query = "show".into();
|
||||
state.search.results = Some(Default::default());
|
||||
state.search.fed_artists = vec![crate::federation::FedArtistHit {
|
||||
name: "Show Band".into(),
|
||||
peers: 2,
|
||||
}];
|
||||
let mut other = test_hit("https://feeds.example.test/other.xml", "Other Show");
|
||||
other.card.author = None;
|
||||
state.search.fed_podcasts = vec![
|
||||
PodcastHit::new(test_hit("https://example.test/feed.xml", "Test Show")),
|
||||
PodcastHit::new(other),
|
||||
];
|
||||
state.global.stack.push(GlobalView::Search { cursor: 1 });
|
||||
state
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn search_marks_podcast_hits_apart_from_music() {
|
||||
let screen = render(&search_with_podcasts(), 120, 20);
|
||||
assert!(screen.contains("Federation"), "{screen}");
|
||||
assert!(
|
||||
screen.contains("Show Band artist · open the card"),
|
||||
"{screen}"
|
||||
);
|
||||
assert!(screen.contains("Podcasts · public cards"), "{screen}");
|
||||
assert!(
|
||||
screen.contains("[podcast] Test Show Ferris Crab · open the card"),
|
||||
"{screen}"
|
||||
);
|
||||
assert!(
|
||||
screen.contains("[podcast] Other Show open the card"),
|
||||
"{screen}"
|
||||
);
|
||||
assert!(screen.contains("✓ subscribed"), "{screen}");
|
||||
assert!(screen.contains("12 ep · 1 publisher"), "{screen}");
|
||||
// The podcasts come after the music rows.
|
||||
let artist = screen.find("Show Band").unwrap();
|
||||
let podcast = screen.find("[podcast]").unwrap();
|
||||
assert!(artist < podcast, "{screen}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn podcast_card_offers_subscribe_or_shows_already_subscribed() {
|
||||
use crate::app::state::{Loadable, Popup};
|
||||
use crate::podcasts::discovery::{FeedPreview, PreviewEpisode};
|
||||
let mut state = search_with_podcasts();
|
||||
let mut hit = state.search.fed_podcasts[1].clone();
|
||||
hit.hit.claimed_feed_urls = vec![music_dht::podcast_dht::ClaimedFeedUrl {
|
||||
feed_url: music_dht::podcast::FeedUrl::parse("https://elsewhere.test/claimed.xml")
|
||||
.unwrap(),
|
||||
publishers: hit.hit.publishers.clone(),
|
||||
}];
|
||||
state.popup = Some(Popup::PodcastCard {
|
||||
hit: Box::new(hit.clone()),
|
||||
preview: None,
|
||||
scroll: 0,
|
||||
});
|
||||
let screen = render(&state, 110, 40);
|
||||
assert!(screen.contains("[podcast] Other Show"), "{screen}");
|
||||
assert!(screen.contains("они не проверены"), "{screen}");
|
||||
assert!(screen.contains("Категории: Technology"), "{screen}");
|
||||
assert!(
|
||||
screen.contains("Выпусков: 12 · последний 2024-06-15"),
|
||||
"{screen}"
|
||||
);
|
||||
assert!(
|
||||
screen.contains("Опубликовали: 1 устройство (не число подписчиков"),
|
||||
"{screen}"
|
||||
);
|
||||
assert!(
|
||||
screen.contains("Лента: https://feeds.example.test/other.xml"),
|
||||
"{screen}"
|
||||
);
|
||||
assert!(
|
||||
screen.contains("(не проверен, не используется): https://elsewhere.test/claimed.xml"),
|
||||
"{screen}"
|
||||
);
|
||||
assert!(screen.contains("[ Подписаться ]"), "{screen}");
|
||||
assert!(
|
||||
screen.contains("e — прочитать ленту без подписки"),
|
||||
"{screen}"
|
||||
);
|
||||
assert!(screen.contains("enter подписаться"), "{screen}");
|
||||
assert!(!screen.contains("Уже подписан"), "{screen}");
|
||||
|
||||
state.popup = Some(Popup::PodcastCard {
|
||||
hit: Box::new(hit),
|
||||
preview: Some(Loadable::Ready(FeedPreview {
|
||||
title: "Other Show (feed)".into(),
|
||||
episode_count: 3,
|
||||
seasons: vec![(Some(1), 2), (None, 1)],
|
||||
episodes: vec![PreviewEpisode {
|
||||
title: "Pilot".into(),
|
||||
season: Some(1),
|
||||
episode_number: Some(1),
|
||||
published_at_ms: Some(1_718_445_600_000),
|
||||
duration_ms: Some(2_700_000),
|
||||
}],
|
||||
moved_to: None,
|
||||
})),
|
||||
scroll: 0,
|
||||
});
|
||||
let screen = render(&state, 110, 40);
|
||||
assert!(
|
||||
screen.contains("Название в ленте: Other Show (feed)"),
|
||||
"{screen}"
|
||||
);
|
||||
assert!(
|
||||
screen.contains("В ленте: 3 выпуска · сезон 1: 2, без сезона: 1"),
|
||||
"{screen}"
|
||||
);
|
||||
assert!(
|
||||
screen.contains("• Pilot S1E1 · 2024-06-15 · 45:00"),
|
||||
"{screen}"
|
||||
);
|
||||
assert!(screen.contains("… и ещё 2"), "{screen}");
|
||||
|
||||
// The subscribed podcast: «Уже подписан», Enter opens it.
|
||||
state.popup = Some(Popup::PodcastCard {
|
||||
hit: Box::new(state.search.fed_podcasts[0].clone()),
|
||||
preview: None,
|
||||
scroll: 0,
|
||||
});
|
||||
let screen = render(&state, 110, 40);
|
||||
assert!(screen.contains("✓ Уже подписан"), "{screen}");
|
||||
assert!(screen.contains("enter открыть"), "{screen}");
|
||||
assert!(!screen.contains("[ Подписаться ]"), "{screen}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn podcast_share_confirmation_lists_the_warnings_in_russian() {
|
||||
let mut state =
|
||||
|
||||
@@ -0,0 +1,285 @@
|
||||
//! The public podcast card opened from the search results. In Russian, like
|
||||
//! the share confirmation: «Подписаться» / «Уже подписан» are the actions
|
||||
//! the requirements name.
|
||||
//!
|
||||
//! Everything but the origin feed URL is a publisher's claim and is shown as
|
||||
//! such; the episode preview comes from the feed itself.
|
||||
|
||||
use ratatui::Frame;
|
||||
use ratatui::layout::{Alignment, Constraint, Layout};
|
||||
use ratatui::style::{Color, Modifier, Style};
|
||||
use ratatui::text::{Line, Span};
|
||||
use ratatui::widgets::{Block, Clear, Paragraph, Wrap};
|
||||
|
||||
use super::podcasts::{format_date, format_duration_ms};
|
||||
use super::popup::centered;
|
||||
use super::theme;
|
||||
use crate::app::state::{AppState, Loadable};
|
||||
use crate::podcasts::discovery::{FeedPreview, PodcastHit};
|
||||
|
||||
pub(super) fn draw(
|
||||
frame: &mut Frame,
|
||||
state: &AppState,
|
||||
hit: &PodcastHit,
|
||||
preview: Option<&Loadable<FeedPreview>>,
|
||||
scroll: u16,
|
||||
) {
|
||||
let subscribed = state.podcasts.subscribed_to(hit);
|
||||
let subscribing = state.podcasts.subscribing;
|
||||
let lines = card_lines(state, hit, preview, subscribed, subscribing);
|
||||
|
||||
let width = 92.min(frame.area().width.saturating_sub(4)).max(30);
|
||||
let inner_width = width.saturating_sub(2).max(1);
|
||||
let body_height = lines
|
||||
.iter()
|
||||
.map(|line| (line.width().max(1) as u16).div_ceil(inner_width))
|
||||
.sum::<u16>();
|
||||
let height = (body_height + 4).min(frame.area().height.saturating_sub(2));
|
||||
let area = centered(frame.area(), width, height);
|
||||
let block = Block::bordered()
|
||||
.title(" Подкаст · публичная карточка ")
|
||||
.title_style(theme::header_for(state))
|
||||
.border_style(theme::strong_border_for(state));
|
||||
let inner = block.inner(area);
|
||||
frame.render_widget(Clear, area);
|
||||
frame.render_widget(block, area);
|
||||
let [body, footer_area] =
|
||||
Layout::vertical([Constraint::Min(1), Constraint::Length(1)]).areas(inner);
|
||||
let max_scroll = body_height.saturating_sub(body.height);
|
||||
frame.render_widget(
|
||||
Paragraph::new(lines)
|
||||
.wrap(Wrap { trim: false })
|
||||
.scroll((scroll.min(max_scroll), 0)),
|
||||
body,
|
||||
);
|
||||
let footer = if subscribed {
|
||||
"enter открыть · e выпуски · ↑↓ прокрутка · esc закрыть"
|
||||
} else {
|
||||
"enter подписаться · e выпуски · ↑↓ прокрутка · esc закрыть"
|
||||
};
|
||||
frame.render_widget(
|
||||
Paragraph::new(Line::styled(footer, theme::dim())).alignment(Alignment::Center),
|
||||
footer_area,
|
||||
);
|
||||
}
|
||||
|
||||
fn card_lines(
|
||||
state: &AppState,
|
||||
hit: &PodcastHit,
|
||||
preview: Option<&Loadable<FeedPreview>>,
|
||||
subscribed: bool,
|
||||
subscribing: bool,
|
||||
) -> Vec<Line<'static>> {
|
||||
let card = &hit.hit.card;
|
||||
let bold = Style::new().add_modifier(Modifier::BOLD);
|
||||
let mut lines = vec![
|
||||
Line::from(vec![
|
||||
Span::styled("[podcast] ", theme::accent_for(state)),
|
||||
Span::styled(card.title.clone(), bold),
|
||||
]),
|
||||
Line::styled(
|
||||
"Сведения ниже указали издатели карточки; они не проверены.",
|
||||
theme::dim(),
|
||||
),
|
||||
Line::raw(""),
|
||||
];
|
||||
if let Some(author) = &card.author {
|
||||
lines.push(field("Автор", author.clone()));
|
||||
}
|
||||
if !card.categories.is_empty() {
|
||||
lines.push(field("Категории", card.categories.join(", ")));
|
||||
}
|
||||
if let Some(language) = &card.language {
|
||||
lines.push(field("Язык", language.clone()));
|
||||
}
|
||||
let mut episodes = match card.episode_count {
|
||||
Some(count) => format!("{count}"),
|
||||
None => "не указано".to_string(),
|
||||
};
|
||||
if let Some(latest) = card.latest_episode_at_ms {
|
||||
episodes.push_str(&format!(
|
||||
" · последний {}",
|
||||
format_date(latest.div_euclid(1000))
|
||||
));
|
||||
}
|
||||
lines.push(field("Выпусков", episodes));
|
||||
let publishers = hit.hit.publishers.len();
|
||||
lines.push(field(
|
||||
"Опубликовали",
|
||||
format!(
|
||||
"{publishers} {} (не число подписчиков и не знак доверия)",
|
||||
plural_ru(publishers, "устройство", "устройства", "устройств")
|
||||
),
|
||||
));
|
||||
lines.push(field("Лента", hit.hit.feed_url.as_str().to_string()));
|
||||
for claim in &hit.hit.claimed_feed_urls {
|
||||
lines.push(Line::styled(
|
||||
format!(
|
||||
"Заявленный новый адрес (не проверен, не используется): {}",
|
||||
claim.feed_url.as_str()
|
||||
),
|
||||
theme::dim(),
|
||||
));
|
||||
}
|
||||
if let Some(link) = &card.link {
|
||||
lines.push(field("Сайт", link.clone()));
|
||||
}
|
||||
if let Some(description) = &card.description {
|
||||
lines.push(Line::raw(""));
|
||||
lines.extend(
|
||||
description
|
||||
.lines()
|
||||
.map(|line| Line::raw(line.replace('\t', " "))),
|
||||
);
|
||||
}
|
||||
|
||||
lines.push(Line::raw(""));
|
||||
if subscribed {
|
||||
lines.push(Line::from(vec![
|
||||
Span::styled(
|
||||
"✓ Уже подписан",
|
||||
Style::new().fg(Color::Green).add_modifier(Modifier::BOLD),
|
||||
),
|
||||
Span::styled(
|
||||
" · enter откроет подкаст во вкладке Podcasts",
|
||||
theme::dim(),
|
||||
),
|
||||
]));
|
||||
} else if subscribing {
|
||||
lines.push(Line::styled(
|
||||
"Подписка… читаем ленту",
|
||||
theme::accent_for(state),
|
||||
));
|
||||
} else {
|
||||
lines.push(Line::from(vec![
|
||||
Span::styled(
|
||||
"[ Подписаться ]",
|
||||
theme::accent_for(state).add_modifier(Modifier::BOLD),
|
||||
),
|
||||
Span::styled(
|
||||
" лента будет прочитана с её сервера; подписка личная и не публикуется",
|
||||
theme::dim(),
|
||||
),
|
||||
]));
|
||||
}
|
||||
|
||||
lines.push(Line::raw(""));
|
||||
lines.push(Line::styled(
|
||||
"Сезоны и выпуски (из RSS-ленты)",
|
||||
theme::header_for(state),
|
||||
));
|
||||
match preview {
|
||||
None => lines.push(Line::styled(
|
||||
"e — прочитать ленту без подписки (запрос к серверу ленты)",
|
||||
theme::dim(),
|
||||
)),
|
||||
Some(Loadable::Loading) => {
|
||||
lines.push(Line::styled("читаем ленту…", theme::accent_for(state)))
|
||||
}
|
||||
Some(Loadable::Failed(err)) => lines.push(Line::styled(
|
||||
format!("не удалось прочитать ленту: {err}"),
|
||||
Style::new().fg(Color::Red),
|
||||
)),
|
||||
Some(Loadable::Ready(feed)) => preview_lines(&mut lines, card.title.as_str(), feed),
|
||||
}
|
||||
lines
|
||||
}
|
||||
|
||||
fn preview_lines(lines: &mut Vec<Line<'static>>, card_title: &str, feed: &FeedPreview) {
|
||||
if feed.title != card_title {
|
||||
lines.push(field("Название в ленте", feed.title.clone()));
|
||||
}
|
||||
if let Some(moved) = &feed.moved_to {
|
||||
lines.push(field("Лента переехала", moved.as_str().to_string()));
|
||||
}
|
||||
let seasons: Vec<String> = feed
|
||||
.seasons
|
||||
.iter()
|
||||
.map(|(season, count)| match season {
|
||||
Some(season) => format!("сезон {season}: {count}"),
|
||||
None => format!("без сезона: {count}"),
|
||||
})
|
||||
.collect();
|
||||
lines.push(field(
|
||||
"В ленте",
|
||||
format!(
|
||||
"{} {}{}",
|
||||
feed.episode_count,
|
||||
plural_ru(feed.episode_count, "выпуск", "выпуска", "выпусков"),
|
||||
if seasons.is_empty() {
|
||||
String::new()
|
||||
} else {
|
||||
format!(" · {}", seasons.join(", "))
|
||||
}
|
||||
),
|
||||
));
|
||||
for episode in &feed.episodes {
|
||||
let mut meta = Vec::new();
|
||||
match (episode.season, episode.episode_number) {
|
||||
(Some(season), Some(number)) => meta.push(format!("S{season}E{number}")),
|
||||
(Some(season), None) => meta.push(format!("S{season}")),
|
||||
(None, Some(number)) => meta.push(format!("#{number}")),
|
||||
(None, None) => {}
|
||||
}
|
||||
if let Some(published) = episode.published_at_ms {
|
||||
meta.push(format_date(published.div_euclid(1000)));
|
||||
}
|
||||
if let Some(duration) = episode.duration_ms {
|
||||
meta.push(format_duration_ms(duration));
|
||||
}
|
||||
lines.push(Line::from(vec![
|
||||
Span::raw(format!("• {}", episode.title)),
|
||||
Span::styled(
|
||||
if meta.is_empty() {
|
||||
String::new()
|
||||
} else {
|
||||
format!(" {}", meta.join(" · "))
|
||||
},
|
||||
theme::dim(),
|
||||
),
|
||||
]));
|
||||
}
|
||||
if feed.episodes.len() < feed.episode_count {
|
||||
lines.push(Line::styled(
|
||||
format!("… и ещё {}", feed.episode_count - feed.episodes.len()),
|
||||
theme::dim(),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
fn field(label: &str, value: String) -> Line<'static> {
|
||||
Line::from(vec![
|
||||
Span::styled(format!("{label}: "), theme::dim()),
|
||||
Span::raw(value),
|
||||
])
|
||||
}
|
||||
|
||||
/// Russian plural form for `n`.
|
||||
fn plural_ru(n: usize, one: &'static str, few: &'static str, many: &'static str) -> &'static str {
|
||||
let (tens, units) = (n % 100, n % 10);
|
||||
if (11..=14).contains(&tens) {
|
||||
many
|
||||
} else if units == 1 {
|
||||
one
|
||||
} else if (2..=4).contains(&units) {
|
||||
few
|
||||
} else {
|
||||
many
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::plural_ru;
|
||||
|
||||
#[test]
|
||||
fn russian_plurals() {
|
||||
let forms = |n| plural_ru(n, "устройство", "устройства", "устройств");
|
||||
assert_eq!(forms(1), "устройство");
|
||||
assert_eq!(forms(3), "устройства");
|
||||
assert_eq!(forms(5), "устройств");
|
||||
assert_eq!(forms(11), "устройств");
|
||||
assert_eq!(forms(21), "устройство");
|
||||
assert_eq!(forms(0), "устройств");
|
||||
}
|
||||
}
|
||||
+6
-1
@@ -28,6 +28,11 @@ pub fn draw(frame: &mut Frame, state: &AppState) {
|
||||
Some(Popup::ConfirmPodcastUnsubscribe { title, .. }) => {
|
||||
draw_confirm_podcast_unsubscribe(frame, state, title)
|
||||
}
|
||||
Some(Popup::PodcastCard {
|
||||
hit,
|
||||
preview,
|
||||
scroll,
|
||||
}) => super::podcast_card::draw(frame, state, hit, preview.as_ref(), *scroll),
|
||||
Some(Popup::ConfirmPodcastShare {
|
||||
title,
|
||||
urls,
|
||||
@@ -1824,7 +1829,7 @@ fn draw_name_entry(
|
||||
frame.render_widget(Paragraph::new(hint).alignment(Alignment::Center), footer);
|
||||
}
|
||||
|
||||
fn centered(area: Rect, width: u16, height: u16) -> Rect {
|
||||
pub(super) fn centered(area: Rect, width: u16, height: u16) -> Rect {
|
||||
let [rect] = Layout::horizontal([Constraint::Length(width.min(area.width))])
|
||||
.flex(Flex::Center)
|
||||
.areas(area);
|
||||
|
||||
Reference in new issue
Block a user