diff --git a/Cargo.lock b/Cargo.lock index ac9d52c..5e547cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2397,7 +2397,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7518b930f6aeb75e871d32ce873c2ae46e35cef19b5a0b039d4337f651d897cd" dependencies = [ "bstr", - "hashbrown 0.17.1", + "hashbrown 0.16.1", ] [[package]] @@ -3059,7 +3059,7 @@ dependencies = [ [[package]] name = "gpui-native-core" version = "0.1.0" -source = "git+https://git.reya.info/reya/gpui-native-kit?rev=6667c812597bd2adf415d29a4e50355bb3bf06ee#6667c812597bd2adf415d29a4e50355bb3bf06ee" +source = "git+https://git.reya.info/reya/gpui-native-kit?rev=dad833f998fecc0d828e716f3cbf0342d499db81#dad833f998fecc0d828e716f3cbf0342d499db81" dependencies = [ "cpal", "flume 0.12.0", @@ -3074,7 +3074,7 @@ dependencies = [ [[package]] name = "gpui-native-data" version = "0.1.0" -source = "git+https://git.reya.info/reya/gpui-native-kit?rev=6667c812597bd2adf415d29a4e50355bb3bf06ee#6667c812597bd2adf415d29a4e50355bb3bf06ee" +source = "git+https://git.reya.info/reya/gpui-native-kit?rev=dad833f998fecc0d828e716f3cbf0342d499db81#dad833f998fecc0d828e716f3cbf0342d499db81" dependencies = [ "gpui", "gpui-native-core", @@ -3086,7 +3086,7 @@ dependencies = [ [[package]] name = "gpui-native-editor" version = "0.1.0" -source = "git+https://git.reya.info/reya/gpui-native-kit?rev=6667c812597bd2adf415d29a4e50355bb3bf06ee#6667c812597bd2adf415d29a4e50355bb3bf06ee" +source = "git+https://git.reya.info/reya/gpui-native-kit?rev=dad833f998fecc0d828e716f3cbf0342d499db81#dad833f998fecc0d828e716f3cbf0342d499db81" dependencies = [ "gpui", "gpui-native-core", @@ -3105,7 +3105,7 @@ dependencies = [ [[package]] name = "gpui-native-icons" version = "0.1.0" -source = "git+https://git.reya.info/reya/gpui-native-kit?rev=6667c812597bd2adf415d29a4e50355bb3bf06ee#6667c812597bd2adf415d29a4e50355bb3bf06ee" +source = "git+https://git.reya.info/reya/gpui-native-kit?rev=dad833f998fecc0d828e716f3cbf0342d499db81#dad833f998fecc0d828e716f3cbf0342d499db81" dependencies = [ "anyhow", "gpui", @@ -3114,7 +3114,7 @@ dependencies = [ [[package]] name = "gpui-native-kit" version = "0.1.0" -source = "git+https://git.reya.info/reya/gpui-native-kit?rev=6667c812597bd2adf415d29a4e50355bb3bf06ee#6667c812597bd2adf415d29a4e50355bb3bf06ee" +source = "git+https://git.reya.info/reya/gpui-native-kit?rev=dad833f998fecc0d828e716f3cbf0342d499db81#dad833f998fecc0d828e716f3cbf0342d499db81" dependencies = [ "gpui", "gpui-native-core", @@ -3128,7 +3128,7 @@ dependencies = [ [[package]] name = "gpui-native-layout" version = "0.1.0" -source = "git+https://git.reya.info/reya/gpui-native-kit?rev=6667c812597bd2adf415d29a4e50355bb3bf06ee#6667c812597bd2adf415d29a4e50355bb3bf06ee" +source = "git+https://git.reya.info/reya/gpui-native-kit?rev=dad833f998fecc0d828e716f3cbf0342d499db81#dad833f998fecc0d828e716f3cbf0342d499db81" dependencies = [ "gpui", "gpui-native-core", @@ -3141,7 +3141,7 @@ dependencies = [ [[package]] name = "gpui-native-theme" version = "0.1.0" -source = "git+https://git.reya.info/reya/gpui-native-kit?rev=6667c812597bd2adf415d29a4e50355bb3bf06ee#6667c812597bd2adf415d29a4e50355bb3bf06ee" +source = "git+https://git.reya.info/reya/gpui-native-kit?rev=dad833f998fecc0d828e716f3cbf0342d499db81#dad833f998fecc0d828e716f3cbf0342d499db81" dependencies = [ "anyhow", "async-channel", @@ -3162,7 +3162,7 @@ dependencies = [ [[package]] name = "gpui-native-utils" version = "0.1.0" -source = "git+https://git.reya.info/reya/gpui-native-kit?rev=6667c812597bd2adf415d29a4e50355bb3bf06ee#6667c812597bd2adf415d29a4e50355bb3bf06ee" +source = "git+https://git.reya.info/reya/gpui-native-kit?rev=dad833f998fecc0d828e716f3cbf0342d499db81#dad833f998fecc0d828e716f3cbf0342d499db81" dependencies = [ "gpui", "gpui-native-theme", diff --git a/Cargo.toml b/Cargo.toml index 93cb783..09115d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ gpui = { git = "https://github.com/zed-industries/zed", rev = "f8cfc7ed9e57503de gpui_platform = { git = "https://github.com/zed-industries/zed", rev = "f8cfc7ed9e57503def9479138894f3139f5400cc", features = ["font-kit"] } reqwest_client = { git = "https://github.com/zed-industries/zed", rev = "f8cfc7ed9e57503def9479138894f3139f5400cc" } -gpui-native-kit = { git = "https://git.reya.info/reya/gpui-native-kit", rev = "6667c812597bd2adf415d29a4e50355bb3bf06ee", features = ["layout", "editor"] } +gpui-native-kit = { git = "https://git.reya.info/reya/gpui-native-kit", rev = "dad833f998fecc0d828e716f3cbf0342d499db81", features = ["layout", "editor"] } settings = { path = "crates/settings" } signed_app = { path = "crates/signed_app" } diff --git a/crates/signed_app/src/app/mod.rs b/crates/signed_app/src/app/mod.rs index 7b6fdaa..f0f58ee 100644 --- a/crates/signed_app/src/app/mod.rs +++ b/crates/signed_app/src/app/mod.rs @@ -1,13 +1,16 @@ pub mod helpers; mod placeholder; +use gpui::prelude::FluentBuilder as _; use gpui::{ - AppContext as _, Context, Entity, IntoElement, ParentElement as _, Render, Styled as _, - Subscription, Window, div, + AppContext as _, Context, Entity, InteractiveElement as _, IntoElement, ParentElement as _, + Render, Styled as _, Subscription, Window, div, }; +use gpui_native_kit::common::h_flex; use gpui_native_kit::icons::IconRole; use gpui_native_kit::layout::dock::{Dock, DockState}; use gpui_native_kit::layout::shell::{LayoutState, Shell, SidebarToggles}; +use gpui_native_kit::layout::window_controls::{TRAFFIC_LIGHT_PAD, titlebar_strip}; use gpui_native_kit::theme::ActiveTheme as _; use gpui_native_kit::toast::Toast; use helpers::apply_appearance; @@ -90,9 +93,35 @@ impl AppRoot { } impl Render for AppRoot { - fn render(&mut self, _window: &mut Window, cx: &mut Context) -> impl IntoElement { - let theme = cx.theme(); + fn render(&mut self, window: &mut Window, cx: &mut Context) -> impl IntoElement { + let theme = *cx.theme(); + let layout = self.layout.read(cx); + let left_visible = layout.is_left_sidebar_visible(); + let sidebar_width = layout.left_sidebar_width(); + + let titlebar = if left_visible { + self.sidebar.read(cx).render_titlebar(cx) + } else { + None + }; + + let titlebar = titlebar.map(|row| { + let strip = h_flex() + .id("signed-sidebar-titlebar") + .size_full() + .when(cfg!(target_os = "macos"), |strip| { + strip.pl(TRAFFIC_LIGHT_PAD) + }) + .when(cfg!(not(target_os = "macos")), |strip| strip.pl_2()) + .pr_2(); + + titlebar_strip(strip, "signed-sidebar-titlebar-drag", window, cx) + .child(row) + .into_any_element() + }); + div() + .relative() .size_full() .font_family(".SystemUIFont") .text_color(theme.colors.foreground) @@ -102,10 +131,21 @@ impl Render for AppRoot { .center( Dock::new("signed-dock", self.dock.clone()) .window_controls(true) - .traffic_light_pad(!self.layout.read(cx).is_left_sidebar_visible()) + .traffic_light_pad(!left_visible) .sidebar_toggles(self.layout.clone()), ), ) + .when_some(titlebar, |root, titlebar| { + root.child( + div() + .absolute() + .top_0() + .left_0() + .w(sidebar_width) + .h(theme.titlebar_height) + .child(titlebar), + ) + }) .child(self.dialogs.clone()) } } diff --git a/crates/signed_app/src/explore/helpers.rs b/crates/signed_app/src/explore/helpers.rs index a455284..ccdc33d 100644 --- a/crates/signed_app/src/explore/helpers.rs +++ b/crates/signed_app/src/explore/helpers.rs @@ -8,7 +8,7 @@ use gpui_native_kit::avatar::Avatar; use gpui_native_kit::common::{Sizable as _, h_flex, v_flex}; use gpui_native_kit::icons::Icon; use gpui_native_kit::layout::dock::DockState; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use metadata::ProfileDirectory; use signed_core::Announcement; use signed_state::{RepoListStore, Timestamp}; @@ -121,8 +121,7 @@ pub(super) fn render_card( .child( div() .min_w_0() - .text_sm() - .font_weight(gpui::FontWeight::SEMIBOLD) + .typeset(TextRole::Headline, cx) .whitespace_nowrap() .text_ellipsis() .child(name), @@ -131,7 +130,7 @@ pub(super) fn render_card( this.child( h_flex() .gap_1() - .text_xs() + .typeset(TextRole::Caption, cx) .text_color(cx.theme().colors.muted_foreground) .whitespace_nowrap() .child( @@ -147,7 +146,7 @@ pub(super) fn render_card( div() .h_16() .min_w_0() - .text_xs() + .typeset(TextRole::Caption, cx) .text_color(cx.theme().colors.muted_foreground) .line_clamp(2) .child(description), @@ -168,7 +167,7 @@ pub(super) fn render_card( ) .child( div() - .text_xs() + .typeset(TextRole::Caption, cx) .text_color(cx.theme().colors.muted_foreground) .whitespace_nowrap() .child(owner_name), @@ -178,7 +177,7 @@ pub(super) fn render_card( h_flex() .flex_1() .justify_end() - .text_xs() + .typeset(TextRole::Caption, cx) .text_color(cx.theme().colors.muted_foreground) .whitespace_nowrap() .child(activity), diff --git a/crates/signed_app/src/explore/mod.rs b/crates/signed_app/src/explore/mod.rs index 3390a31..33a13b7 100644 --- a/crates/signed_app/src/explore/mod.rs +++ b/crates/signed_app/src/explore/mod.rs @@ -14,7 +14,7 @@ use gpui_native_kit::input::{Input, InputState, InputStateEvent}; use gpui_native_kit::layout::dock::{DockState, Panel}; use gpui_native_kit::scrollbar::Scrollbar; use gpui_native_kit::segmented::{Segmented, SegmentedOption}; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use helpers::{RepoFilter, render_card}; use metadata::ProfileDirectory; use nostr::prelude::PublicKey; @@ -107,15 +107,10 @@ impl ExploreView { .child( v_flex() .gap_1() + .child(div().typeset(TextRole::Caption2, cx).child("Repositories")) .child( div() - .font_weight(gpui::FontWeight::SEMIBOLD) - .text_xs() - .child("Repositories"), - ) - .child( - div() - .text_size(px(10.)) + .typeset(TextRole::Caption, cx) .text_color(muted) .child(SharedString::from(format!("Total: {count}"))), ), @@ -124,7 +119,7 @@ impl ExploreView { div().w(px(180.)).child( Input::new("explore-search", self.search.clone()) .placeholder("Search...") - .prefix(Icon::named(IconRole::Search).size(px(14.)).color(muted)), + .prefix(Icon::named(IconRole::Search).small().color(muted)), ), ) .child(div().flex_1()) @@ -132,17 +127,11 @@ impl ExploreView { Segmented::new("explore-filter", self.filter) .options(vec![ SegmentedOption::new(RepoFilter::All, "All") - .icon(Icon::named(CustomIconName::Grid).size(px(14.)).color(muted)), - SegmentedOption::new(RepoFilter::Popular, "Popular").icon( - Icon::named(CustomIconName::Trending) - .size(px(14.)) - .color(muted), - ), - SegmentedOption::new(RepoFilter::Recent, "Recent").icon( - Icon::named(CustomIconName::Recent) - .size(px(14.)) - .color(muted), - ), + .icon(Icon::named(CustomIconName::Grid).small().color(muted)), + SegmentedOption::new(RepoFilter::Popular, "Popular") + .icon(Icon::named(CustomIconName::Trending).small().color(muted)), + SegmentedOption::new(RepoFilter::Recent, "Recent") + .icon(Icon::named(CustomIconName::Recent).small().color(muted)), ]) .on_change(move |filter, _, cx| { if let Err(error) = weak.update(cx, |this, cx| { @@ -165,7 +154,7 @@ impl Panel for ExploreView { fn lead(&self, cx: &App) -> Option { Some( Icon::named(CustomIconName::Globe) - .size(px(14.)) + .small() .color(cx.theme().colors.muted_foreground) .into_any_element(), ) diff --git a/crates/signed_app/src/identity/exit.rs b/crates/signed_app/src/identity/exit.rs index ef6bd29..15fc8be 100644 --- a/crates/signed_app/src/identity/exit.rs +++ b/crates/signed_app/src/identity/exit.rs @@ -4,7 +4,7 @@ use gpui::{ use gpui_native_kit::button::{Button, ButtonVariant}; use gpui_native_kit::common::v_flex; use gpui_native_kit::dialog::Dialog; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use signed_state::Backend; use crate::shared::dialogs::close_global; @@ -25,7 +25,7 @@ impl Render for ExitDialog { v_flex() .child( div() - .text_sm() + .typeset(TextRole::Body, cx) .text_color(cx.theme().colors.muted_foreground) .child( "You will be signed out on this device and will need to sign in again on the next session.", diff --git a/crates/signed_app/src/identity/import.rs b/crates/signed_app/src/identity/import.rs index a02a0b1..f4141cc 100644 --- a/crates/signed_app/src/identity/import.rs +++ b/crates/signed_app/src/identity/import.rs @@ -8,7 +8,7 @@ use gpui_native_kit::common::v_flex; use gpui_native_kit::dialog::Dialog; use gpui_native_kit::field::Field; use gpui_native_kit::input::{Input, InputState, InputStateEvent}; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use signed_state::Backend; use crate::shared::dialogs::close_global; @@ -157,7 +157,7 @@ impl Render for ImportDialog { .gap_3() .child( div() - .text_sm() + .typeset(TextRole::Body, cx) .text_color(cx.theme().colors.muted_foreground) .child(description), ) diff --git a/crates/signed_app/src/identity/onboarding.rs b/crates/signed_app/src/identity/onboarding.rs index dcd7007..d7b1965 100644 --- a/crates/signed_app/src/identity/onboarding.rs +++ b/crates/signed_app/src/identity/onboarding.rs @@ -8,7 +8,7 @@ use gpui_native_kit::common::v_flex; use gpui_native_kit::dialog::Dialog; use gpui_native_kit::field::Field; use gpui_native_kit::input::{Input, InputState}; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use signed_state::Backend; use crate::shared::dialogs::close_global; @@ -99,7 +99,7 @@ impl Render for OnboardingDialog { .gap_3() .child( div() - .text_sm() + .typeset(TextRole::Body, cx) .text_color(cx.theme().colors.muted_foreground) .child("Set up your Signed identity to get started."), ) diff --git a/crates/signed_app/src/identity/passphrase.rs b/crates/signed_app/src/identity/passphrase.rs index a75ad33..14235ad 100644 --- a/crates/signed_app/src/identity/passphrase.rs +++ b/crates/signed_app/src/identity/passphrase.rs @@ -2,7 +2,7 @@ use assets::CustomIconName; use gpui::prelude::FluentBuilder as _; use gpui::{ AnyElement, App, AppContext as _, Context, Entity, IntoElement, ParentElement as _, Render, - Styled as _, Subscription, Window, div, + Styled as _, Subscription, Window, px, }; use gpui_native_kit::button::Button; use gpui_native_kit::common::v_flex; @@ -10,7 +10,6 @@ use gpui_native_kit::dialog::Dialog; use gpui_native_kit::field::Field; use gpui_native_kit::icons::Icon; use gpui_native_kit::input::{Input, InputState, InputStateEvent}; -use gpui_native_kit::theme::ActiveTheme as _; use signed_state::Backend; use crate::shared::dialogs::close_global; @@ -92,20 +91,18 @@ impl Render for PassphraseDialog { Dialog::new("passphrase-dialog") .open(true) .on_change(|_open, _, _| {}) + .min_width(px(420.)) .title("Unlock your identity") .content(move |_window, cx| { let progress = state.read(cx); v_flex() .gap_3() .child( - div() - .text_sm() - .text_color(cx.theme().colors.muted_foreground) - .child("Enter the passphrase used to encrypt this identity."), - ) - .child( - Field::new("passphrase-field", "Passphrase") - .child(Input::new("passphrase-input", pass_input.clone())), + Field::new( + "passphrase-field", + "Enter the passphrase used to encrypt this identity.", + ) + .child(Input::new("passphrase-input", pass_input.clone())), ) .when_some(error_row(&progress.error, cx), |el, error| el.child(error)) .when_some(push_steps_row(&progress.push_steps, cx), |el, steps| { diff --git a/crates/signed_app/src/inbox/helpers.rs b/crates/signed_app/src/inbox/helpers.rs index 7881ca4..de32399 100644 --- a/crates/signed_app/src/inbox/helpers.rs +++ b/crates/signed_app/src/inbox/helpers.rs @@ -8,12 +8,12 @@ use gpui_native_kit::avatar::Avatar; use gpui_native_kit::badge::Badge; use gpui_native_kit::common::{Sizable as _, h_flex, v_flex}; use gpui_native_kit::icons::Icon; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use metadata::ProfileDirectory; use nostr::prelude::{Event, Kind, PublicKey}; use utils::relative_time; -pub fn repo_header(id: SharedString, name: SharedString, unread: usize) -> AnyElement { +pub fn repo_header(id: SharedString, name: SharedString, unread: usize, cx: &App) -> AnyElement { h_flex() .h_12() .w_full() @@ -21,7 +21,7 @@ pub fn repo_header(id: SharedString, name: SharedString, unread: usize) -> AnyEl .child( div() .min_w_0() - .text_sm() + .typeset(TextRole::Body, cx) .whitespace_nowrap() .text_ellipsis() .child(name), @@ -37,7 +37,7 @@ pub fn empty_section_row(cx: &App) -> AnyElement { .h_12() .w_full() .px_3() - .text_xs() + .typeset(TextRole::Caption, cx) .text_color(cx.theme().colors.muted_foreground) .bg(cx.theme().colors.secondary) .rounded(cx.theme().radius.control) @@ -79,7 +79,7 @@ pub fn thread( .child( h_flex() .gap_2() - .text_sm() + .typeset(TextRole::Body, cx) .child( h_flex() .size_6() @@ -88,7 +88,7 @@ pub fn thread( .justify_center() .child( Icon::named(CustomIconName::Inbox) - .size(px(14.)) + .small() .color(cx.theme().colors.muted_foreground), ), ) @@ -135,7 +135,7 @@ fn sub_activity( .flex_1() .min_w_0() .gap_1() - .text_xs() + .typeset(TextRole::Caption, cx) .child( Avatar::new(event.pubkey) .name(name.clone()) @@ -185,7 +185,7 @@ pub fn empty_state(message: &'static str, cx: &App) -> AnyElement { ) .child( div() - .text_sm() + .typeset(TextRole::Body, cx) .text_color(cx.theme().colors.muted_foreground) .child(SharedString::from(message)), ) diff --git a/crates/signed_app/src/inbox/mod.rs b/crates/signed_app/src/inbox/mod.rs index 28494b5..d87f3c5 100644 --- a/crates/signed_app/src/inbox/mod.rs +++ b/crates/signed_app/src/inbox/mod.rs @@ -13,7 +13,7 @@ use gpui_native_kit::common::{h_flex, v_flex}; use gpui_native_kit::icons::{Icon, IconRole}; use gpui_native_kit::layout::dock::{DockState, Panel}; use gpui_native_kit::scroll_area::ScrollArea; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use metadata::ProfileDirectory; use nostr::prelude::{Event, EventId, Kind, PublicKey, Timestamp}; use signed_core::{InboxItem, InboxReadState, RepoAddr}; @@ -351,7 +351,7 @@ impl InboxView { .map(ToString::to_string) .unwrap_or_default() )); - repo_header(id, name, section.unread) + repo_header(id, name, section.unread, cx) } InboxRow::Entry(section_ix, entry_ix) => { let Some(section) = self.sections.get(section_ix) else { @@ -425,8 +425,7 @@ impl Render for InboxView { .gap_2() .child( div() - .text_sm() - .font_weight(gpui::FontWeight::SEMIBOLD) + .typeset(TextRole::Headline, cx) .child(SharedString::from("Inbox")), ) .child(div().flex_1()) diff --git a/crates/signed_app/src/issues/detail.rs b/crates/signed_app/src/issues/detail.rs index a543366..af0431a 100644 --- a/crates/signed_app/src/issues/detail.rs +++ b/crates/signed_app/src/issues/detail.rs @@ -8,7 +8,7 @@ use gpui_native_kit::empty_state::EmptyState; use gpui_native_kit::input::InputState; use gpui_native_kit::layout::dock::Panel; use gpui_native_kit::scroll_area::ScrollArea; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use metadata::ProfileDirectory; use nostr::prelude::{EventId, PublicKey}; use signed_core::GitEvent; @@ -157,7 +157,7 @@ impl Render for IssueDetailView { div() .flex_1() .min_w_0() - .font_weight(gpui::FontWeight::SEMIBOLD) + .typeset(TextRole::Headline, cx) .child(title), ), ) @@ -170,7 +170,7 @@ impl Render for IssueDetailView { .child( h_flex() .gap_2() - .text_sm() + .typeset(TextRole::Body, cx) .child( h_flex() .gap_1() @@ -197,7 +197,9 @@ impl Render for IssueDetailView { .child(SharedString::from(age)), ), ) - .child(div().text_sm().child(content)), + .child( + div().typeset(TextRole::Body, cx).child(content), + ), ) .child(comments_section( &self.store, diff --git a/crates/signed_app/src/issues/helpers.rs b/crates/signed_app/src/issues/helpers.rs index 57fcfad..c187c91 100644 --- a/crates/signed_app/src/issues/helpers.rs +++ b/crates/signed_app/src/issues/helpers.rs @@ -9,7 +9,7 @@ use gpui_native_kit::button::Button; use gpui_native_kit::common::{Sizable as _, h_flex, v_flex}; use gpui_native_kit::icons::Icon; use gpui_native_kit::input::{Input, InputState}; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use gpui_native_kit::tooltip::Tooltip; use metadata::ProfileDirectory; use nostr::prelude::{Event, EventId, PublicKey}; @@ -130,7 +130,12 @@ pub(crate) fn sidebar_section( .picture(profile.picture()) .small(), ) - .child(div().text_sm().text_ellipsis().child(name)) + .child( + div() + .typeset(TextRole::Body, cx) + .text_ellipsis() + .child(name), + ) .into_any_element() })), ) @@ -142,7 +147,7 @@ pub(crate) fn sidebar_section( if labels.is_empty() { this.child( div() - .text_sm() + .typeset(TextRole::Body, cx) .text_color(cx.theme().colors.muted_foreground) .child("None yet."), ) @@ -169,12 +174,7 @@ pub(crate) fn comments_section( v_flex() .gap_4() - .child( - div() - .text_xs() - .font_weight(gpui::FontWeight::SEMIBOLD) - .child(title), - ) + .child(div().typeset(TextRole::Caption2, cx).child(title)) .children(comments.iter().map(|comment| { let profile = directory.read(cx).profile(&comment.pubkey, cx); let author = profile.name(); @@ -190,7 +190,7 @@ pub(crate) fn comments_section( .child( h_flex() .gap_2() - .text_sm() + .typeset(TextRole::Body, cx) .child( h_flex() .gap_1() @@ -213,7 +213,7 @@ pub(crate) fn comments_section( .child(SharedString::from(age)), ), ) - .child(div().text_sm().child(content)) + .child(div().typeset(TextRole::Body, cx).child(content)) })) .into_any_element() } @@ -242,7 +242,7 @@ pub(crate) fn comment_form( .child( h_flex() .gap_1() - .text_xs() + .typeset(TextRole::Caption, cx) .text_color(cx.theme().colors.muted_foreground) .child( Icon::named(CustomIconName::Markdown) diff --git a/crates/signed_app/src/issues/mod.rs b/crates/signed_app/src/issues/mod.rs index c142a56..4bd7f53 100644 --- a/crates/signed_app/src/issues/mod.rs +++ b/crates/signed_app/src/issues/mod.rs @@ -13,7 +13,7 @@ use gpui_native_kit::icons::Icon; use gpui_native_kit::layout::dock::{DockState, Panel}; use gpui_native_kit::scrollbar::Scrollbar; use gpui_native_kit::segmented::{Segmented, SegmentedOption}; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use metadata::ProfileDirectory; use nostr::prelude::PublicKey; use signed_core::GitEvent; @@ -248,7 +248,7 @@ impl Render for IssuesView { .gap_1() .child( div() - .text_sm() + .typeset(TextRole::Body, cx) .text_ellipsis() .whitespace_nowrap() .child(title), @@ -256,7 +256,7 @@ impl Render for IssuesView { .child( h_flex() .gap_2() - .text_xs() + .typeset(TextRole::Caption, cx) .child( h_flex() .gap_1() diff --git a/crates/signed_app/src/issues/new_issue.rs b/crates/signed_app/src/issues/new_issue.rs index 9eda34c..d54b62d 100644 --- a/crates/signed_app/src/issues/new_issue.rs +++ b/crates/signed_app/src/issues/new_issue.rs @@ -7,7 +7,7 @@ use gpui_native_kit::common::v_flex; use gpui_native_kit::dialog::Dialog; use gpui_native_kit::field::Field; use gpui_native_kit::input::{Input, InputState}; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use signed_state::RepoStore; use crate::shared::dialogs::{close_global, open_global}; @@ -63,7 +63,7 @@ impl Render for NewIssueDialog { .gap_3() .child( div() - .text_sm() + .typeset(TextRole::Body, cx) .text_color(cx.theme().colors.muted_foreground) .child("Report a bug, ask a question, or propose a change."), ) diff --git a/crates/signed_app/src/pull_requests/detail.rs b/crates/signed_app/src/pull_requests/detail.rs index 5e9de10..7fe7d1a 100644 --- a/crates/signed_app/src/pull_requests/detail.rs +++ b/crates/signed_app/src/pull_requests/detail.rs @@ -18,7 +18,7 @@ use gpui_native_kit::layout::dock::{DockState, Panel}; use gpui_native_kit::scroll_area::ScrollArea; use gpui_native_kit::scrollbar::Scrollbar; use gpui_native_kit::spinner::Spinner; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use metadata::ProfileDirectory; use nostr::prelude::{EventId, Kind, PublicKey, Url}; use signed_core::{GitEvent, PullRequest, RepoAddr}; @@ -388,7 +388,7 @@ impl PullRequestDetailView { .child( h_flex() .gap_2() - .text_sm() + .typeset(TextRole::Body, cx) .child( h_flex() .gap_1() @@ -408,7 +408,11 @@ impl PullRequestDetailView { ), ) .when(!self.description.is_empty(), |this| { - this.child(div().text_sm().child(self.description.clone())) + this.child( + div() + .typeset(TextRole::Body, cx) + .child(self.description.clone()), + ) }), ) .child(comments_section(&self.store, root_id, &self.directory, cx)) @@ -534,7 +538,7 @@ impl PullRequestDetailView { div() .flex_1() .min_w_0() - .font_weight(gpui::FontWeight::SEMIBOLD) + .typeset(TextRole::Headline, cx) .text_ellipsis() .child(title), ), @@ -575,7 +579,7 @@ impl PullRequestDetailView { h_flex() .gap_1() .font_family(cx.theme().mono_font) - .text_xs() + .typeset(TextRole::Caption, cx) .text_color(cx.theme().colors.muted_foreground) .child(id.clone()) .child(ClipboardButton::new("pr-commit", &id)), diff --git a/crates/signed_app/src/pull_requests/dialogs/update.rs b/crates/signed_app/src/pull_requests/dialogs/update.rs index 36eb99a..7a4e0fd 100644 --- a/crates/signed_app/src/pull_requests/dialogs/update.rs +++ b/crates/signed_app/src/pull_requests/dialogs/update.rs @@ -7,7 +7,7 @@ use gpui_native_kit::common::v_flex; use gpui_native_kit::dialog::Dialog; use gpui_native_kit::field::Field; use gpui_native_kit::input::{Input, InputState}; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use nostr::prelude::Event; use signed_state::RepoStore; @@ -56,7 +56,7 @@ impl Render for UpdatePrDialog { .gap_3() .child( div() - .text_sm() + .typeset(TextRole::Body, cx) .text_color(cx.theme().colors.muted_foreground) .child("Publish a new revision with the output of `git format-patch`."), ) diff --git a/crates/signed_app/src/pull_requests/mod.rs b/crates/signed_app/src/pull_requests/mod.rs index d647892..9753693 100644 --- a/crates/signed_app/src/pull_requests/mod.rs +++ b/crates/signed_app/src/pull_requests/mod.rs @@ -14,7 +14,7 @@ use gpui_native_kit::layout::dock::{DockState, Panel}; use gpui_native_kit::menu::MenuItem; use gpui_native_kit::scrollbar::Scrollbar; use gpui_native_kit::segmented::{Segmented, SegmentedOption}; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use metadata::ProfileDirectory; use nostr::prelude::{Kind, PublicKey}; use signed_core::GitEvent; @@ -389,7 +389,7 @@ impl Render for PullRequestsView { .gap_1() .child( div() - .text_sm() + .typeset(TextRole::Body, cx) .text_ellipsis() .whitespace_nowrap() .child(title), @@ -397,7 +397,7 @@ impl Render for PullRequestsView { .child( h_flex() .gap_2() - .text_xs() + .typeset(TextRole::Caption, cx) .child( h_flex() .gap_1() diff --git a/crates/signed_app/src/pull_requests/new.rs b/crates/signed_app/src/pull_requests/new.rs index 47aa62d..7da3b2d 100644 --- a/crates/signed_app/src/pull_requests/new.rs +++ b/crates/signed_app/src/pull_requests/new.rs @@ -17,7 +17,7 @@ use gpui_native_kit::layout::dock::{DockState, Panel}; use gpui_native_kit::menu::Menu; use gpui_native_kit::scrollbar::Scrollbar; use gpui_native_kit::spinner::Spinner; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use metadata::ProfileDirectory; use signed_state::{CheckoutsStore, RepoStore}; @@ -301,17 +301,17 @@ impl NewPullRequestView { .child( v_flex() .gap_1() - .child(label("Merge Into")) + .child(label("Merge Into", cx)) .child(div().w(px(160.)).child(self.base_select.clone())), ) .child( v_flex() .gap_1() - .child(label("Pull From")) + .child(label("Pull From", cx)) .child(div().w(px(160.)).child(self.compare_select.clone())), ) .child( - v_flex().gap_1().child(label("Source")).child( + v_flex().gap_1().child(label("Source", cx)).child( Menu::new("pr-source") .open(self.source_open) .on_change(move |open, _, cx| { @@ -502,7 +502,7 @@ impl Render for NewPullRequestView { .when_some(self.error.clone(), |this, error| { this.child( div() - .text_xs() + .typeset(TextRole::Caption, cx) .text_color(cx.theme().ramps.destructive.base) .child(error), ) @@ -520,10 +520,9 @@ impl Render for NewPullRequestView { } } -fn label(text: &'static str) -> AnyElement { +fn label(text: &'static str, cx: &App) -> AnyElement { div() - .text_xs() - .font_weight(gpui::FontWeight::SEMIBOLD) + .typeset(TextRole::Caption2, cx) .child(text) .into_any_element() } diff --git a/crates/signed_app/src/pull_requests/send_patch.rs b/crates/signed_app/src/pull_requests/send_patch.rs index 8f3e606..b0c5e15 100644 --- a/crates/signed_app/src/pull_requests/send_patch.rs +++ b/crates/signed_app/src/pull_requests/send_patch.rs @@ -9,7 +9,7 @@ use gpui_native_kit::common::{h_flex, v_flex}; use gpui_native_kit::icons::Icon; use gpui_native_kit::input::{Input, InputState}; use gpui_native_kit::layout::dock::{DockState, Panel}; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use metadata::ProfileDirectory; use signed_state::RepoStore; @@ -163,7 +163,7 @@ impl Render for SendPatchView { ) .child( div() - .text_xs() + .typeset(TextRole::Caption, cx) .text_color(cx.theme().colors.muted_foreground) .child( "You can paste a git diff or a git format-patch patch series here.", @@ -177,7 +177,7 @@ impl Render for SendPatchView { .when_some(self.error.clone(), |this, error| { this.child( div() - .text_xs() + .typeset(TextRole::Caption, cx) .text_color(cx.theme().ramps.destructive.base) .child(error), ) diff --git a/crates/signed_app/src/repo/commit_diff.rs b/crates/signed_app/src/repo/commit_diff.rs index 9fe6890..21e9e9a 100644 --- a/crates/signed_app/src/repo/commit_diff.rs +++ b/crates/signed_app/src/repo/commit_diff.rs @@ -16,7 +16,7 @@ use gpui_native_kit::layout::dock::Panel; use gpui_native_kit::layout::resizable::{Resizable, ResizableState}; use gpui_native_kit::scrollbar::Scrollbar; use gpui_native_kit::spinner::Spinner; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use metadata::ProfileDirectory; use signed_git::{CommitDiff, DiffStatus, FileCommit, FileDiff, Repo}; use signed_state::RepoStore; @@ -285,8 +285,7 @@ impl DiffPane { .gap_2() .child( div() - .text_xs() - .font_weight(gpui::FontWeight::SEMIBOLD) + .typeset(TextRole::Caption2, cx) .text_color(status_color) .child(status_label), ) @@ -294,8 +293,7 @@ impl DiffPane { div() .flex_1() .min_w_0() - .text_xs() - .font_weight(gpui::FontWeight::SEMIBOLD) + .typeset(TextRole::Caption2, cx) .text_ellipsis() .whitespace_nowrap() .child(title), @@ -304,7 +302,7 @@ impl DiffPane { this.child( h_flex() .gap_2() - .text_xs() + .typeset(TextRole::Caption, cx) .child( div() .text_color(cx.theme().ramps.success.base) @@ -467,7 +465,7 @@ impl CommitDiffView { v_flex() .child( div() - .font_weight(gpui::FontWeight::SEMIBOLD) + .typeset(TextRole::Headline, cx) .text_ellipsis() .whitespace_nowrap() .child(commit.summary.clone()), @@ -475,7 +473,7 @@ impl CommitDiffView { .child( h_flex() .gap_2() - .text_sm() + .typeset(TextRole::Body, cx) .child(SharedString::from(format!("{} committed", commit.author))) .child( h_flex() @@ -492,12 +490,16 @@ impl CommitDiffView { ), ) .when_some(commit.description.as_ref(), |this, description| { - this.child(div().text_sm().child(SharedString::from(description))) + this.child( + div() + .typeset(TextRole::Body, cx) + .child(SharedString::from(description)), + ) }) .child( h_flex() .gap_2() - .text_xs() + .typeset(TextRole::Caption, cx) .child(Badge::new("commit-files", format!("{files} files changed"))) .when(insertions > 0, |this| { this.child( diff --git a/crates/signed_app/src/repo/dialogs/about.rs b/crates/signed_app/src/repo/dialogs/about.rs index 5ff0cbc..6bf63ce 100644 --- a/crates/signed_app/src/repo/dialogs/about.rs +++ b/crates/signed_app/src/repo/dialogs/about.rs @@ -6,7 +6,7 @@ use gpui_native_kit::avatar::Avatar; use gpui_native_kit::clipboard::ClipboardButton; use gpui_native_kit::common::{Sizable as _, h_flex, v_flex}; use gpui_native_kit::dialog::Dialog; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use metadata::ProfileDirectory; use nostr::prelude::PublicKey; use signed_core::Announcement; @@ -66,6 +66,7 @@ fn announcement_rows( .as_deref() .map(SharedString::from) .unwrap_or_else(|| SharedString::from("-")), + cx, ), cx, )); @@ -77,6 +78,7 @@ fn announcement_rows( .as_deref() .map(SharedString::from) .unwrap_or_else(|| SharedString::from("-")), + cx, ), cx, )); @@ -102,13 +104,13 @@ fn announcement_rows( } if let Some(upstream) = &announcement.upstream { - rows.push(row("Upstream", text(upstream.display()), cx)); + rows.push(row("Upstream", text(upstream.display(), cx), cx)); } if !announcement.hashtags.is_empty() { rows.push(row( "Hashtags", - text(SharedString::from(announcement.hashtags.join(", "))), + text(SharedString::from(announcement.hashtags.join(", ")), cx), cx, )); } @@ -154,8 +156,7 @@ fn row(label: &'static str, value: AnyElement, cx: &App) -> AnyElement { .min_w_0() .child( div() - .text_xs() - .font_weight(gpui::FontWeight::SEMIBOLD) + .typeset(TextRole::Caption2, cx) .text_color(cx.theme().colors.muted_foreground) .child(label), ) @@ -163,12 +164,12 @@ fn row(label: &'static str, value: AnyElement, cx: &App) -> AnyElement { .into_any_element() } -fn text(value: T) -> AnyElement +fn text(value: T, cx: &App) -> AnyElement where T: Into, { div() - .text_sm() + .typeset(TextRole::Body, cx) .w_full() .min_w_0() .child(value.into()) @@ -183,7 +184,7 @@ fn copy_value(id: &'static str, value: String, cx: &App) -> AnyElement { .child( div() .font_family(cx.theme().mono_font) - .text_xs() + .typeset(TextRole::Caption, cx) .min_w_0() .child(SharedString::from(value.clone())), ) @@ -220,7 +221,7 @@ fn maintainers( .overflow_hidden() .whitespace_nowrap() .text_ellipsis() - .text_sm() + .typeset(TextRole::Body, cx) .child(name), ) .into_any_element() @@ -247,7 +248,7 @@ fn list(id: &'static str, items: impl IntoIterator, cx: &App) -> .min_w_0() .whitespace_nowrap() .text_ellipsis() - .text_sm() + .typeset(TextRole::Body, cx) .child(SharedString::from(middle_truncate(&item, 28, 16))), ) .child(ClipboardButton::new( diff --git a/crates/signed_app/src/repo/dialogs/create.rs b/crates/signed_app/src/repo/dialogs/create.rs index 7555b30..95d6fb2 100644 --- a/crates/signed_app/src/repo/dialogs/create.rs +++ b/crates/signed_app/src/repo/dialogs/create.rs @@ -12,7 +12,7 @@ use gpui_native_kit::field::Field; use gpui_native_kit::icons::{Icon, IconRole}; use gpui_native_kit::input::{Input, InputState}; use gpui_native_kit::layout::dock::DockState; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use gpui_native_kit::tooltip::Tooltip; use settings::SettingsStore; use signed_state::{Backend, CheckoutsStore}; @@ -166,7 +166,7 @@ impl Render for CreateRepoDialog { .gap_3() .child( div() - .text_sm() + .typeset(TextRole::Body, cx) .text_color(cx.theme().colors.muted_foreground) .child("Publish a new repository to your grasp servers."), ) diff --git a/crates/signed_app/src/repo/dialogs/grasp_servers.rs b/crates/signed_app/src/repo/dialogs/grasp_servers.rs index 024d14a..f9c9449 100644 --- a/crates/signed_app/src/repo/dialogs/grasp_servers.rs +++ b/crates/signed_app/src/repo/dialogs/grasp_servers.rs @@ -8,7 +8,7 @@ use gpui_native_kit::common::{h_flex, v_flex}; use gpui_native_kit::icons::{Icon, IconRole}; use gpui_native_kit::input::{Input, InputState}; use gpui_native_kit::switch::Switch; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use gpui_native_kit::tooltip::Tooltip; use nostr::prelude::RelayUrl; use settings::{DEFAULT_GRASP_SERVERS, GraspServersSettings}; @@ -72,7 +72,7 @@ pub fn grasp_servers_field( h_flex() .justify_between() .items_center() - .child(div().text_sm().child("Grasp servers")) + .child(div().typeset(TextRole::Body, cx).child("Grasp servers")) .child( Switch::new("grasp-servers-toggle") .checked(servers_enabled) @@ -88,7 +88,7 @@ pub fn grasp_servers_field( section .child( div() - .text_xs() + .typeset(TextRole::Caption, cx) .text_color(cx.theme().colors.muted_foreground) .child("Where the repository is hosted"), ) @@ -122,7 +122,7 @@ pub fn grasp_servers_field( .when(loading_servers, |section| { section.child( div() - .text_xs() + .typeset(TextRole::Caption, cx) .text_color(cx.theme().colors.muted_foreground) .child("Loading your grasp servers..."), ) @@ -130,7 +130,7 @@ pub fn grasp_servers_field( .when_some(error, |section, error| { section.child( div() - .text_xs() + .typeset(TextRole::Caption, cx) .text_color(cx.theme().ramps.destructive.base) .child(error), ) @@ -156,7 +156,7 @@ fn render_server_row( .px_2() .bg(cx.theme().colors.muted) .text_color(cx.theme().colors.muted_foreground) - .text_sm() + .typeset(TextRole::Body, cx) .rounded(cx.theme().radius.control) .child(server_host(relay)), ) diff --git a/crates/signed_app/src/repo/dialogs/init.rs b/crates/signed_app/src/repo/dialogs/init.rs index e9a7943..037c731 100644 --- a/crates/signed_app/src/repo/dialogs/init.rs +++ b/crates/signed_app/src/repo/dialogs/init.rs @@ -12,7 +12,7 @@ use gpui_native_kit::field::Field; use gpui_native_kit::icons::{Icon, IconRole}; use gpui_native_kit::input::{Input, InputState}; use gpui_native_kit::select::{Select, SelectOption}; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use settings::SettingsStore; use signed_core::RepoAddr; use signed_git::Repo; @@ -181,7 +181,7 @@ impl Render for InitRepoDialog { .gap_3() .child( div() - .text_sm() + .typeset(TextRole::Body, cx) .text_color(cx.theme().colors.muted_foreground) .child("Publish this local repository to Nostr."), ) @@ -204,7 +204,7 @@ impl Render for InitRepoDialog { .w_full() .px_2() .bg(cx.theme().colors.muted) - .text_sm() + .typeset(TextRole::Body, cx) .text_color(cx.theme().colors.muted_foreground) .rounded(cx.theme().radius.control) .child(folder.clone()), diff --git a/crates/signed_app/src/repo/dialogs/reset.rs b/crates/signed_app/src/repo/dialogs/reset.rs index b265dfb..1386144 100644 --- a/crates/signed_app/src/repo/dialogs/reset.rs +++ b/crates/signed_app/src/repo/dialogs/reset.rs @@ -5,7 +5,7 @@ use gpui::{ use gpui_native_kit::button::{Button, ButtonVariant}; use gpui_native_kit::common::v_flex; use gpui_native_kit::dialog::Dialog; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use signed_state::RepoStore; use crate::shared::dialogs::{close_global, open_global}; @@ -40,7 +40,7 @@ impl Render for ResetRemoteDialog { .gap_2() .child( div() - .text_sm() + .typeset(TextRole::Body, cx) .text_color(cx.theme().colors.muted_foreground) .child( "Grasp servers are overwritten to match the local mirror. Refs that do not exist locally are deleted from the servers. This cannot be undone.", @@ -48,7 +48,7 @@ impl Render for ResetRemoteDialog { ) .child(if deleted.is_empty() { div() - .text_sm() + .typeset(TextRole::Body, cx) .text_color(cx.theme().colors.muted_foreground) .child("No server refs will be deleted.") .into_any_element() @@ -57,7 +57,7 @@ impl Render for ResetRemoteDialog { .gap_1() .children(deleted.iter().map(|name| { div() - .text_sm() + .typeset(TextRole::Body, cx) .font_family(cx.theme().mono_font) .child(name.clone()) })) diff --git a/crates/signed_app/src/repo/files.rs b/crates/signed_app/src/repo/files.rs index f6f7aac..9676f04 100644 --- a/crates/signed_app/src/repo/files.rs +++ b/crates/signed_app/src/repo/files.rs @@ -12,7 +12,7 @@ use gpui_native_kit::data::tree::{Tree, TreeItem}; use gpui_native_kit::editor::code::CodeViewState; use gpui_native_kit::editor::markdown::MarkdownViewState; use gpui_native_kit::icons::{Icon, IconRole}; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use signed_git::{FileCommit, Repo, WorktreeSnapshot}; use super::helpers::{code_language, is_markdown_path, preview_spinner, source_hash}; @@ -355,8 +355,7 @@ impl RepoFilesView { .text_color(cx.theme().colors.muted_foreground) .child( div() - .text_xs() - .font_weight(gpui::FontWeight::SEMIBOLD) + .typeset(TextRole::Caption2, cx) .text_ellipsis() .whitespace_nowrap() .child(pane_title), @@ -368,14 +367,14 @@ impl RepoFilesView { .gap_1() .child( div() - .text_xs() + .typeset(TextRole::Caption, cx) .font_family(cx.theme().mono_font) .child(commit.id.clone()), ) .child( div() .max_w(px(250.)) - .text_xs() + .typeset(TextRole::Caption, cx) .text_ellipsis() .whitespace_nowrap() .child(commit.summary.clone()), diff --git a/crates/signed_app/src/repo/header.rs b/crates/signed_app/src/repo/header.rs index 3f02707..9568fb8 100644 --- a/crates/signed_app/src/repo/header.rs +++ b/crates/signed_app/src/repo/header.rs @@ -15,7 +15,7 @@ use gpui_native_kit::dropdown_menu::DropdownMenu; use gpui_native_kit::icons::{Icon, IconRole}; use gpui_native_kit::menu::MenuItem; use gpui_native_kit::popover::Popover; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use gpui_native_kit::tooltip::Tooltip; use signed_state::{Backend, Nip34Kind}; @@ -211,14 +211,14 @@ impl RepoDetailView { .child( h_flex() .gap_2() - .font_weight(gpui::FontWeight::SEMIBOLD) + .typeset(TextRole::Headline, cx) .child(avatar) .child(name), ) .child( div() .min_w_0() - .text_sm() + .typeset(TextRole::Body, cx) .text_color(cx.theme().colors.muted_foreground) .line_clamp(2) .child(description), @@ -231,9 +231,8 @@ impl RepoDetailView { .gap_1() .child( div() - .text_xs() + .typeset(TextRole::Caption2, cx) .text_color(cx.theme().colors.muted_foreground) - .font_weight(gpui::FontWeight::SEMIBOLD) .child("Maintainers:"), ) .child(self.render_maintainers(cx)), @@ -458,18 +457,20 @@ impl RepoDetailView { "Clone with ngit", "copy-ngit", &ngit_for_popover, + cx, )) .child(clone_group( "Clone with nak", "copy-nak", &nak_for_popover, + cx, )) .child( v_flex() .gap_1() .child( div() - .text_xs() + .typeset(TextRole::Caption, cx) .text_color( cx.theme().colors.muted_foreground, ) @@ -478,7 +479,7 @@ impl RepoDetailView { .when(git_for_popover.is_empty(), |this| { this.child( div() - .text_xs() + .typeset(TextRole::Caption, cx) .child("No git clone urls."), ) }) @@ -572,14 +573,14 @@ impl RepoDetailView { .child( h_flex() .gap_2() - .font_weight(gpui::FontWeight::SEMIBOLD) + .typeset(TextRole::Headline, cx) .child(avatar) .child(name), ) .child( div() .min_w_0() - .text_sm() + .typeset(TextRole::Body, cx) .text_color(cx.theme().colors.muted_foreground) .child(path), ), @@ -651,12 +652,17 @@ impl RepoDetailView { .picture(owner.picture()) .small(), ) - .child(div().text_xs().whitespace_nowrap().child(owner_name)), + .child( + div() + .typeset(TextRole::Caption, cx) + .whitespace_nowrap() + .child(owner_name), + ), ) .when(!rest.is_empty(), |this| { this.child( div() - .text_xs() + .typeset(TextRole::Caption, cx) .text_color(cx.theme().colors.muted_foreground) .child(SharedString::from(format!("+{}", rest.len()))), ) diff --git a/crates/signed_app/src/repo/helpers.rs b/crates/signed_app/src/repo/helpers.rs index 4e920a9..10c869a 100644 --- a/crates/signed_app/src/repo/helpers.rs +++ b/crates/signed_app/src/repo/helpers.rs @@ -14,7 +14,7 @@ use gpui_native_kit::combobox::ComboboxState; use gpui_native_kit::common::{Sizable as _, h_flex, v_flex}; use gpui_native_kit::icons::Icon; use gpui_native_kit::menu::MenuItem; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use metadata::ProfileDirectory; use nostr::nips::nip19::Nip19Coordinate; use nostr::prelude::{RelayUrl, ToBech32}; @@ -117,10 +117,19 @@ impl ShareTargets { } } -pub(super) fn clone_group(label: &str, id: &'static str, command: &SharedString) -> AnyElement { +pub(super) fn clone_group( + label: &str, + id: &'static str, + command: &SharedString, + cx: &App, +) -> AnyElement { v_flex() .gap_1() - .child(div().text_xs().child(SharedString::from(label))) + .child( + div() + .typeset(TextRole::Caption, cx) + .child(SharedString::from(label)), + ) .child(ClipboardButton::new(id, command.clone())) .into_any_element() } @@ -170,9 +179,9 @@ pub(super) fn fork_row( let row = h_flex() .gap_1() .min_w_0() - .text_sm() + .typeset(TextRole::Body, cx) .text_color(cx.theme().colors.muted_foreground) - .child(Icon::named(CustomIconName::GitBranch).size(px(14.))) + .child(Icon::named(CustomIconName::GitBranch).small()) .child(div().whitespace_nowrap().text_ellipsis().child(label)); Some(if clickable { @@ -253,7 +262,7 @@ pub(super) fn bound_repo_label( h_flex() .flex_shrink_0() .gap_2() - .text_sm() + .typeset(TextRole::Body, cx) .child("Initialized by") .text_color(cx.theme().colors.muted_foreground) .when_some(profile, |this, profile| { @@ -274,8 +283,7 @@ pub(super) fn bound_repo_label( .when_some(binding.identifier.as_deref(), |this, ident| { this.child( div() - .text_xs() - .font_weight(gpui::FontWeight::SEMIBOLD) + .typeset(TextRole::Caption2, cx) .child(SharedString::from(format!("/{ident}"))), ) }) @@ -361,7 +369,7 @@ pub(super) fn render_diff_row(hunks: &[DiffHunk], row: DiffRow, cx: &App) -> Any .w_full() .h(px(DIFF_ROW_HEIGHT)) .font_family(cx.theme().mono_font) - .text_xs() + .typeset(TextRole::Caption, cx) .bg(cx.theme().colors.muted) .border_y_1() .border_color(cx.theme().colors.border) @@ -387,7 +395,7 @@ fn render_diff_line(line: &DiffLine, cx: &App) -> AnyElement { .w_full() .h(px(DIFF_ROW_HEIGHT)) .font_family(cx.theme().mono_font) - .text_xs() + .typeset(TextRole::Caption, cx) .when_some(bg, |this, bg| this.bg(bg)) .child( div() @@ -447,7 +455,7 @@ pub(crate) fn commit_row( .child( div() .font_family(cx.theme().mono_font) - .text_xs() + .typeset(TextRole::Caption, cx) .text_color(cx.theme().colors.muted_foreground) .child(commit.id.clone()), ) @@ -455,7 +463,7 @@ pub(crate) fn commit_row( div() .flex_1() .min_w_0() - .text_sm() + .typeset(TextRole::Body, cx) .text_ellipsis() .whitespace_nowrap() .child(commit.summary.clone()), @@ -464,7 +472,7 @@ pub(crate) fn commit_row( .child( h_flex() .gap_2() - .text_xs() + .typeset(TextRole::Caption, cx) .text_color(cx.theme().colors.muted_foreground) .child(commit.author.clone()) .child(relative_time_secs(commit.time)), diff --git a/crates/signed_app/src/repo/history.rs b/crates/signed_app/src/repo/history.rs index 6638a82..dbb1335 100644 --- a/crates/signed_app/src/repo/history.rs +++ b/crates/signed_app/src/repo/history.rs @@ -10,7 +10,7 @@ use gpui_native_kit::common::v_flex; use gpui_native_kit::layout::dock::DockState; use gpui_native_kit::scrollbar::Scrollbar; use gpui_native_kit::spinner::Spinner; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use signed_git::{CommitList, Repo}; use signed_state::RepoStore; @@ -190,7 +190,7 @@ impl Render for RepoHistoryView { div() .py_2() .w_full() - .text_xs() + .typeset(TextRole::Caption, cx) .text_color(cx.theme().colors.muted_foreground) .child(format!("Showing {shown} of {total} commits")), ) diff --git a/crates/signed_app/src/repo/mod.rs b/crates/signed_app/src/repo/mod.rs index 1a8ee25..5c2d842 100644 --- a/crates/signed_app/src/repo/mod.rs +++ b/crates/signed_app/src/repo/mod.rs @@ -7,7 +7,7 @@ use gpui::prelude::FluentBuilder as _; use gpui::{ AnyElement, App, AppContext as _, Context, Entity, InteractiveElement as _, IntoElement, ParentElement as _, PathPromptOptions, Render, SharedString, Styled as _, Subscription, Task, - WeakEntity, Window, div, px, + WeakEntity, Window, div, }; use gpui_native_kit::alert::{Alert, AlertSeverity}; use gpui_native_kit::badge::Badge; @@ -16,7 +16,7 @@ use gpui_native_kit::common::{Sizable as _, h_flex, v_flex}; use gpui_native_kit::icons::{Icon, IconRole}; use gpui_native_kit::layout::dock::{DockState, Panel}; use gpui_native_kit::spinner::Spinner; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use metadata::ProfileDirectory; use nostr::prelude::{PublicKey, Url}; use signed_core::{Announcement, RepoAddr}; @@ -854,7 +854,7 @@ impl RepoDetailView { .child( h_flex() .gap_2() - .text_sm() + .typeset(TextRole::Body, cx) .text_color(cx.theme().colors.muted_foreground) .child(Badge::new("ready-branch", status.branch.clone())) .child(commits) @@ -939,7 +939,7 @@ impl RepoDetailView { .child( h_flex() .gap_2() - .text_sm() + .typeset(TextRole::Body, cx) .text_color(cx.theme().colors.muted_foreground) .child(Badge::new("push-branch", status.branch.clone())) .child(commits) @@ -1008,7 +1008,7 @@ impl RepoDetailView { .child( h_flex() .gap_2() - .text_sm() + .typeset(TextRole::Body, cx) .text_color(cx.theme().colors.muted_foreground) .child(Badge::new("sync-branch", branch)) .child(commits) @@ -1059,22 +1059,22 @@ impl RepoDetailView { match status { PushStepStatus::Running(_) => h_flex() .gap_2() - .text_sm() + .typeset(TextRole::Body, cx) .text_color(cx.theme().colors.muted_foreground) .child(Spinner::new("push-step")) .child(label) .into_any_element(), PushStepStatus::Done(_) => h_flex() .gap_2() - .text_sm() - .child(Icon::named(IconRole::Check).size(px(14.))) + .typeset(TextRole::Body, cx) + .child(Icon::named(IconRole::Check).small()) .child(label) .into_any_element(), PushStepStatus::Failed(_, reason) => h_flex() .gap_2() - .text_sm() + .typeset(TextRole::Body, cx) .text_color(cx.theme().ramps.destructive.base) - .child(Icon::named(IconRole::Close).size(px(14.))) + .child(Icon::named(IconRole::Close).small()) .child(SharedString::from(format!( "{}: {reason}", status.step().label() @@ -1090,7 +1090,7 @@ impl RepoDetailView { .gap_1() .w_full() .bg(cx.theme().colors.muted) - .child(div().text_sm().child("Pushing")) + .child(div().typeset(TextRole::Body, cx).child("Pushing")) .children(steps) .into_any_element(), ) @@ -1115,12 +1115,12 @@ impl RepoDetailView { .min_w_0() .flex_1() .items_start() - .child(Icon::named(IconRole::Warning).size(px(14.))) + .child(Icon::named(IconRole::Warning).small()) .child( div() .flex_1() .min_w_0() - .text_sm() + .typeset(TextRole::Body, cx) .text_color(cx.theme().ramps.warning.base) .child(SharedString::from(warning)), ), @@ -1174,7 +1174,7 @@ impl RepoDetailView { .child(Spinner::new("repo-loading")) .child( div() - .text_sm() + .typeset(TextRole::Body, cx) .text_color(cx.theme().colors.muted_foreground) .child(label), ) diff --git a/crates/signed_app/src/settings/helpers.rs b/crates/signed_app/src/settings/helpers.rs index 2c7f681..a94e210 100644 --- a/crates/signed_app/src/settings/helpers.rs +++ b/crates/signed_app/src/settings/helpers.rs @@ -9,7 +9,7 @@ use gpui_native_kit::common::{h_flex, v_flex}; use gpui_native_kit::icons::{Icon, IconRole}; use gpui_native_kit::input::{Input, InputState}; use gpui_native_kit::select::{Select, SelectOption}; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use gpui_native_kit::tooltip::Tooltip; use settings::{AppearanceMode, EventFetchingStrategy, SettingsStore}; @@ -31,15 +31,10 @@ pub fn setting_row( .flex_1() .min_w_0() .gap_1() + .child(div().typeset(TextRole::Headline, cx).child(title.into())) .child( div() - .text_sm() - .font_weight(gpui::FontWeight::SEMIBOLD) - .child(title.into()), - ) - .child( - div() - .text_xs() + .typeset(TextRole::Caption, cx) .text_color(cx.theme().colors.muted_foreground) .child(description.into()), ), @@ -61,15 +56,10 @@ pub fn setting_block( .child( v_flex() .gap_1() + .child(div().typeset(TextRole::Headline, cx).child(title.into())) .child( div() - .text_sm() - .font_weight(gpui::FontWeight::SEMIBOLD) - .child(title.into()), - ) - .child( - div() - .text_xs() + .typeset(TextRole::Caption, cx) .text_color(cx.theme().colors.muted_foreground) .child(description.into()), ), @@ -137,7 +127,7 @@ pub fn grasp_servers_editor(input: &Entity, cx: &App) -> AnyElement .px_2() .bg(cx.theme().colors.muted) .text_color(cx.theme().colors.muted_foreground) - .text_sm() + .typeset(TextRole::Body, cx) .rounded(cx.theme().radius.control) .child(display_server(server)), ) @@ -237,7 +227,7 @@ pub fn scan_paths_editor(cx: &App) -> AnyElement { .px_2() .bg(cx.theme().colors.muted) .text_color(cx.theme().colors.muted_foreground) - .text_sm() + .typeset(TextRole::Body, cx) .rounded(cx.theme().radius.control) .child(path.display().to_string()), ) diff --git a/crates/signed_app/src/shared/progress.rs b/crates/signed_app/src/shared/progress.rs index 632f153..80252ba 100644 --- a/crates/signed_app/src/shared/progress.rs +++ b/crates/signed_app/src/shared/progress.rs @@ -1,11 +1,11 @@ use gpui::{ AnyElement, App, Context, IntoElement as _, ParentElement as _, SharedString, Styled as _, - Subscription, div, px, + Subscription, div, }; use gpui_native_kit::common::{h_flex, v_flex}; use gpui_native_kit::icons::{Icon, IconRole}; use gpui_native_kit::spinner::Spinner; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use signed_core::RepoAddr; use signed_state::{Backend, BackendEvent, PushStepStatus}; @@ -69,7 +69,7 @@ impl DialogProgress { pub fn error_row(error: &Option, cx: &App) -> Option { error.as_ref().map(|message| { div() - .text_sm() + .typeset(TextRole::Body, cx) .text_color(cx.theme().ramps.destructive.base) .child(message.clone()) .into_any_element() @@ -90,29 +90,29 @@ pub fn push_steps_row(steps: &[PushStepStatus], cx: &App) -> Option match status { PushStepStatus::Running(_) => h_flex() .gap_2() - .text_sm() + .typeset(TextRole::Body, cx) .text_color(cx.theme().colors.muted_foreground) .child(Spinner::new("push-step")) .child(label) .into_any_element(), PushStepStatus::Done(_) => h_flex() .gap_2() - .text_sm() + .typeset(TextRole::Body, cx) .text_color(cx.theme().colors.foreground) .child( Icon::named(IconRole::Check) - .size(px(14.)) + .small() .color(cx.theme().colors.foreground), ) .child(label) .into_any_element(), PushStepStatus::Failed(_, reason) => h_flex() .gap_2() - .text_sm() + .typeset(TextRole::Body, cx) .text_color(cx.theme().ramps.destructive.base) .child( Icon::named(IconRole::Close) - .size(px(14.)) + .small() .color(cx.theme().ramps.destructive.base), ) .child(SharedString::from(format!( diff --git a/crates/signed_app/src/shared/widgets.rs b/crates/signed_app/src/shared/widgets.rs index 4fd9d81..68982b9 100644 --- a/crates/signed_app/src/shared/widgets.rs +++ b/crates/signed_app/src/shared/widgets.rs @@ -7,7 +7,7 @@ use gpui_native_kit::badge::{Badge, BadgeVariant}; use gpui_native_kit::common::Sizable as _; use gpui_native_kit::empty_state::EmptyState; use gpui_native_kit::icons::Icon; -use gpui_native_kit::theme::ActiveTheme as _; +use gpui_native_kit::theme::{ActiveTheme as _, TextRole, Typeset as _}; use gpui_native_kit::tooltip::Tooltip; use metadata::ProfileDirectory; use signed_core::RepoStatus; @@ -90,8 +90,7 @@ pub fn repo_tab_avatar( /// A one-line muted label used by section headers. pub fn section_label(text: impl Into, cx: &App) -> AnyElement { div() - .text_xs() - .font_weight(gpui::FontWeight::SEMIBOLD) + .typeset(TextRole::Caption2, cx) .text_color(cx.theme().colors.muted_foreground) .child(text.into()) .into_any_element() diff --git a/crates/signed_app/src/sidebar/mod.rs b/crates/signed_app/src/sidebar/mod.rs index 4e1ca8d..2141b94 100644 --- a/crates/signed_app/src/sidebar/mod.rs +++ b/crates/signed_app/src/sidebar/mod.rs @@ -3,9 +3,8 @@ use std::sync::Arc; use assets::CustomIconName; use gpui::{ - AnyElement, App, AppContext as _, Context, FontWeight, IntoElement, ObjectFit, - ParentElement as _, SharedString, Styled as _, StyledImage as _, Subscription, WeakEntity, - Window, div, img, px, + AnyElement, App, AppContext as _, Context, IntoElement, ObjectFit, ParentElement as _, + SharedString, Styled as _, StyledImage as _, Subscription, WeakEntity, Window, div, img, px, }; use gpui_native_kit::avatar::Avatar; use gpui_native_kit::badge::{Badge, BadgeVariant}; @@ -27,10 +26,9 @@ use signed_state::{ }; use crate::explore::ExploreView; -use crate::identity; use crate::inbox::InboxView; use crate::repo::dialogs; -use crate::settings; +use crate::{identity, settings}; mod helpers; @@ -218,14 +216,9 @@ impl SidebarView { pub fn build(&self, cx: &App) -> Sidebar { let backend = Backend::global(cx); - let profile = backend - .read(cx) - .current_user() - .map(|public_key| self.directory.read(cx).profile(&public_key, cx)); - - let Some(profile) = profile else { + if backend.read(cx).current_user().is_none() { return Sidebar::new("signed-sidebar").content(self.render_sign_in(cx)); - }; + } let weak = self.weak.clone(); let announcements = self.announcements.clone(); @@ -236,23 +229,16 @@ impl SidebarView { Sidebar::new("signed-sidebar") .transparent(true) - .header(self.render_user(&profile, self.scanning, cx)) .footer(self.render_footer(cx)) .entries(move |_, cx| { let muted = cx.theme().colors.muted_foreground; let mut entries = vec![ - SidebarEntry::row("inbox", "Inbox").prefix( - Icon::named(CustomIconName::Inbox) - .size(px(14.)) - .color(muted), - ), - SidebarEntry::row("browse", "Browse").prefix( - Icon::named(CustomIconName::Globe) - .size(px(14.)) - .color(muted), - ), + SidebarEntry::row("inbox", "Inbox") + .prefix(Icon::named(CustomIconName::Inbox).small().color(muted)), + SidebarEntry::row("browse", "Browse") + .prefix(Icon::named(CustomIconName::Globe).small().color(muted)), SidebarEntry::row("search", "Search") - .prefix(Icon::named(IconRole::Search).size(px(14.)).color(muted)), + .prefix(Icon::named(IconRole::Search).small().color(muted)), SidebarEntry::header("All Repositories"), ]; @@ -513,6 +499,18 @@ impl SidebarView { } } + pub fn render_titlebar(&self, cx: &App) -> Option { + let profile = Backend::global(cx) + .read(cx) + .current_user() + .map(|public_key| self.directory.read(cx).profile(&public_key, cx))?; + + Some( + self.render_user(&profile, self.scanning, cx) + .into_any_element(), + ) + } + fn render_user(&self, profile: &Profile, scanning: bool, cx: &App) -> impl IntoElement { let name = profile.name(); let picture = profile.picture(); @@ -547,12 +545,6 @@ impl SidebarView { .name(name.clone()) .picture(picture.clone()), ) - .child( - div() - .text_xs() - .font_weight(FontWeight::SEMIBOLD) - .child(name.clone()), - ) .child( Icon::named(IconRole::ChevronDown) .size(px(12.))