gui: Video, QR Code and the podcast detail screens use screen_header
They each drew their own title row: Video a bold text_xl clone of the header, QR Code a title inside its padded body, and podcast detail and episode a "← Back" button beside a heading in the scrolling column. They now open with the same header row as every other screen, and their back buttons read "‹ …" like the rest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ed7e3171bb
commit
09d8f6d00b
4 files changed
+68
-119
No files matched your search
@@ -38,6 +38,7 @@ use crate::components::button::{OnClickIf, button};
|
||||
use crate::components::incoming_banner::held_strip;
|
||||
use crate::components::note::error_line;
|
||||
use crate::components::player_controls::{PlayerControls, PlayerControlsEvent};
|
||||
use crate::components::screen_header::{screen_header, screen_title};
|
||||
use crate::components::sync_guarded::SyncGuarded;
|
||||
use crate::network_task;
|
||||
use crate::sizing::layout::CONTENT_MAX_WIDTH;
|
||||
@@ -711,53 +712,36 @@ impl Render for PodcastDetailView {
|
||||
return div().size_full().child(episode.clone());
|
||||
}
|
||||
|
||||
div()
|
||||
.flex()
|
||||
.flex_col()
|
||||
.size_full()
|
||||
.gap_5()
|
||||
.p_5()
|
||||
.child(self.render_header(&theme, cx))
|
||||
.child(
|
||||
// Everything below the header scrolls together.
|
||||
div()
|
||||
.id("podcast-detail-scroll")
|
||||
.flex()
|
||||
.flex_col()
|
||||
.gap_5()
|
||||
.flex_1()
|
||||
.max_w(CONTENT_MAX_WIDTH)
|
||||
.min_h(px(0.))
|
||||
.overflow_y_scroll()
|
||||
.track_scroll(&self.scroll)
|
||||
.child(self.render_info(&theme, tz, cx))
|
||||
.when(!self.meta.description.is_empty(), |col| {
|
||||
col.child(description_block(&theme, self.meta.description.clone().into()))
|
||||
})
|
||||
.child(self.render_episodes(&theme, tz, cx)),
|
||||
)
|
||||
div().flex().flex_col().size_full().child(self.render_header(&theme, cx)).child(
|
||||
// Everything below the header scrolls together.
|
||||
div()
|
||||
.id("podcast-detail-scroll")
|
||||
.flex()
|
||||
.flex_col()
|
||||
.gap_5()
|
||||
.p_5()
|
||||
.flex_1()
|
||||
.max_w(CONTENT_MAX_WIDTH)
|
||||
.min_h(px(0.))
|
||||
.overflow_y_scroll()
|
||||
.track_scroll(&self.scroll)
|
||||
.child(self.render_info(&theme, tz, cx))
|
||||
.when(!self.meta.description.is_empty(), |col| {
|
||||
col.child(description_block(&theme, self.meta.description.clone().into()))
|
||||
})
|
||||
.child(self.render_episodes(&theme, tz, cx)),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl PodcastDetailView {
|
||||
fn render_header(&self, theme: &Theme, cx: &mut Context<Self>) -> impl IntoElement + use<> {
|
||||
div()
|
||||
.flex()
|
||||
.flex_row()
|
||||
.items_center()
|
||||
.gap_3()
|
||||
.flex_none()
|
||||
screen_header(theme)
|
||||
.child(
|
||||
button(theme, "podcast-detail-back", "← Back", false, true)
|
||||
button(theme, "podcast-detail-back", "‹ Podcasts", false, true)
|
||||
.on_click(cx.listener(|_this, _, _, cx| cx.emit(DetailEvent::Back))),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.text_xl()
|
||||
.font_weight(FontWeight::BOLD)
|
||||
.text_color(theme.text_primary)
|
||||
.child("Podcast Details"),
|
||||
)
|
||||
.child(screen_title(theme, "Podcast Details"))
|
||||
}
|
||||
|
||||
/// Cover art beside title / author / last-updated / subscribe.
|
||||
|
||||
@@ -30,6 +30,7 @@ use crate::agents::podcasts::{
|
||||
use crate::components::button::{OnClickIf, button};
|
||||
use crate::components::note::error_line;
|
||||
use crate::components::player_controls::{Adjacency, NowPlaying, PlayerControls, TrackArt};
|
||||
use crate::components::screen_header::{screen_header, screen_title};
|
||||
use crate::sizing::layout::CONTENT_MAX_WIDTH;
|
||||
use crate::sizing::{control, font, scaled};
|
||||
use crate::theme::{ActiveTheme, Theme};
|
||||
@@ -231,46 +232,35 @@ impl Render for EpisodeDetailView {
|
||||
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||
let theme = cx.theme().clone();
|
||||
let tz = cx.timezone();
|
||||
div()
|
||||
.flex()
|
||||
.flex_col()
|
||||
.size_full()
|
||||
.gap_5()
|
||||
.p_5()
|
||||
.child(self.render_header(&theme, cx))
|
||||
.child(
|
||||
// The description scrolls; the header above stays put.
|
||||
div()
|
||||
.id("episode-detail-scroll")
|
||||
.flex()
|
||||
.flex_col()
|
||||
.gap_5()
|
||||
.flex_1()
|
||||
.max_w(CONTENT_MAX_WIDTH)
|
||||
.min_h(px(0.))
|
||||
.overflow_y_scroll()
|
||||
.child(self.render_info(&theme, tz, cx))
|
||||
.child(description_block(
|
||||
&theme,
|
||||
if self.meta.row.description.is_empty() {
|
||||
SharedString::from("No description available.")
|
||||
} else {
|
||||
self.meta.row.description.clone()
|
||||
},
|
||||
)),
|
||||
)
|
||||
div().flex().flex_col().size_full().child(self.render_header(&theme, cx)).child(
|
||||
// The description scrolls; the header above stays put.
|
||||
div()
|
||||
.id("episode-detail-scroll")
|
||||
.flex()
|
||||
.flex_col()
|
||||
.gap_5()
|
||||
.p_5()
|
||||
.flex_1()
|
||||
.max_w(CONTENT_MAX_WIDTH)
|
||||
.min_h(px(0.))
|
||||
.overflow_y_scroll()
|
||||
.child(self.render_info(&theme, tz, cx))
|
||||
.child(description_block(
|
||||
&theme,
|
||||
if self.meta.row.description.is_empty() {
|
||||
SharedString::from("No description available.")
|
||||
} else {
|
||||
self.meta.row.description.clone()
|
||||
},
|
||||
)),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl EpisodeDetailView {
|
||||
fn render_header(&self, theme: &Theme, cx: &mut Context<Self>) -> impl IntoElement + use<> {
|
||||
div()
|
||||
.flex()
|
||||
.flex_row()
|
||||
.items_center()
|
||||
.gap_3()
|
||||
.flex_none()
|
||||
.child(button(theme, "episode-detail-back", "← Back", false, true).on_click(
|
||||
screen_header(theme)
|
||||
.child(button(theme, "episode-detail-back", "‹ Back", false, true).on_click(
|
||||
cx.listener(|this, _, _, cx| {
|
||||
cx.emit(EpisodeEvent::Back {
|
||||
document_id: this.meta.document_id(),
|
||||
@@ -278,13 +268,7 @@ impl EpisodeDetailView {
|
||||
})
|
||||
}),
|
||||
))
|
||||
.child(
|
||||
div()
|
||||
.text_xl()
|
||||
.font_weight(FontWeight::BOLD)
|
||||
.text_color(theme.text_primary)
|
||||
.child("Episode"),
|
||||
)
|
||||
.child(screen_title(theme, "Episode"))
|
||||
}
|
||||
|
||||
/// Cover art beside title / feed / date·duration / Play.
|
||||
|
||||
@@ -6,15 +6,15 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use gpui::{
|
||||
Context, Entity, FontWeight, IntoElement, Render, RenderImage, SharedString, div, img,
|
||||
prelude::*,
|
||||
Context, Entity, IntoElement, Render, RenderImage, SharedString, div, img, prelude::*, px,
|
||||
};
|
||||
use synchronicity::agents::qrcode::generate_qr_png;
|
||||
|
||||
use crate::components::render_image::to_render_image;
|
||||
use crate::components::screen_header::{screen_header, screen_title};
|
||||
use crate::components::text_area::TextArea;
|
||||
use crate::components::text_editing::EditorEvent;
|
||||
use crate::sizing::{font, scaled};
|
||||
use crate::sizing::scaled;
|
||||
use crate::theme::{ActiveTheme, Theme};
|
||||
|
||||
/// Fixed display size of the QR preview; the PNG itself is emitted un-scaled at
|
||||
@@ -77,17 +77,18 @@ impl Render for QrCodeView {
|
||||
.size_full()
|
||||
.flex()
|
||||
.flex_col()
|
||||
.gap_4()
|
||||
.p_4()
|
||||
.child(screen_header(&theme).child(screen_title(&theme, "QR Code")))
|
||||
.child(
|
||||
div()
|
||||
.text_size(font::TITLE)
|
||||
.font_weight(FontWeight::BOLD)
|
||||
.text_color(theme.text_primary)
|
||||
.child("QR Code"),
|
||||
.flex_1()
|
||||
.min_h(px(0.))
|
||||
.flex()
|
||||
.flex_col()
|
||||
.gap_4()
|
||||
.p_4()
|
||||
.child(div().h(scaled(160.)).child(self.input.clone()))
|
||||
.child(div().flex_1().flex().items_center().justify_center().child(preview)),
|
||||
)
|
||||
.child(div().h(scaled(160.)).child(self.input.clone()))
|
||||
.child(div().flex_1().flex().items_center().justify_center().child(preview))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,9 +9,7 @@
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
|
||||
use gpui::{
|
||||
Context, Entity, FontWeight, IntoElement, Render, SharedString, Window, div, prelude::*, px,
|
||||
};
|
||||
use gpui::{Context, Entity, IntoElement, Render, SharedString, Window, div, prelude::*, px};
|
||||
use synchronicity::agents::AgentId;
|
||||
use synchronicity::agents::video::{VideoTreeItem, build_video_nodes};
|
||||
use synchronicity::copy;
|
||||
@@ -30,8 +28,9 @@ use crate::components::imports_in_progress::ImportsInProgress;
|
||||
use crate::components::media_library::{
|
||||
BreadcrumbActivated, ItemActivated, LibraryTabConfig, MediaItem, MediaLibrary,
|
||||
};
|
||||
use crate::components::screen_header::{header_spacer, screen_header, screen_title};
|
||||
use crate::import_job::{self, ImportHost};
|
||||
use crate::sizing::{control, font};
|
||||
use crate::sizing::font;
|
||||
use crate::store_watch;
|
||||
use crate::theme::{ActiveTheme, Theme};
|
||||
|
||||
@@ -239,28 +238,8 @@ impl Render for VideoView {
|
||||
|
||||
impl VideoView {
|
||||
fn render_header(&self, theme: &Theme, cx: &mut Context<Self>) -> impl IntoElement + use<> {
|
||||
div()
|
||||
.flex()
|
||||
.flex_row()
|
||||
.items_center()
|
||||
.gap_3()
|
||||
.flex_none()
|
||||
.h(control::HEADER)
|
||||
.px_4()
|
||||
.border_b_1()
|
||||
.border_color(theme.border_default)
|
||||
.child(
|
||||
div()
|
||||
.flex_1()
|
||||
.min_w(px(0.))
|
||||
.overflow_hidden()
|
||||
.whitespace_nowrap()
|
||||
.text_xl()
|
||||
.font_weight(FontWeight::BOLD)
|
||||
.text_color(theme.text_primary)
|
||||
.child("Video"),
|
||||
)
|
||||
.child(import_trigger(
|
||||
screen_header(theme).child(screen_title(theme, "Video")).child(header_spacer()).child(
|
||||
import_trigger(
|
||||
theme,
|
||||
"video-import",
|
||||
"Import…",
|
||||
@@ -272,7 +251,8 @@ impl VideoView {
|
||||
cx.listener(|this, dir: &PathBuf, _, cx| {
|
||||
import_job::import_folder(this, dir.clone(), cx)
|
||||
}),
|
||||
))
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
fn render_body(&self, theme: &Theme) -> gpui::AnyElement {
|
||||
|
||||
Reference in new issue
Block a user