refactor: replace shell with root view wrapping app content
This commit is contained in:
@@ -10,13 +10,12 @@ use gpui::{
|
|||||||
use helpers::apply_appearance_mode;
|
use helpers::apply_appearance_mode;
|
||||||
use settings::SettingsStore;
|
use settings::SettingsStore;
|
||||||
use signed_state::{Backend, BackendEvent};
|
use signed_state::{Backend, BackendEvent};
|
||||||
use ui::common::h_flex;
|
use ui::common::{h_flex, v_flex};
|
||||||
use ui::icons::IconRole;
|
use ui::icons::IconRole;
|
||||||
use ui::layout::panel::PanelRow;
|
use ui::layout::panel::PanelRow;
|
||||||
use ui::layout::shell::Shell;
|
use ui::layout::root::Root;
|
||||||
use ui::layout::titlebar::Titlebar;
|
use ui::layout::titlebar::Titlebar;
|
||||||
use ui::theme::ActiveTheme as _;
|
use ui::toast::Toast;
|
||||||
use ui::toast::{Toast, Toasts};
|
|
||||||
|
|
||||||
use crate::app::placeholder::PlaceholderView;
|
use crate::app::placeholder::PlaceholderView;
|
||||||
use crate::app::sign_in::SignedOutView;
|
use crate::app::sign_in::SignedOutView;
|
||||||
@@ -32,7 +31,6 @@ use crate::workspace::Workspace;
|
|||||||
pub struct AppRoot {
|
pub struct AppRoot {
|
||||||
workspace: Entity<Workspace>,
|
workspace: Entity<Workspace>,
|
||||||
titlebar: Entity<TitlebarView>,
|
titlebar: Entity<TitlebarView>,
|
||||||
toasts: Entity<Toasts>,
|
|
||||||
sign_in: Entity<SignedOutView>,
|
sign_in: Entity<SignedOutView>,
|
||||||
explore: Entity<ExploreView>,
|
explore: Entity<ExploreView>,
|
||||||
empty: Entity<PlaceholderView>,
|
empty: Entity<PlaceholderView>,
|
||||||
@@ -47,7 +45,6 @@ impl AppRoot {
|
|||||||
let workspace = cx.new(|_| Workspace::new());
|
let workspace = cx.new(|_| Workspace::new());
|
||||||
let titlebar = cx.new(|cx| TitlebarView::new(workspace.downgrade(), window, cx));
|
let titlebar = cx.new(|cx| TitlebarView::new(workspace.downgrade(), window, cx));
|
||||||
|
|
||||||
let toasts = cx.new(|_| Toasts::default());
|
|
||||||
let sign_in = cx.new(|_| SignedOutView::new());
|
let sign_in = cx.new(|_| SignedOutView::new());
|
||||||
let explore = cx.new(|cx| ExploreView::new(workspace.downgrade(), cx));
|
let explore = cx.new(|cx| ExploreView::new(workspace.downgrade(), cx));
|
||||||
let empty = cx.new(|_| PlaceholderView::new("Select a repository"));
|
let empty = cx.new(|_| PlaceholderView::new("Select a repository"));
|
||||||
@@ -64,9 +61,7 @@ impl AppRoot {
|
|||||||
this.open_passphrase(cx);
|
this.open_passphrase(cx);
|
||||||
}
|
}
|
||||||
BackendEvent::Error(message) => {
|
BackendEvent::Error(message) => {
|
||||||
this.toasts.update(cx, |toasts, cx| {
|
Root::push_toast(Toast::new(message.clone()).icon(IconRole::Warning), cx);
|
||||||
toasts.push(Toast::new(message.clone()).icon(IconRole::Warning), cx);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
BackendEvent::SignerChanged => {
|
BackendEvent::SignerChanged => {
|
||||||
this.workspace.update(cx, |workspace, cx| {
|
this.workspace.update(cx, |workspace, cx| {
|
||||||
@@ -95,7 +90,6 @@ impl AppRoot {
|
|||||||
Self {
|
Self {
|
||||||
workspace,
|
workspace,
|
||||||
titlebar,
|
titlebar,
|
||||||
toasts,
|
|
||||||
sign_in,
|
sign_in,
|
||||||
explore,
|
explore,
|
||||||
empty,
|
empty,
|
||||||
@@ -105,8 +99,12 @@ impl AppRoot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn open_passphrase(&mut self, cx: &mut Context<Self>) {
|
fn open_passphrase(&mut self, cx: &mut Context<Self>) {
|
||||||
self.passphrase = Some(PassphraseDialog::new(cx));
|
if self.passphrase.is_some() {
|
||||||
cx.notify();
|
return;
|
||||||
|
}
|
||||||
|
let dialog = PassphraseDialog::new(cx);
|
||||||
|
self.passphrase = Some(dialog.clone());
|
||||||
|
Root::open_dialog(dialog, cx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,8 +120,6 @@ impl Render for AppRoot {
|
|||||||
div()
|
div()
|
||||||
.relative()
|
.relative()
|
||||||
.size_full()
|
.size_full()
|
||||||
.font_family(cx.theme().ui_font())
|
|
||||||
.text_color(cx.theme().colors.foreground)
|
|
||||||
.key_context(REPOSITORY_KEY_CONTEXT)
|
.key_context(REPOSITORY_KEY_CONTEXT)
|
||||||
.on_action(cx.listener(|this, action: &SwitchRepository, window, cx| {
|
.on_action(cx.listener(|this, action: &SwitchRepository, window, cx| {
|
||||||
this.titlebar.update(cx, |titlebar, cx| {
|
this.titlebar.update(cx, |titlebar, cx| {
|
||||||
@@ -136,8 +132,10 @@ impl Render for AppRoot {
|
|||||||
});
|
});
|
||||||
}))
|
}))
|
||||||
.child(
|
.child(
|
||||||
Shell::new("signed-shell")
|
v_flex()
|
||||||
.titlebar(
|
.size_full()
|
||||||
|
.overflow_hidden()
|
||||||
|
.child(
|
||||||
Titlebar::new("signed-titlebar")
|
Titlebar::new("signed-titlebar")
|
||||||
.prefix(
|
.prefix(
|
||||||
h_flex()
|
h_flex()
|
||||||
@@ -154,7 +152,7 @@ impl Render for AppRoot {
|
|||||||
titlebar.suffix(menu)
|
titlebar.suffix(menu)
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.panel(
|
.child(
|
||||||
PanelRow::new("signed-panel")
|
PanelRow::new("signed-panel")
|
||||||
.when_some(main.as_ref(), |row, main| {
|
.when_some(main.as_ref(), |row, main| {
|
||||||
row.main(main.clone()).when(workspace.has_details(), |row| {
|
row.main(main.clone()).when(workspace.has_details(), |row| {
|
||||||
@@ -168,11 +166,7 @@ impl Render for AppRoot {
|
|||||||
row.main(self.sign_in.clone())
|
row.main(self.sign_in.clone())
|
||||||
.split_at(self.explore.clone(), px(300.))
|
.split_at(self.explore.clone(), px(300.))
|
||||||
}),
|
}),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
.toasts(self.toasts.clone()),
|
|
||||||
)
|
|
||||||
.child(titlebar_view.palette())
|
|
||||||
.children(titlebar_view.dialogs())
|
|
||||||
.when_some(self.passphrase.clone(), |el, view| el.child(view))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ use ui::field::Field;
|
|||||||
use ui::icons::IconRole;
|
use ui::icons::IconRole;
|
||||||
use ui::input::{Input, InputState, InputStateEvent};
|
use ui::input::{Input, InputState, InputStateEvent};
|
||||||
|
|
||||||
use crate::shared::progress::{DialogProgress, dialog_submit_button, error_row, push_steps_row, run_dialog_task};
|
use crate::shared::progress::{
|
||||||
|
DialogProgress, dialog_submit_button, error_row, push_steps_row, run_dialog_task,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct PassphraseDialog {
|
pub struct PassphraseDialog {
|
||||||
handle: DialogHandle,
|
handle: DialogHandle,
|
||||||
|
|||||||
@@ -14,7 +14,12 @@ mod workspace;
|
|||||||
pub use app::AppRoot;
|
pub use app::AppRoot;
|
||||||
pub use app::helpers::apply_appearance_mode;
|
pub use app::helpers::apply_appearance_mode;
|
||||||
use gpui::{App, AppContext as _, Entity, Window};
|
use gpui::{App, AppContext as _, Entity, Window};
|
||||||
|
use ui::layout::root::Root;
|
||||||
|
|
||||||
pub fn root(window: &mut Window, cx: &mut App) -> Entity<AppRoot> {
|
pub fn root(window: &mut Window, cx: &mut App) -> Entity<Root> {
|
||||||
cx.new(|cx| AppRoot::new(window, cx))
|
let root = cx.new(|cx| Root::new(window, cx));
|
||||||
|
let content: Entity<AppRoot> = cx.new(|cx| AppRoot::new(window, cx));
|
||||||
|
|
||||||
|
root.update(cx, |root, cx| root.set_content(content, cx));
|
||||||
|
root
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,8 +78,10 @@ pub fn source_menu_items(
|
|||||||
.file_name()
|
.file_name()
|
||||||
.map(|name| name.to_string_lossy().into_owned())
|
.map(|name| name.to_string_lossy().into_owned())
|
||||||
.unwrap_or_else(|| path.display().to_string());
|
.unwrap_or_else(|| path.display().to_string());
|
||||||
|
|
||||||
let target = view.clone();
|
let target = view.clone();
|
||||||
let path_for_action = path.clone();
|
let path_for_action = path.clone();
|
||||||
|
|
||||||
items.push(
|
items.push(
|
||||||
MenuItem::new(truncate_label(&label))
|
MenuItem::new(truncate_label(&label))
|
||||||
.checked(active_path.as_ref() == Some(&path))
|
.checked(active_path.as_ref() == Some(&path))
|
||||||
@@ -114,14 +116,12 @@ pub fn source_menu_items(
|
|||||||
} else {
|
} else {
|
||||||
SharedString::from(format!("by {}", shorten_owner(&candidate.owner)))
|
SharedString::from(format!("by {}", shorten_owner(&candidate.owner)))
|
||||||
};
|
};
|
||||||
let title = format!(
|
|
||||||
"{} — {}",
|
let title = format!("{} — {}", announcement_display_name(&candidate), subtitle);
|
||||||
announcement_display_name(&candidate),
|
|
||||||
subtitle
|
|
||||||
);
|
|
||||||
let target = view.clone();
|
let target = view.clone();
|
||||||
let checked = active_fork == Some(candidate.addr());
|
let checked = active_fork == Some(candidate.addr());
|
||||||
let announcement = candidate;
|
let announcement = candidate;
|
||||||
|
|
||||||
items.push(
|
items.push(
|
||||||
MenuItem::new(truncate_label(&title))
|
MenuItem::new(truncate_label(&title))
|
||||||
.checked(checked)
|
.checked(checked)
|
||||||
@@ -136,5 +136,6 @@ pub fn source_menu_items(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
items
|
items
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -276,9 +276,7 @@ impl NewPullRequestView {
|
|||||||
let active_fork = self.fork.as_ref().map(|fork| fork.announcement.addr());
|
let active_fork = self.fork.as_ref().map(|fork| fork.announcement.addr());
|
||||||
let can_submit = self.submit_enabled(cx);
|
let can_submit = self.submit_enabled(cx);
|
||||||
let source_label = match &self.fork {
|
let source_label = match &self.fork {
|
||||||
Some(fork) => truncate_label(&announcement_display_name(
|
Some(fork) => truncate_label(&announcement_display_name(&fork.announcement)),
|
||||||
&fork.announcement,
|
|
||||||
)),
|
|
||||||
None => self.repo_path.as_ref().map_or_else(
|
None => self.repo_path.as_ref().map_or_else(
|
||||||
|| SharedString::from("No source"),
|
|| SharedString::from("No source"),
|
||||||
|path| truncate_label(&path.display().to_string()),
|
|path| truncate_label(&path.display().to_string()),
|
||||||
@@ -305,7 +303,10 @@ impl NewPullRequestView {
|
|||||||
.child(div().w(px(160.)).child(self.compare_select.clone())),
|
.child(div().w(px(160.)).child(self.compare_select.clone())),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
v_flex().gap_1().child(div().text_xs().font_medium().child("Source")).child(
|
v_flex()
|
||||||
|
.gap_1()
|
||||||
|
.child(div().text_xs().font_medium().child("Source"))
|
||||||
|
.child(
|
||||||
Menu::new("pr-source")
|
Menu::new("pr-source")
|
||||||
.open(self.source_open)
|
.open(self.source_open)
|
||||||
.on_change(move |open, _, cx| {
|
.on_change(move |open, _, cx| {
|
||||||
@@ -349,9 +350,7 @@ impl NewPullRequestView {
|
|||||||
.loading(self.submitting)
|
.loading(self.submitting)
|
||||||
.disabled(!can_submit)
|
.disabled(!can_submit)
|
||||||
.on_click(move |_, window, cx| {
|
.on_click(move |_, window, cx| {
|
||||||
log_dropped(
|
log_dropped(weak.update(cx, |this, cx| this.submit(window, cx)));
|
||||||
weak.update(cx, |this, cx| this.submit(window, cx)),
|
|
||||||
);
|
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.into_any_element()
|
.into_any_element()
|
||||||
@@ -385,9 +384,7 @@ impl NewPullRequestView {
|
|||||||
return Spinner::centered("new-pr-loading");
|
return Spinner::centered("new-pr-loading");
|
||||||
}
|
}
|
||||||
if !self.has_source() {
|
if !self.has_source() {
|
||||||
return EmptyState::centered(
|
return EmptyState::centered("Choose a local checkout or an announced fork to compare");
|
||||||
"Choose a local checkout or an announced fork to compare",
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if self.commits.is_none() && self.error.is_some() {
|
if self.commits.is_none() && self.error.is_some() {
|
||||||
return EmptyState::centered("Nothing to compare");
|
return EmptyState::centered("Nothing to compare");
|
||||||
|
|||||||
@@ -287,10 +287,7 @@ impl DiffPane {
|
|||||||
let view = view;
|
let view = view;
|
||||||
move |index, _, cx| {
|
move |index, _, cx| {
|
||||||
if let Err(error) = view.update(cx, |this, cx| {
|
if let Err(error) = view.update(cx, |this, cx| {
|
||||||
let id = this
|
let id = this.rows.get(index).map(|row| row.key().to_string());
|
||||||
.rows
|
|
||||||
.get(index)
|
|
||||||
.map(|row| row.key().to_string());
|
|
||||||
if let Some(id) = id {
|
if let Some(id) = id {
|
||||||
this.toggle_folder(&id, cx);
|
this.toggle_folder(&id, cx);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ use ui::tooltip::Tooltip;
|
|||||||
|
|
||||||
use super::grasp_servers::{GraspServersState, grasp_servers_field, load_user_grasp_servers};
|
use super::grasp_servers::{GraspServersState, grasp_servers_field, load_user_grasp_servers};
|
||||||
use crate::repo::actions::open_repo_panel;
|
use crate::repo::actions::open_repo_panel;
|
||||||
use crate::shared::progress::{DialogProgress, dialog_submit_button, error_row, push_steps_row, run_dialog_task_with};
|
use crate::shared::progress::{
|
||||||
|
DialogProgress, dialog_submit_button, error_row, push_steps_row, run_dialog_task_with,
|
||||||
|
};
|
||||||
use crate::workspace::Workspace;
|
use crate::workspace::Workspace;
|
||||||
|
|
||||||
/// Progress of the create-repository flow, so async results can be rendered.
|
/// Progress of the create-repository flow, so async results can be rendered.
|
||||||
|
|||||||
@@ -20,7 +20,9 @@ use ui::theme::ActiveTheme as _;
|
|||||||
|
|
||||||
use super::grasp_servers::{GraspServersState, grasp_servers_field, load_user_grasp_servers};
|
use super::grasp_servers::{GraspServersState, grasp_servers_field, load_user_grasp_servers};
|
||||||
use crate::repo::RepoDetailView;
|
use crate::repo::RepoDetailView;
|
||||||
use crate::shared::progress::{DialogProgress, dialog_submit_button, error_row, push_steps_row, run_dialog_task_with};
|
use crate::shared::progress::{
|
||||||
|
DialogProgress, dialog_submit_button, error_row, push_steps_row, run_dialog_task_with,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct InitRepoDialog {
|
pub struct InitRepoDialog {
|
||||||
handle: DialogHandle,
|
handle: DialogHandle,
|
||||||
|
|||||||
@@ -119,10 +119,7 @@ impl RepoFilesView {
|
|||||||
|
|
||||||
fn rebuild_rows(&mut self) {
|
fn rebuild_rows(&mut self) {
|
||||||
self.rows = TreeItemSeed::flatten_all(&self.seeds, &self.expanded);
|
self.rows = TreeItemSeed::flatten_all(&self.seeds, &self.expanded);
|
||||||
self.selected_index = self
|
self.selected_index = self.selected_file.as_ref().and_then(|path| {
|
||||||
.selected_file
|
|
||||||
.as_ref()
|
|
||||||
.and_then(|path| {
|
|
||||||
self.rows
|
self.rows
|
||||||
.iter()
|
.iter()
|
||||||
.position(|row| row.key().to_string() == path.as_ref())
|
.position(|row| row.key().to_string() == path.as_ref())
|
||||||
@@ -281,10 +278,7 @@ impl RepoFilesView {
|
|||||||
let view = disclosure_view;
|
let view = disclosure_view;
|
||||||
move |index, _, cx| {
|
move |index, _, cx| {
|
||||||
if let Err(error) = view.update(cx, |this, cx| {
|
if let Err(error) = view.update(cx, |this, cx| {
|
||||||
let id = this
|
let id = this.rows.get(index).map(|row| row.key().to_string());
|
||||||
.rows
|
|
||||||
.get(index)
|
|
||||||
.map(|row| row.key().to_string());
|
|
||||||
if let Some(id) = id {
|
if let Some(id) = id {
|
||||||
this.toggle_folder(&id);
|
this.toggle_folder(&id);
|
||||||
cx.emit(RepoFilesEvent::Activated);
|
cx.emit(RepoFilesEvent::Activated);
|
||||||
@@ -310,9 +304,9 @@ impl RepoFilesView {
|
|||||||
self.code_element(path.as_ref())
|
self.code_element(path.as_ref())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(FileContent::Binary) => EmptyState::centered(
|
Some(FileContent::Binary) => {
|
||||||
"Binary file - preview not supported",
|
EmptyState::centered("Binary file - preview not supported")
|
||||||
),
|
}
|
||||||
Some(FileContent::TooLarge) => EmptyState::centered("File is too large to preview"),
|
Some(FileContent::TooLarge) => EmptyState::centered("File is too large to preview"),
|
||||||
Some(FileContent::Failed(message)) => EmptyState::centered(message),
|
Some(FileContent::Failed(message)) => EmptyState::centered(message),
|
||||||
None => Spinner::centered("repo-preview-spinner"),
|
None => Spinner::centered("repo-preview-spinner"),
|
||||||
|
|||||||
@@ -174,7 +174,10 @@ pub(super) fn nostr_clone_url(announcement: &Announcement, nip05: Option<&str>)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// The display name of the announcement addressing `addr`, falling back to its identifier.
|
/// The display name of the announcement addressing `addr`, falling back to its identifier.
|
||||||
pub(crate) fn upstream_display_name(addr: &RepoAddr, announcements: &[Announcement]) -> SharedString {
|
pub(crate) fn upstream_display_name(
|
||||||
|
addr: &RepoAddr,
|
||||||
|
announcements: &[Announcement],
|
||||||
|
) -> SharedString {
|
||||||
announcements
|
announcements
|
||||||
.iter()
|
.iter()
|
||||||
.find(|a| a.addr() == *addr)
|
.find(|a| a.addr() == *addr)
|
||||||
@@ -195,10 +198,8 @@ pub(super) fn fork_row(
|
|||||||
|
|
||||||
let (label, clickable) = match &upstream.addr {
|
let (label, clickable) = match &upstream.addr {
|
||||||
Some(addr) => {
|
Some(addr) => {
|
||||||
let name = upstream_display_name(
|
let name =
|
||||||
addr,
|
upstream_display_name(addr, &RepoListStore::global(cx).read(cx).announcements);
|
||||||
&RepoListStore::global(cx).read(cx).announcements,
|
|
||||||
);
|
|
||||||
(SharedString::from(format!("Forked from {name}")), true)
|
(SharedString::from(format!("Forked from {name}")), true)
|
||||||
}
|
}
|
||||||
None => (SharedString::from(upstream.display().as_str()), false),
|
None => (SharedString::from(upstream.display().as_str()), false),
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ pub mod refs;
|
|||||||
|
|
||||||
use files::RepoFilesView;
|
use files::RepoFilesView;
|
||||||
use helpers::{
|
use helpers::{
|
||||||
RepoData, announcement_display_name, bound_repo_label, clone_group, fork_row,
|
RepoData, announcement_display_name, bound_repo_label, clone_group, fork_row, load_repo_data,
|
||||||
load_repo_data, nostr_clone_url, repo_display_name, snapshot_worktree,
|
nostr_clone_url, repo_display_name, snapshot_worktree,
|
||||||
};
|
};
|
||||||
use history::RepoHistoryView;
|
use history::RepoHistoryView;
|
||||||
use refs::RefSwitcher;
|
use refs::RefSwitcher;
|
||||||
@@ -52,11 +52,10 @@ use utils::relative_time_secs;
|
|||||||
|
|
||||||
use crate::issues::IssuesView;
|
use crate::issues::IssuesView;
|
||||||
use crate::pull_requests::PullRequestsView;
|
use crate::pull_requests::PullRequestsView;
|
||||||
|
use crate::repo::helpers::{short_id, sorted_worktree_paths};
|
||||||
use crate::shared::log_dropped;
|
use crate::shared::log_dropped;
|
||||||
use crate::workspace::Workspace;
|
use crate::workspace::Workspace;
|
||||||
|
|
||||||
use crate::repo::helpers::{short_id, sorted_worktree_paths};
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||||
pub(super) enum RepoSection {
|
pub(super) enum RepoSection {
|
||||||
Files,
|
Files,
|
||||||
@@ -479,6 +478,7 @@ impl RepoDetailView {
|
|||||||
if let Ok(Some((moved, snapshot))) = refresh {
|
if let Ok(Some((moved, snapshot))) = refresh {
|
||||||
let branches: Vec<SharedString> =
|
let branches: Vec<SharedString> =
|
||||||
snapshot.branches.iter().map(Into::into).collect();
|
snapshot.branches.iter().map(Into::into).collect();
|
||||||
|
|
||||||
let tags: Vec<SharedString> = snapshot.tags.iter().map(Into::into).collect();
|
let tags: Vec<SharedString> = snapshot.tags.iter().map(Into::into).collect();
|
||||||
let current_branch = snapshot.current_branch.clone();
|
let current_branch = snapshot.current_branch.clone();
|
||||||
let head_commit = snapshot.head_commit.clone();
|
let head_commit = snapshot.head_commit.clone();
|
||||||
|
|||||||
@@ -96,14 +96,7 @@ pub fn open_primary<P, F>(
|
|||||||
P: Panel + 'static,
|
P: Panel + 'static,
|
||||||
F: Fn(&mut Window, &mut App) -> Entity<P> + 'static,
|
F: Fn(&mut Window, &mut App) -> Entity<P> + 'static,
|
||||||
{
|
{
|
||||||
open_slot(
|
open_slot(PanelSlot::Main, workspace, id, build, window, cx);
|
||||||
PanelSlot::Main,
|
|
||||||
workspace,
|
|
||||||
id,
|
|
||||||
build,
|
|
||||||
window,
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Opens a detail panel beside the main panel, reusing it when it is already cached.
|
/// Opens a detail panel beside the main panel, reusing it when it is already cached.
|
||||||
@@ -117,12 +110,5 @@ pub fn open_detail<P, F>(
|
|||||||
P: Panel + 'static,
|
P: Panel + 'static,
|
||||||
F: Fn(&mut Window, &mut App) -> Entity<P> + 'static,
|
F: Fn(&mut Window, &mut App) -> Entity<P> + 'static,
|
||||||
{
|
{
|
||||||
open_slot(
|
open_slot(PanelSlot::Detail, workspace, id, build, window, cx);
|
||||||
PanelSlot::Detail,
|
|
||||||
workspace,
|
|
||||||
id,
|
|
||||||
build,
|
|
||||||
window,
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ use std::rc::Rc;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use gpui::{
|
use gpui::{
|
||||||
AnyElement, AnyView, App, AppContext as _, Context, Entity, IntoElement, KeyBinding,
|
AnyElement, App, AppContext as _, Context, Entity, IntoElement, KeyBinding,
|
||||||
KeyBindingContextPredicate, ParentElement as _, SharedString, Subscription, WeakEntity, Window,
|
KeyBindingContextPredicate, ParentElement as _, SharedString, Subscription, WeakEntity, Window,
|
||||||
};
|
};
|
||||||
use metadata::{Profile, ProfileDirectory};
|
use metadata::{Profile, ProfileDirectory};
|
||||||
@@ -16,6 +16,7 @@ use ui::button::{Button, ButtonVariant};
|
|||||||
use ui::command_palette::{Command, CommandPalette, CommandPaletteState};
|
use ui::command_palette::{Command, CommandPalette, CommandPaletteState};
|
||||||
use ui::icons::{Icon, IconRole};
|
use ui::icons::{Icon, IconRole};
|
||||||
use ui::layout::panel::PanelView;
|
use ui::layout::panel::PanelView;
|
||||||
|
use ui::layout::root::Root;
|
||||||
use ui::menu::{Menu, MenuItem};
|
use ui::menu::{Menu, MenuItem};
|
||||||
use ui::tabs::{Tab, Tabs, TabsVariant};
|
use ui::tabs::{Tab, Tabs, TabsVariant};
|
||||||
use ui::tooltip::Tooltip;
|
use ui::tooltip::Tooltip;
|
||||||
@@ -65,12 +66,7 @@ pub struct TitlebarView {
|
|||||||
local_repos: Arc<Vec<ResolvedLocalRepo>>,
|
local_repos: Arc<Vec<ResolvedLocalRepo>>,
|
||||||
/// Profiles rendered by the repository switcher.
|
/// Profiles rendered by the repository switcher.
|
||||||
directory: Entity<ProfileDirectory>,
|
directory: Entity<ProfileDirectory>,
|
||||||
/// The command palette opened from the titlebar.
|
|
||||||
palette: Entity<CommandPaletteState>,
|
|
||||||
repository_switcher: Entity<RepositorySwitcher>,
|
repository_switcher: Entity<RepositorySwitcher>,
|
||||||
settings: Option<Entity<SettingsDialog>>,
|
|
||||||
exit: Option<Entity<ExitDialog>>,
|
|
||||||
create: Option<Entity<dialogs::create::CreateRepoDialog>>,
|
|
||||||
user_menu_open: bool,
|
user_menu_open: bool,
|
||||||
_subscriptions: Vec<Subscription>,
|
_subscriptions: Vec<Subscription>,
|
||||||
}
|
}
|
||||||
@@ -84,10 +80,10 @@ impl TitlebarView {
|
|||||||
let backend = Backend::global(cx);
|
let backend = Backend::global(cx);
|
||||||
let repos = RepoListStore::global(cx);
|
let repos = RepoListStore::global(cx);
|
||||||
let local = LocalReposStore::global(cx);
|
let local = LocalReposStore::global(cx);
|
||||||
|
let directory = ProfileDirectory::new(cx);
|
||||||
|
|
||||||
let weak = cx.entity().downgrade();
|
let weak = cx.entity().downgrade();
|
||||||
let palette = Self::new_palette(weak.clone(), window, cx);
|
Root::open_dialog(Self::new_palette(weak.clone(), window, cx), cx);
|
||||||
let directory = ProfileDirectory::new(cx);
|
|
||||||
|
|
||||||
let entity = cx.entity();
|
let entity = cx.entity();
|
||||||
let mut subscriptions = Vec::new();
|
let mut subscriptions = Vec::new();
|
||||||
@@ -156,11 +152,7 @@ impl TitlebarView {
|
|||||||
announcements: Arc::new(Vec::new()),
|
announcements: Arc::new(Vec::new()),
|
||||||
local_repos: Arc::new(Vec::new()),
|
local_repos: Arc::new(Vec::new()),
|
||||||
directory,
|
directory,
|
||||||
palette,
|
|
||||||
repository_switcher,
|
repository_switcher,
|
||||||
settings: None,
|
|
||||||
exit: None,
|
|
||||||
create: None,
|
|
||||||
user_menu_open: false,
|
user_menu_open: false,
|
||||||
_subscriptions: subscriptions,
|
_subscriptions: subscriptions,
|
||||||
}
|
}
|
||||||
@@ -215,10 +207,6 @@ impl TitlebarView {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn palette(&self) -> Entity<CommandPaletteState> {
|
|
||||||
self.palette.clone()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn refresh(&mut self, cx: &mut Context<Self>) -> bool {
|
fn refresh(&mut self, cx: &mut Context<Self>) -> bool {
|
||||||
let backend = Backend::global(cx);
|
let backend = Backend::global(cx);
|
||||||
let user = backend.read(cx).current_user();
|
let user = backend.read(cx).current_user();
|
||||||
@@ -377,33 +365,21 @@ impl TitlebarView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn open_settings(&mut self, cx: &mut Context<Self>) {
|
fn open_settings(&mut self, cx: &mut Context<Self>) {
|
||||||
self.settings = Some(SettingsDialog::new(cx));
|
Root::open_dialog(SettingsDialog::new(cx), cx);
|
||||||
cx.notify();
|
cx.notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn open_exit(&mut self, cx: &mut Context<Self>) {
|
fn open_exit(&mut self, cx: &mut Context<Self>) {
|
||||||
self.exit = Some(ExitDialog::new(cx));
|
Root::open_dialog(ExitDialog::new(cx), cx);
|
||||||
cx.notify();
|
cx.notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn open_create(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
fn open_create(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
||||||
let view = dialogs::create::CreateRepoDialog::new(self.workspace.clone(), window, cx);
|
let view = dialogs::create::CreateRepoDialog::new(self.workspace.clone(), window, cx);
|
||||||
self.create = Some(view);
|
Root::open_dialog(view, cx);
|
||||||
cx.notify();
|
cx.notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The dialogs this titlebar opens, rendered at the window root.
|
|
||||||
pub fn dialogs(&self) -> Vec<AnyView> {
|
|
||||||
[
|
|
||||||
self.settings.clone().map(Into::into),
|
|
||||||
self.exit.clone().map(Into::into),
|
|
||||||
self.create.clone().map(Into::into),
|
|
||||||
]
|
|
||||||
.into_iter()
|
|
||||||
.flatten()
|
|
||||||
.collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn activate(&mut self, index: usize, window: &mut Window, cx: &mut Context<Self>) {
|
fn activate(&mut self, index: usize, window: &mut Window, cx: &mut Context<Self>) {
|
||||||
if let Some(announcement) = self.announcements.get(index) {
|
if let Some(announcement) = self.announcements.get(index) {
|
||||||
let addr = announcement.addr();
|
let addr = announcement.addr();
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ pub use crate::components::common::{StyledExt, focus_handle, focus_ring, h_flex,
|
|||||||
pub mod panel;
|
pub mod panel;
|
||||||
pub mod resizable;
|
pub mod resizable;
|
||||||
pub mod resize_handle;
|
pub mod resize_handle;
|
||||||
pub mod shell;
|
pub mod root;
|
||||||
pub mod titlebar;
|
pub mod titlebar;
|
||||||
pub mod window_controls;
|
pub mod window_controls;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,158 @@
|
|||||||
|
//! The window root: application content in the client-side frame, with the
|
||||||
|
//! toast, alert, and dialog overlays the root itself owns mounted above it.
|
||||||
|
//!
|
||||||
|
//! Applications mount [`Root`] as the window's root view and set their content
|
||||||
|
//! entity; the root owns the frame, the background, the floating surfaces, and
|
||||||
|
//! their layering. Code anywhere presents dialogs or pushes toasts through the
|
||||||
|
//! static helpers, which reach the mounted root via its global.
|
||||||
|
|
||||||
|
use gpui::prelude::FluentBuilder as _;
|
||||||
|
use gpui::{
|
||||||
|
AnyView, App, AppContext as _, Context, Entity, Global, IntoElement, ParentElement as _,
|
||||||
|
Render, StyleRefinement, Styled, WeakEntity, Window, div,
|
||||||
|
};
|
||||||
|
|
||||||
|
use crate::components::alert::{Alerts, AlertsView};
|
||||||
|
use crate::components::grain::grain as grain_overlay;
|
||||||
|
use crate::components::toast::{Toasts, ToastsView};
|
||||||
|
use crate::layout::window_frame::frame;
|
||||||
|
use crate::layout::{StyledExt as _, v_flex};
|
||||||
|
use crate::theme::ActiveTheme as _;
|
||||||
|
|
||||||
|
/// The mounted root's handle, for access from anywhere.
|
||||||
|
struct RootGlobal {
|
||||||
|
root: WeakEntity<Root>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Global for RootGlobal {}
|
||||||
|
|
||||||
|
/// The window's content and floating-surface host.
|
||||||
|
pub struct Root {
|
||||||
|
content: Option<AnyView>,
|
||||||
|
dialogs: Vec<AnyView>,
|
||||||
|
toasts: Entity<Toasts>,
|
||||||
|
alerts: Entity<Alerts>,
|
||||||
|
transparent: bool,
|
||||||
|
grain: bool,
|
||||||
|
style: StyleRefinement,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Root {
|
||||||
|
/// Creates the root and its toast and alert stores.
|
||||||
|
pub fn new(_window: &mut Window, cx: &mut Context<Self>) -> Self {
|
||||||
|
let toasts = cx.new(|_| Toasts::default());
|
||||||
|
let alerts = cx.new(|_| Alerts::default());
|
||||||
|
let weak = cx.weak_entity();
|
||||||
|
cx.set_global(RootGlobal { root: weak });
|
||||||
|
|
||||||
|
Self {
|
||||||
|
content: None,
|
||||||
|
dialogs: Vec::new(),
|
||||||
|
toasts,
|
||||||
|
alerts,
|
||||||
|
transparent: false,
|
||||||
|
grain: false,
|
||||||
|
style: StyleRefinement::default(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The mounted root, if the window has opened one.
|
||||||
|
pub fn global(cx: &App) -> Option<Entity<Self>> {
|
||||||
|
cx.try_global::<RootGlobal>()
|
||||||
|
.and_then(|global| global.root.upgrade())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Sets the application content view.
|
||||||
|
pub fn set_content(&mut self, content: impl Into<AnyView>, cx: &mut Context<Self>) {
|
||||||
|
self.content = Some(content.into());
|
||||||
|
cx.notify();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The root's toast store.
|
||||||
|
pub fn toasts(&self) -> Entity<Toasts> {
|
||||||
|
self.toasts.clone()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The root's alert store.
|
||||||
|
pub fn alerts(&self) -> Entity<Alerts> {
|
||||||
|
self.alerts.clone()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Presents a dialog view at the window root, from anywhere.
|
||||||
|
pub fn open_dialog(view: impl Into<AnyView>, cx: &mut App) {
|
||||||
|
if let Some(root) = Self::global(cx) {
|
||||||
|
root.update(cx, |root, cx| root.mount_dialog(view, cx));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Pushes a toast on the root's store, from anywhere.
|
||||||
|
pub fn push_toast(toast: crate::components::toast::Toast, cx: &mut App) {
|
||||||
|
if let Some(root) = Self::global(cx) {
|
||||||
|
let toasts = root.read(cx).toasts();
|
||||||
|
toasts.update(cx, |toasts, cx| toasts.push(toast, cx));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Mounts a dialog view above the content.
|
||||||
|
fn mount_dialog(&mut self, view: impl Into<AnyView>, cx: &mut Context<Self>) {
|
||||||
|
self.dialogs.push(view.into());
|
||||||
|
cx.notify();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Paints the app background with the translucent material fill.
|
||||||
|
pub fn transparent(mut self, transparent: bool) -> Self {
|
||||||
|
self.transparent = transparent;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Textures the app background with a film-grain overlay.
|
||||||
|
pub fn grain(mut self, grain: bool) -> Self {
|
||||||
|
self.grain = grain;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Styled for Root {
|
||||||
|
fn style(&mut self) -> &mut StyleRefinement {
|
||||||
|
&mut self.style
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Render for Root {
|
||||||
|
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||||
|
let theme = cx.theme();
|
||||||
|
let background = if self.transparent {
|
||||||
|
theme.material.background
|
||||||
|
} else {
|
||||||
|
theme.colors.muted
|
||||||
|
};
|
||||||
|
|
||||||
|
div()
|
||||||
|
.relative()
|
||||||
|
.size_full()
|
||||||
|
.font_family(theme.ui_font())
|
||||||
|
.text_color(theme.colors.foreground)
|
||||||
|
.child(frame(
|
||||||
|
v_flex()
|
||||||
|
.w_full()
|
||||||
|
.h_full()
|
||||||
|
.overflow_hidden()
|
||||||
|
.bg(background)
|
||||||
|
.refine_style(&self.style)
|
||||||
|
.when(self.transparent && self.grain, |layout| {
|
||||||
|
layout.child(grain_overlay())
|
||||||
|
})
|
||||||
|
.child(
|
||||||
|
self.content
|
||||||
|
.clone()
|
||||||
|
.map(AnyView::into_any_element)
|
||||||
|
.unwrap_or_else(|| div().into_any_element()),
|
||||||
|
),
|
||||||
|
window,
|
||||||
|
cx,
|
||||||
|
))
|
||||||
|
.children(self.dialogs.clone())
|
||||||
|
.child(ToastsView::new("root-toasts", self.toasts.clone()))
|
||||||
|
.child(AlertsView::new("root-alerts", self.alerts.clone()))
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,132 +0,0 @@
|
|||||||
//! The application shell: the titlebar above the panel row, wrapped in the
|
|
||||||
//! client-side window frame, with the toast and alert overlays mounted at
|
|
||||||
//! the window root.
|
|
||||||
|
|
||||||
use gpui::prelude::FluentBuilder as _;
|
|
||||||
use gpui::{
|
|
||||||
AnyElement, App, ElementId, Entity, IntoElement, ParentElement as _, RenderOnce,
|
|
||||||
StyleRefinement, Styled as _, Window, div,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::components::alert::{Alerts, AlertsView};
|
|
||||||
use crate::components::grain::grain as grain_overlay;
|
|
||||||
use crate::components::toast::{Toasts, ToastsView};
|
|
||||||
use crate::layout::titlebar::Titlebar;
|
|
||||||
use crate::layout::window_frame::frame;
|
|
||||||
use crate::layout::{StyledExt as _, v_flex};
|
|
||||||
use crate::theme::ActiveTheme as _;
|
|
||||||
|
|
||||||
/// The application shell.
|
|
||||||
#[derive(IntoElement)]
|
|
||||||
#[must_use]
|
|
||||||
pub struct Shell {
|
|
||||||
id: ElementId,
|
|
||||||
titlebar: Option<Titlebar>,
|
|
||||||
panel: Option<AnyElement>,
|
|
||||||
transparent: bool,
|
|
||||||
grain: bool,
|
|
||||||
toasts: Option<Entity<Toasts>>,
|
|
||||||
alerts: Option<Entity<Alerts>>,
|
|
||||||
style: StyleRefinement,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Shell {
|
|
||||||
/// Creates the shell.
|
|
||||||
pub fn new<I>(id: I) -> Self
|
|
||||||
where
|
|
||||||
I: Into<ElementId>,
|
|
||||||
{
|
|
||||||
Self {
|
|
||||||
id: id.into(),
|
|
||||||
titlebar: None,
|
|
||||||
panel: None,
|
|
||||||
transparent: false,
|
|
||||||
grain: false,
|
|
||||||
toasts: None,
|
|
||||||
alerts: None,
|
|
||||||
style: StyleRefinement::default(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Sets the titlebar drawn above the panel row.
|
|
||||||
pub fn titlebar(mut self, titlebar: Titlebar) -> Self {
|
|
||||||
self.titlebar = Some(titlebar);
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Sets the panel row filling the rest of the window.
|
|
||||||
pub fn panel<E>(mut self, panel: E) -> Self
|
|
||||||
where
|
|
||||||
E: IntoElement,
|
|
||||||
{
|
|
||||||
self.panel = Some(panel.into_any_element());
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Paints the app background with the translucent material fill.
|
|
||||||
pub fn transparent(mut self, transparent: bool) -> Self {
|
|
||||||
self.transparent = transparent;
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Textures the app background with a film-grain overlay.
|
|
||||||
pub fn grain(mut self, grain: bool) -> Self {
|
|
||||||
self.grain = grain;
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Hosts the toast overlay raised on `toasts`.
|
|
||||||
pub fn toasts(mut self, toasts: Entity<Toasts>) -> Self {
|
|
||||||
self.toasts = Some(toasts);
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Hosts the alert overlay stacked on `alerts`.
|
|
||||||
pub fn alerts(mut self, alerts: Entity<Alerts>) -> Self {
|
|
||||||
self.alerts = Some(alerts);
|
|
||||||
self
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl gpui::Styled for Shell {
|
|
||||||
fn style(&mut self) -> &mut StyleRefinement {
|
|
||||||
&mut self.style
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl RenderOnce for Shell {
|
|
||||||
fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement {
|
|
||||||
let id = self.id.clone();
|
|
||||||
let theme = cx.theme();
|
|
||||||
|
|
||||||
let background = if self.transparent {
|
|
||||||
theme.material.background
|
|
||||||
} else {
|
|
||||||
theme.colors.muted
|
|
||||||
};
|
|
||||||
|
|
||||||
frame(
|
|
||||||
v_flex()
|
|
||||||
.w_full()
|
|
||||||
.h_full()
|
|
||||||
.overflow_hidden()
|
|
||||||
.bg(background)
|
|
||||||
.refine_style(&self.style)
|
|
||||||
.when(self.transparent && self.grain, |layout| {
|
|
||||||
layout.child(grain_overlay())
|
|
||||||
})
|
|
||||||
.when_some(self.titlebar, |layout, titlebar| {
|
|
||||||
layout.child(titlebar.transparent(self.transparent))
|
|
||||||
})
|
|
||||||
.child(self.panel.unwrap_or_else(|| div().into_any_element())),
|
|
||||||
window,
|
|
||||||
cx,
|
|
||||||
)
|
|
||||||
.when_some(self.toasts, |frame, toasts| {
|
|
||||||
frame.child(ToastsView::new((id.clone(), "toasts"), toasts))
|
|
||||||
})
|
|
||||||
.when_some(self.alerts, |frame, alerts| {
|
|
||||||
frame.child(AlertsView::new((id, "alerts"), alerts))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -22,7 +22,6 @@ pub struct Titlebar {
|
|||||||
prefix: Vec<AnyElement>,
|
prefix: Vec<AnyElement>,
|
||||||
tab_bar: Option<AnyElement>,
|
tab_bar: Option<AnyElement>,
|
||||||
suffix: Vec<AnyElement>,
|
suffix: Vec<AnyElement>,
|
||||||
transparent: bool,
|
|
||||||
style: StyleRefinement,
|
style: StyleRefinement,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,7 +36,6 @@ impl Titlebar {
|
|||||||
prefix: Vec::new(),
|
prefix: Vec::new(),
|
||||||
tab_bar: None,
|
tab_bar: None,
|
||||||
suffix: Vec::new(),
|
suffix: Vec::new(),
|
||||||
transparent: false,
|
|
||||||
style: StyleRefinement::default(),
|
style: StyleRefinement::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -68,12 +66,6 @@ impl Titlebar {
|
|||||||
self.suffix = vec![suffix.into_any_element()];
|
self.suffix = vec![suffix.into_any_element()];
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Leaves the strip unpainted so the shell's material backdrop shows through.
|
|
||||||
pub(crate) fn transparent(mut self, transparent: bool) -> Self {
|
|
||||||
self.transparent = transparent;
|
|
||||||
self
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl gpui::Styled for Titlebar {
|
impl gpui::Styled for Titlebar {
|
||||||
@@ -99,7 +91,7 @@ impl RenderOnce for Titlebar {
|
|||||||
.w_full()
|
.w_full()
|
||||||
.h(height)
|
.h(height)
|
||||||
.gap_2()
|
.gap_2()
|
||||||
.when(!self.transparent, |bar| bar.bg(theme.colors.muted))
|
.bg(theme.colors.muted)
|
||||||
.px_3()
|
.px_3()
|
||||||
.refine_style(&self.style)
|
.refine_style(&self.style)
|
||||||
.when(cfg!(target_os = "macos"), |bar| bar.pl(TRAFFIC_LIGHT_PAD))
|
.when(cfg!(target_os = "macos"), |bar| bar.pl(TRAFFIC_LIGHT_PAD))
|
||||||
|
|||||||
Reference in New Issue
Block a user