chore: replace pixel metrics with rem-based sizing across ui
Rust / build (macos-latest, stable) (push) Waiting to run
Rust / build (ubuntu-latest, stable) (push) Waiting to run
Rust / build (windows-latest, stable) (push) Waiting to run

This commit is contained in:
2026-11-19 15:47:50 +07:00
parent 5a597f43c4
commit a0f69b6450
74 changed files with 897 additions and 1090 deletions
+4 -9
View File
@@ -1,10 +1,10 @@
use gpui::prelude::FluentBuilder as _;
use gpui::{
App, Context, Entity, FontWeight, IntoElement, ParentElement as _, Render, SharedString,
Styled as _, Window, div,
App, Context, Entity, IntoElement, ParentElement as _, Render, SharedString, Styled as _,
Window, div,
};
use ui::button::{Button, ButtonVariant};
use ui::common::v_flex;
use ui::common::{StyledExt as _, v_flex};
use ui::layout::panel::Panel;
use crate::identity::import::ImportDialog;
@@ -47,12 +47,7 @@ impl Render for SignedOutView {
.items_center()
.justify_center()
.gap_4()
.child(
div()
.text_2xl()
.font_weight(FontWeight::SEMIBOLD)
.child("Signed"),
)
.child(div().text_2xl().font_semibold().child("Signed"))
.child(
v_flex()
.gap_1()
+8 -7
View File
@@ -7,9 +7,9 @@ use metadata::ProfileDirectory;
use signed_core::Announcement;
use signed_state::{RepoListStore, Timestamp};
use ui::avatar::Avatar;
use ui::common::{Sizable as _, h_flex, v_flex};
use ui::common::{Sizable as _, StyledExt as _, h_flex, v_flex};
use ui::icons::{Icon, IconRole};
use ui::theme::{ActiveTheme as _, TextRole, Typeset as _};
use ui::theme::ActiveTheme as _;
use utils::relative_time;
use crate::repo::actions::open_repo_panel;
@@ -111,7 +111,8 @@ pub(super) fn render_card(
.child(
div()
.min_w_0()
.typeset(TextRole::Headline, cx)
.text_sm()
.font_semibold()
.whitespace_nowrap()
.text_ellipsis()
.child(name),
@@ -120,7 +121,7 @@ pub(super) fn render_card(
this.child(
h_flex()
.gap_1()
.typeset(TextRole::Caption, cx)
.text_xs()
.text_color(cx.theme().colors.muted_foreground)
.whitespace_nowrap()
.child(
@@ -136,7 +137,7 @@ pub(super) fn render_card(
div()
.h_16()
.min_w_0()
.typeset(TextRole::Caption, cx)
.text_xs()
.text_color(cx.theme().colors.muted_foreground)
.line_clamp(2)
.child(description),
@@ -157,7 +158,7 @@ pub(super) fn render_card(
)
.child(
div()
.typeset(TextRole::Caption, cx)
.text_xs()
.text_color(cx.theme().colors.muted_foreground)
.whitespace_nowrap()
.child(owner_name),
@@ -167,7 +168,7 @@ pub(super) fn render_card(
h_flex()
.flex_1()
.justify_end()
.typeset(TextRole::Caption, cx)
.text_xs()
.text_color(cx.theme().colors.muted_foreground)
.whitespace_nowrap()
.child(activity),
+2 -3
View File
@@ -6,7 +6,7 @@ use signed_state::Backend;
use ui::button::{Button, ButtonVariant};
use ui::common::v_flex;
use ui::dialog::{Dialog, DialogHandle};
use ui::theme::{ActiveTheme as _, TextRole, Typeset as _};
use ui::theme::ActiveTheme as _;
pub struct ExitDialog {
handle: DialogHandle,
@@ -31,8 +31,7 @@ impl Render for ExitDialog {
.content(|_, cx| {
v_flex()
.child(
div()
.typeset(TextRole::Body, cx)
div().text_base()
.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.",
+2 -2
View File
@@ -9,7 +9,7 @@ use ui::common::v_flex;
use ui::dialog::{Dialog, DialogHandle};
use ui::field::Field;
use ui::input::{Input, InputState, InputStateEvent};
use ui::theme::{ActiveTheme as _, TextRole, Typeset as _};
use ui::theme::ActiveTheme as _;
use crate::shared::progress::{DialogProgress, error_row};
@@ -163,7 +163,7 @@ impl Render for ImportDialog {
.gap_3()
.child(
div()
.typeset(TextRole::Body, cx)
.text_base()
.text_color(cx.theme().colors.muted_foreground)
.child(description),
)
+2 -2
View File
@@ -9,7 +9,7 @@ use ui::common::v_flex;
use ui::dialog::{Dialog, DialogHandle};
use ui::field::Field;
use ui::input::{Input, InputState};
use ui::theme::{ActiveTheme as _, TextRole, Typeset as _};
use ui::theme::ActiveTheme as _;
use crate::shared::progress::{DialogProgress, error_row};
@@ -96,7 +96,7 @@ impl Render for OnboardingDialog {
.gap_3()
.child(
div()
.typeset(TextRole::Body, cx)
.text_base()
.text_color(cx.theme().colors.muted_foreground)
.child("Set up your Signed identity to get started."),
)
+7 -7
View File
@@ -9,10 +9,10 @@ use ui::avatar::Avatar;
use ui::badge::Badge;
use ui::common::{Sizable as _, h_flex, v_flex};
use ui::icons::{Icon, IconRole};
use ui::theme::{ActiveTheme as _, TextRole, Typeset as _};
use ui::theme::ActiveTheme as _;
use utils::relative_time;
pub fn repo_header(id: SharedString, name: SharedString, unread: usize, cx: &App) -> AnyElement {
pub fn repo_header(id: SharedString, name: SharedString, unread: usize) -> AnyElement {
h_flex()
.h_12()
.w_full()
@@ -20,7 +20,7 @@ pub fn repo_header(id: SharedString, name: SharedString, unread: usize, cx: &App
.child(
div()
.min_w_0()
.typeset(TextRole::Body, cx)
.text_base()
.whitespace_nowrap()
.text_ellipsis()
.child(name),
@@ -36,7 +36,7 @@ pub fn empty_section_row(cx: &App) -> AnyElement {
.h_12()
.w_full()
.px_3()
.typeset(TextRole::Caption, cx)
.text_xs()
.text_color(cx.theme().colors.muted_foreground)
.bg(cx.theme().colors.secondary)
.rounded(cx.theme().radius.control)
@@ -78,7 +78,7 @@ pub fn thread(
.child(
h_flex()
.gap_2()
.typeset(TextRole::Body, cx)
.text_base()
.child(
h_flex()
.size_6()
@@ -134,7 +134,7 @@ fn sub_activity(
.flex_1()
.min_w_0()
.gap_1()
.typeset(TextRole::Caption, cx)
.text_xs()
.child(
Avatar::new(event.pubkey)
.name(name.clone())
@@ -184,7 +184,7 @@ pub fn empty_state(message: &'static str, cx: &App) -> AnyElement {
)
.child(
div()
.typeset(TextRole::Body, cx)
.text_base()
.text_color(cx.theme().colors.muted_foreground)
.child(SharedString::from(message)),
)
+4 -4
View File
@@ -12,11 +12,10 @@ use nostr::prelude::{Event, EventId, Kind, PublicKey, Timestamp};
use signed_core::{InboxItem, InboxReadState, RepoAddr};
use signed_state::{Backend, BackendEvent, Inbox, RefreshGate, RefreshRequest, RepoListStore};
use ui::button::Button;
use ui::common::{h_flex, v_flex};
use ui::common::{StyledExt as _, h_flex, v_flex};
use ui::icons::{Icon, IconRole};
use ui::layout::panel::Panel;
use ui::scroll_area::ScrollArea;
use ui::theme::{TextRole, Typeset as _};
mod helpers;
@@ -351,7 +350,7 @@ impl InboxView {
.map(ToString::to_string)
.unwrap_or_default()
));
repo_header(id, name, section.unread, cx)
repo_header(id, name, section.unread)
}
InboxRow::Entry(section_ix, entry_ix) => {
let Some(section) = self.sections.get(section_ix) else {
@@ -416,7 +415,8 @@ impl Render for InboxView {
.gap_2()
.child(
div()
.typeset(TextRole::Headline, cx)
.text_sm()
.font_semibold()
.child(SharedString::from("Inbox")),
)
.child(div().flex_1())
+6 -7
View File
@@ -7,12 +7,12 @@ use nostr::prelude::{EventId, PublicKey};
use signed_core::GitEvent;
use signed_state::RepoStore;
use ui::avatar::Avatar;
use ui::common::{Sizable as _, h_flex, v_flex};
use ui::common::{Sizable as _, StyledExt as _, h_flex, v_flex};
use ui::empty_state::EmptyState;
use ui::input::InputState;
use ui::layout::panel::Panel;
use ui::scroll_area::ScrollArea;
use ui::theme::{ActiveTheme as _, TextRole, Typeset as _};
use ui::theme::ActiveTheme as _;
use utils::relative_time;
use crate::issues::helpers::{comment_form, comments_section, issue_roots, sidebar_section};
@@ -147,7 +147,8 @@ impl Render for IssueDetailView {
div()
.flex_1()
.min_w_0()
.typeset(TextRole::Headline, cx)
.text_sm()
.font_semibold()
.child(title),
),
)
@@ -160,7 +161,7 @@ impl Render for IssueDetailView {
.child(
h_flex()
.gap_2()
.typeset(TextRole::Body, cx)
.text_base()
.child(
h_flex()
.gap_1()
@@ -187,9 +188,7 @@ impl Render for IssueDetailView {
.child(SharedString::from(age)),
),
)
.child(
div().typeset(TextRole::Body, cx).child(content),
),
.child(div().text_base().child(content)),
)
.child(comments_section(
&self.store,
+8 -13
View File
@@ -9,10 +9,10 @@ use signed_state::RepoStore;
use ui::avatar::Avatar;
use ui::badge::{Badge, BadgeVariant};
use ui::button::Button;
use ui::common::{Sizable as _, h_flex, v_flex};
use ui::common::{Sizable as _, StyledExt as _, h_flex, v_flex};
use ui::icons::{Icon, IconRole};
use ui::input::{Input, InputState};
use ui::theme::{ActiveTheme as _, TextRole, Typeset as _};
use ui::theme::ActiveTheme as _;
use ui::tooltip::Tooltip;
use utils::relative_time;
@@ -129,12 +129,7 @@ pub(crate) fn sidebar_section(
.picture(profile.picture())
.small(),
)
.child(
div()
.typeset(TextRole::Body, cx)
.text_ellipsis()
.child(name),
)
.child(div().text_base().text_ellipsis().child(name))
.into_any_element()
})),
)
@@ -146,7 +141,7 @@ pub(crate) fn sidebar_section(
if labels.is_empty() {
this.child(
div()
.typeset(TextRole::Body, cx)
.text_base()
.text_color(cx.theme().colors.muted_foreground)
.child("None yet."),
)
@@ -173,7 +168,7 @@ pub(crate) fn comments_section(
v_flex()
.gap_4()
.child(div().typeset(TextRole::Caption2, cx).child(title))
.child(div().text_xs().font_medium().child(title))
.children(comments.iter().map(|comment| {
let profile = directory.read(cx).profile(&comment.pubkey, cx);
let author = profile.name();
@@ -189,7 +184,7 @@ pub(crate) fn comments_section(
.child(
h_flex()
.gap_2()
.typeset(TextRole::Body, cx)
.text_base()
.child(
h_flex()
.gap_1()
@@ -212,7 +207,7 @@ pub(crate) fn comments_section(
.child(SharedString::from(age)),
),
)
.child(div().typeset(TextRole::Body, cx).child(content))
.child(div().text_base().child(content))
}))
.into_any_element()
}
@@ -241,7 +236,7 @@ pub(crate) fn comment_form(
.child(
h_flex()
.gap_1()
.typeset(TextRole::Caption, cx)
.text_xs()
.text_color(cx.theme().colors.muted_foreground)
.child(
Icon::named(IconRole::Markdown)
+3 -3
View File
@@ -17,7 +17,7 @@ use ui::icons::{Icon, IconRole};
use ui::layout::panel::Panel;
use ui::scrollbar::Scrollbar;
use ui::segmented::{Segmented, SegmentedOption};
use ui::theme::{ActiveTheme as _, TextRole, Typeset as _};
use ui::theme::ActiveTheme as _;
use utils::relative_time;
use self::detail::IssueDetailView;
@@ -252,7 +252,7 @@ impl Render for IssuesView {
.gap_1()
.child(
div()
.typeset(TextRole::Body, cx)
.text_base()
.text_ellipsis()
.whitespace_nowrap()
.child(title),
@@ -260,7 +260,7 @@ impl Render for IssuesView {
.child(
h_flex()
.gap_2()
.typeset(TextRole::Caption, cx)
.text_xs()
.child(
h_flex()
.gap_1()
+2 -2
View File
@@ -8,7 +8,7 @@ use ui::common::v_flex;
use ui::dialog::{Dialog, DialogHandle};
use ui::field::Field;
use ui::input::{Input, InputState};
use ui::theme::{ActiveTheme as _, TextRole, Typeset as _};
use ui::theme::ActiveTheme as _;
pub struct NewIssueDialog {
handle: DialogHandle,
@@ -58,7 +58,7 @@ impl Render for NewIssueDialog {
.gap_3()
.child(
div()
.typeset(TextRole::Body, cx)
.text_base()
.text_color(cx.theme().colors.muted_foreground)
.child("Report a bug, ask a question, or propose a change."),
)
@@ -14,7 +14,7 @@ use signed_state::{Backend, Mirrors, RepoStore};
use ui::avatar::Avatar;
use ui::button::Button;
use ui::clipboard::ClipboardButton;
use ui::common::{Sizable as _, h_flex, v_flex};
use ui::common::{Sizable as _, StyledExt as _, h_flex, v_flex};
use ui::icons::{Icon, IconRole};
use ui::input::InputState;
use ui::layout::panel::Panel;
@@ -22,7 +22,7 @@ use ui::scroll_area::ScrollArea;
use ui::scrollbar::Scrollbar;
use ui::spinner::Spinner;
use ui::tabs::{Tab, Tabs};
use ui::theme::{ActiveTheme as _, TextRole, Typeset as _};
use ui::theme::ActiveTheme as _;
use utils::relative_time;
use super::dialogs;
@@ -376,7 +376,7 @@ impl PullRequestDetailView {
.child(
h_flex()
.gap_2()
.typeset(TextRole::Body, cx)
.text_base()
.child(
h_flex()
.gap_1()
@@ -397,9 +397,7 @@ impl PullRequestDetailView {
)
.when(!self.description.is_empty(), |this| {
this.child(
div()
.typeset(TextRole::Body, cx)
.child(self.description.clone()),
div().text_base().child(self.description.clone()),
)
}),
)
@@ -527,7 +525,8 @@ impl PullRequestDetailView {
div()
.flex_1()
.min_w_0()
.typeset(TextRole::Headline, cx)
.text_sm()
.font_semibold()
.text_ellipsis()
.child(title),
),
@@ -574,7 +573,7 @@ impl PullRequestDetailView {
h_flex()
.gap_1()
.font_family(cx.theme().mono_font)
.typeset(TextRole::Caption, cx)
.text_xs()
.text_color(cx.theme().colors.muted_foreground)
.child(id.clone())
.child(ClipboardButton::new("pr-commit", &id)),
@@ -9,7 +9,7 @@ use ui::common::v_flex;
use ui::dialog::{Dialog, DialogHandle};
use ui::field::Field;
use ui::input::{Input, InputState};
use ui::theme::{ActiveTheme as _, TextRole, Typeset as _};
use ui::theme::ActiveTheme as _;
pub struct UpdatePrDialog {
handle: DialogHandle,
@@ -55,7 +55,7 @@ impl Render for UpdatePrDialog {
.gap_3()
.child(
div()
.typeset(TextRole::Body, cx)
.text_base()
.text_color(cx.theme().colors.muted_foreground)
.child("Publish a new revision with the output of `git format-patch`."),
)
+3 -3
View File
@@ -17,7 +17,7 @@ use ui::layout::panel::Panel;
use ui::menu::MenuItem;
use ui::scrollbar::Scrollbar;
use ui::segmented::{Segmented, SegmentedOption};
use ui::theme::{ActiveTheme as _, TextRole, Typeset as _};
use ui::theme::ActiveTheme as _;
use utils::relative_time;
mod detail;
@@ -387,7 +387,7 @@ impl Render for PullRequestsView {
.gap_1()
.child(
div()
.typeset(TextRole::Body, cx)
.text_base()
.text_ellipsis()
.whitespace_nowrap()
.child(title),
@@ -395,7 +395,7 @@ impl Render for PullRequestsView {
.child(
h_flex()
.gap_2()
.typeset(TextRole::Caption, cx)
.text_xs()
.child(
h_flex()
.gap_1()
+8 -11
View File
@@ -9,7 +9,7 @@ use gpui::{
use signed_state::{CheckoutsStore, RepoStore};
use ui::button::Button;
use ui::combobox::{Combobox, ComboboxState};
use ui::common::{h_flex, v_flex};
use ui::common::{StyledExt as _, h_flex, v_flex};
use ui::icons::{Icon, IconRole};
use ui::input::{Input, InputState};
use ui::layout::panel::Panel;
@@ -17,7 +17,7 @@ use ui::menu::Menu;
use ui::scrollbar::Scrollbar;
use ui::spinner::Spinner;
use ui::tabs::{Tab, Tabs};
use ui::theme::{ActiveTheme as _, TextRole, Typeset as _};
use ui::theme::ActiveTheme as _;
use super::helpers::{ForkCompare, fork_display_name, truncate_label};
use crate::repo::commit_diff::{CommitDiffView, DiffPane};
@@ -281,17 +281,17 @@ impl NewPullRequestView {
.child(
v_flex()
.gap_1()
.child(label("Merge Into", cx))
.child(label("Merge Into"))
.child(div().w(px(160.)).child(self.base_select.clone())),
)
.child(
v_flex()
.gap_1()
.child(label("Pull From", cx))
.child(label("Pull From"))
.child(div().w(px(160.)).child(self.compare_select.clone())),
)
.child(
v_flex().gap_1().child(label("Source", cx)).child(
v_flex().gap_1().child(label("Source")).child(
Menu::new("pr-source")
.open(self.source_open)
.on_change(move |open, _, cx| {
@@ -475,7 +475,7 @@ impl Render for NewPullRequestView {
.when_some(self.error.clone(), |this, error| {
this.child(
div()
.typeset(TextRole::Caption, cx)
.text_xs()
.text_color(cx.theme().ramps.destructive.base)
.child(error),
)
@@ -493,9 +493,6 @@ impl Render for NewPullRequestView {
}
}
fn label(text: &'static str, cx: &App) -> AnyElement {
div()
.typeset(TextRole::Caption2, cx)
.child(text)
.into_any_element()
fn label(text: &'static str) -> AnyElement {
div().text_xs().font_medium().child(text).into_any_element()
}
@@ -9,7 +9,7 @@ use ui::common::{h_flex, v_flex};
use ui::icons::{Icon, IconRole};
use ui::input::{Input, InputState};
use ui::layout::panel::Panel;
use ui::theme::{ActiveTheme as _, TextRole, Typeset as _};
use ui::theme::ActiveTheme as _;
use crate::workspace::Workspace;
@@ -148,7 +148,7 @@ impl Render for SendPatchView {
)
.child(
div()
.typeset(TextRole::Caption, cx)
.text_xs()
.text_color(cx.theme().colors.muted_foreground)
.child(
"You can paste a git diff or a git format-patch patch series here.",
@@ -162,7 +162,7 @@ impl Render for SendPatchView {
.when_some(self.error.clone(), |this, error| {
this.child(
div()
.typeset(TextRole::Caption, cx)
.text_xs()
.text_color(cx.theme().ramps.destructive.base)
.child(error),
)
+12 -13
View File
@@ -10,13 +10,13 @@ use gpui::{
use signed_git::{CommitDiff, DiffStatus, FileCommit, FileDiff, Repo};
use ui::badge::{Badge, BadgeVariant};
use ui::clipboard::ClipboardButton;
use ui::common::{h_flex, v_flex};
use ui::common::{StyledExt as _, h_flex, v_flex};
use ui::icons::{Icon, IconRole};
use ui::layout::panel::Panel;
use ui::layout::resizable::{Resizable, ResizableState};
use ui::scrollbar::Scrollbar;
use ui::spinner::Spinner;
use ui::theme::{ActiveTheme as _, TextRole, Typeset as _};
use ui::theme::ActiveTheme as _;
use ui::tree::{Tree, TreeItem};
use utils::relative_time_secs;
@@ -283,7 +283,8 @@ impl DiffPane {
.gap_2()
.child(
div()
.typeset(TextRole::Caption2, cx)
.text_xs()
.font_medium()
.text_color(status_color)
.child(status_label),
)
@@ -291,7 +292,8 @@ impl DiffPane {
div()
.flex_1()
.min_w_0()
.typeset(TextRole::Caption2, cx)
.text_xs()
.font_medium()
.text_ellipsis()
.whitespace_nowrap()
.child(title),
@@ -300,7 +302,7 @@ impl DiffPane {
this.child(
h_flex()
.gap_2()
.typeset(TextRole::Caption, cx)
.text_xs()
.child(
div()
.text_color(cx.theme().ramps.success.base)
@@ -447,7 +449,8 @@ impl CommitDiffView {
v_flex()
.child(
div()
.typeset(TextRole::Headline, cx)
.text_sm()
.font_semibold()
.text_ellipsis()
.whitespace_nowrap()
.child(commit.summary.clone()),
@@ -455,7 +458,7 @@ impl CommitDiffView {
.child(
h_flex()
.gap_2()
.typeset(TextRole::Body, cx)
.text_base()
.child(SharedString::from(format!("{} committed", commit.author)))
.child(
h_flex()
@@ -472,16 +475,12 @@ impl CommitDiffView {
),
)
.when_some(commit.description.as_ref(), |this, description| {
this.child(
div()
.typeset(TextRole::Body, cx)
.child(SharedString::from(description)),
)
this.child(div().text_base().child(SharedString::from(description)))
})
.child(
h_flex()
.gap_2()
.typeset(TextRole::Caption, cx)
.text_xs()
.child(Badge::new("commit-files", format!("{files} files changed")))
.when(insertions > 0, |this| {
this.child(
+11 -12
View File
@@ -7,9 +7,9 @@ use nostr::prelude::PublicKey;
use signed_core::Announcement;
use ui::avatar::Avatar;
use ui::clipboard::ClipboardButton;
use ui::common::{Sizable as _, h_flex, v_flex};
use ui::common::{Sizable as _, StyledExt as _, h_flex, v_flex};
use ui::dialog::{Dialog, DialogHandle};
use ui::theme::{ActiveTheme as _, TextRole, Typeset as _};
use ui::theme::ActiveTheme as _;
use utils::middle_truncate;
pub struct AboutDialog {
@@ -61,7 +61,6 @@ fn announcement_rows(
.as_deref()
.map(SharedString::from)
.unwrap_or_else(|| SharedString::from("-")),
cx,
),
cx,
));
@@ -73,7 +72,6 @@ fn announcement_rows(
.as_deref()
.map(SharedString::from)
.unwrap_or_else(|| SharedString::from("-")),
cx,
),
cx,
));
@@ -99,13 +97,13 @@ fn announcement_rows(
}
if let Some(upstream) = &announcement.upstream {
rows.push(row("Upstream", text(upstream.display(), cx), cx));
rows.push(row("Upstream", text(upstream.display()), cx));
}
if !announcement.hashtags.is_empty() {
rows.push(row(
"Hashtags",
text(SharedString::from(announcement.hashtags.join(", ")), cx),
text(SharedString::from(announcement.hashtags.join(", "))),
cx,
));
}
@@ -151,7 +149,8 @@ fn row(label: &'static str, value: AnyElement, cx: &App) -> AnyElement {
.min_w_0()
.child(
div()
.typeset(TextRole::Caption2, cx)
.text_xs()
.font_medium()
.text_color(cx.theme().colors.muted_foreground)
.child(label),
)
@@ -159,12 +158,12 @@ fn row(label: &'static str, value: AnyElement, cx: &App) -> AnyElement {
.into_any_element()
}
fn text<T>(value: T, cx: &App) -> AnyElement
fn text<T>(value: T) -> AnyElement
where
T: Into<SharedString>,
{
div()
.typeset(TextRole::Body, cx)
.text_base()
.w_full()
.min_w_0()
.child(value.into())
@@ -179,7 +178,7 @@ fn copy_value(id: &'static str, value: String, cx: &App) -> AnyElement {
.child(
div()
.font_family(cx.theme().mono_font)
.typeset(TextRole::Caption, cx)
.text_xs()
.min_w_0()
.child(SharedString::from(value.clone())),
)
@@ -216,7 +215,7 @@ fn maintainers(
.overflow_hidden()
.whitespace_nowrap()
.text_ellipsis()
.typeset(TextRole::Body, cx)
.text_base()
.child(name),
)
.into_any_element()
@@ -243,7 +242,7 @@ fn list(id: &'static str, items: impl IntoIterator<Item = String>, cx: &App) ->
.min_w_0()
.whitespace_nowrap()
.text_ellipsis()
.typeset(TextRole::Body, cx)
.text_base()
.child(SharedString::from(middle_truncate(&item, 28, 16))),
)
.child(ClipboardButton::new(
@@ -10,8 +10,7 @@ use ui::button::{Button, ButtonVariant};
use ui::common::{Sizable, h_flex, v_flex};
use ui::icons::{Icon, IconRole};
use ui::input::{Input, InputState};
use ui::switch::Switch;
use ui::theme::{ActiveTheme as _, TextRole, Typeset as _};
use ui::theme::ActiveTheme as _;
use ui::tooltip::Tooltip;
/// State of the grasp-server section of a publish dialog, so async results can be rendered.
@@ -72,7 +71,7 @@ pub fn grasp_servers_field(
h_flex()
.justify_between()
.items_center()
.child(div().typeset(TextRole::Caption, cx).child("Grasp servers"))
.child(div().text_xs().child("Grasp servers"))
.child(
Button::new("toggle-grasp-servers")
.icon(Icon::named(if servers_enabled {
@@ -99,7 +98,7 @@ pub fn grasp_servers_field(
section
.child(
div()
.typeset(TextRole::Caption, cx)
.text_xs()
.text_color(cx.theme().colors.muted_foreground)
.child("Where the repository is hosted"),
)
@@ -133,7 +132,7 @@ pub fn grasp_servers_field(
.when(loading_servers, |section| {
section.child(
div()
.typeset(TextRole::Caption, cx)
.text_xs()
.text_color(cx.theme().colors.muted_foreground)
.child("Loading your grasp servers..."),
)
@@ -141,7 +140,7 @@ pub fn grasp_servers_field(
.when_some(error, |section, error| {
section.child(
div()
.typeset(TextRole::Caption, cx)
.text_xs()
.text_color(cx.theme().ramps.destructive.base)
.child(error),
)
@@ -167,7 +166,7 @@ fn render_server_row(
.px_2()
.bg(cx.theme().colors.muted)
.text_color(cx.theme().colors.muted_foreground)
.typeset(TextRole::Caption, cx)
.text_xs()
.rounded(cx.theme().radius.control)
.child(server_host(relay)),
)
+3 -3
View File
@@ -16,7 +16,7 @@ use ui::field::Field;
use ui::icons::{Icon, IconRole};
use ui::input::{Input, InputState};
use ui::select::{Select, SelectOption};
use ui::theme::{ActiveTheme as _, TextRole, Typeset as _};
use ui::theme::ActiveTheme as _;
use super::grasp_servers::{GraspServersState, grasp_servers_field, load_user_grasp_servers};
use crate::repo::RepoDetailView;
@@ -186,7 +186,7 @@ impl Render for InitRepoDialog {
.gap_3()
.child(
div()
.typeset(TextRole::Body, cx)
.text_base()
.text_color(cx.theme().colors.muted_foreground)
.child("Publish this local repository to Nostr."),
)
@@ -209,7 +209,7 @@ impl Render for InitRepoDialog {
.w_full()
.px_2()
.bg(cx.theme().colors.muted)
.typeset(TextRole::Body, cx)
.text_base()
.text_color(cx.theme().colors.muted_foreground)
.rounded(cx.theme().radius.control)
.child(folder.clone()),
+4 -7
View File
@@ -6,7 +6,7 @@ use signed_state::RepoStore;
use ui::button::{Button, ButtonVariant};
use ui::common::v_flex;
use ui::dialog::{Dialog, DialogHandle};
use ui::theme::{ActiveTheme as _, TextRole, Typeset as _};
use ui::theme::ActiveTheme as _;
pub struct ResetRemoteDialog {
handle: DialogHandle,
@@ -39,16 +39,14 @@ impl Render for ResetRemoteDialog {
v_flex()
.gap_2()
.child(
div()
.typeset(TextRole::Body, cx)
div().text_base()
.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.",
),
)
.child(if deleted.is_empty() {
div()
.typeset(TextRole::Body, cx)
div().text_base()
.text_color(cx.theme().colors.muted_foreground)
.child("No server refs will be deleted.")
.into_any_element()
@@ -56,8 +54,7 @@ impl Render for ResetRemoteDialog {
v_flex()
.gap_1()
.children(deleted.iter().map(|name| {
div()
.typeset(TextRole::Body, cx)
div().text_base()
.font_family(cx.theme().mono_font)
.child(name.clone())
}))
+6 -5
View File
@@ -9,10 +9,10 @@ use gpui::{
};
use signed_git::{FileCommit, Repo, WorktreeSnapshot};
use ui::code::CodeViewState;
use ui::common::{h_flex, v_flex};
use ui::common::{StyledExt as _, h_flex, v_flex};
use ui::icons::{Icon, IconRole};
use ui::markdown::MarkdownViewState;
use ui::theme::{ActiveTheme as _, TextRole, Typeset as _};
use ui::theme::ActiveTheme as _;
use ui::tree::{Tree, TreeItem};
use super::helpers::{code_language, is_markdown_path, preview_spinner, source_hash};
@@ -352,7 +352,8 @@ impl RepoFilesView {
.text_color(cx.theme().colors.muted_foreground)
.child(
div()
.typeset(TextRole::Caption2, cx)
.text_xs()
.font_medium()
.text_ellipsis()
.whitespace_nowrap()
.child(pane_title),
@@ -364,14 +365,14 @@ impl RepoFilesView {
.gap_1()
.child(
div()
.typeset(TextRole::Caption, cx)
.text_xs()
.font_family(cx.theme().mono_font)
.child(commit.id.clone()),
)
.child(
div()
.max_w(px(250.))
.typeset(TextRole::Caption, cx)
.text_xs()
.text_ellipsis()
.whitespace_nowrap()
.child(commit.summary.clone()),
+13 -21
View File
@@ -9,12 +9,12 @@ use signed_state::{Backend, Nip34Kind};
use ui::avatar::Avatar;
use ui::button::{Button, ButtonVariant};
use ui::clipboard::ClipboardButton;
use ui::common::{Sizable, h_flex, v_flex};
use ui::common::{Sizable, StyledExt as _, h_flex, v_flex};
use ui::dropdown_menu::DropdownMenu;
use ui::icons::{Icon, IconRole};
use ui::menu::MenuItem;
use ui::popover::Popover;
use ui::theme::{ActiveTheme as _, TextRole, Typeset as _};
use ui::theme::ActiveTheme as _;
use ui::tooltip::Tooltip;
use utils::relative_time_secs;
@@ -103,14 +103,15 @@ impl RepoDetailView {
.child(
h_flex()
.gap_2()
.typeset(TextRole::Headline, cx)
.text_sm()
.font_semibold()
.child(avatar)
.child(name),
)
.child(
div()
.min_w_0()
.typeset(TextRole::Callout, cx)
.text_sm()
.text_color(cx.theme().colors.muted_foreground)
.line_clamp(3)
.child(description),
@@ -151,28 +152,24 @@ 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()
.typeset(TextRole::Caption, cx)
.text_xs()
.text_color(cx.theme().colors.muted_foreground)
.child("Grasp Servers"),
)
.when(git_for_popover.is_empty(), |this| {
this.child(
div()
.typeset(TextRole::Caption, cx)
.child("No git clone urls."),
div().text_xs().child("No git clone urls."),
)
})
.children(git_for_popover.iter().enumerate().map(
@@ -325,7 +322,7 @@ impl RepoDetailView {
.child(
div()
.min_w_0()
.typeset(TextRole::Caption, cx)
.text_xs()
.text_color(cx.theme().colors.muted_foreground)
.child(path),
)
@@ -383,21 +380,21 @@ impl RepoDetailView {
.child(
div()
.font_family(cx.theme().mono_font)
.typeset(TextRole::Callout, cx)
.text_sm()
.text_color(cx.theme().colors.muted_foreground)
.child(SharedString::from(short)),
)
.child(
div()
.max_w(px(220.))
.typeset(TextRole::Callout, cx)
.text_sm()
.text_ellipsis()
.whitespace_nowrap()
.child(commit.summary.clone()),
)
.child(
div()
.typeset(TextRole::Callout, cx)
.text_sm()
.text_color(cx.theme().colors.muted_foreground)
.child(relative_time_secs(commit.time)),
)
@@ -434,17 +431,12 @@ impl RepoDetailView {
.picture(owner.picture())
.small(),
)
.child(
div()
.typeset(TextRole::Caption, cx)
.whitespace_nowrap()
.child(owner_name),
),
.child(div().text_xs().whitespace_nowrap().child(owner_name)),
)
.when(!rest.is_empty(), |this| {
this.child(
div()
.typeset(TextRole::Caption, cx)
.text_xs()
.text_color(cx.theme().colors.muted_foreground)
.child(SharedString::from(format!("+{}", rest.len()))),
)
+13 -21
View File
@@ -14,9 +14,9 @@ use signed_state::{Nip34Binding, RepoListStore, RepoStore};
use ui::avatar::Avatar;
use ui::clipboard::ClipboardButton;
use ui::combobox::ComboboxState;
use ui::common::{Sizable as _, h_flex, v_flex};
use ui::common::{Sizable as _, StyledExt as _, h_flex, v_flex};
use ui::icons::{Icon, IconRole};
use ui::theme::{ActiveTheme as _, TextRole, Typeset as _};
use ui::theme::ActiveTheme as _;
use utils::relative_time_secs;
use super::RepoDetailView;
@@ -52,19 +52,10 @@ pub(super) struct RepoData {
pub(super) head_commit: Option<FileCommit>,
}
pub(super) fn clone_group(
label: &str,
id: &'static str,
command: &SharedString,
cx: &App,
) -> AnyElement {
pub(super) fn clone_group(label: &str, id: &'static str, command: &SharedString) -> AnyElement {
v_flex()
.gap_1()
.child(
div()
.typeset(TextRole::Caption, cx)
.child(SharedString::from(label)),
)
.child(div().text_xs().child(SharedString::from(label)))
.child(ClipboardButton::new(id, command.clone()))
.into_any_element()
}
@@ -114,7 +105,7 @@ pub(super) fn fork_row(
let row = h_flex()
.gap_1()
.min_w_0()
.typeset(TextRole::Body, cx)
.text_base()
.text_color(cx.theme().colors.muted_foreground)
.child(Icon::named(IconRole::GitBranch).small())
.child(div().whitespace_nowrap().text_ellipsis().child(label));
@@ -187,7 +178,7 @@ pub(super) fn bound_repo_label(
h_flex()
.flex_shrink_0()
.gap_2()
.typeset(TextRole::Body, cx)
.text_base()
.child("Initialized by")
.text_color(cx.theme().colors.muted_foreground)
.when_some(profile, |this, profile| {
@@ -208,7 +199,8 @@ pub(super) fn bound_repo_label(
.when_some(binding.identifier.as_deref(), |this, ident| {
this.child(
div()
.typeset(TextRole::Caption2, cx)
.text_xs()
.font_medium()
.child(SharedString::from(format!("/{ident}"))),
)
})
@@ -292,7 +284,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)
.typeset(TextRole::Caption, cx)
.text_xs()
.bg(cx.theme().colors.muted)
.border_y_1()
.border_color(cx.theme().colors.border)
@@ -318,7 +310,7 @@ fn render_diff_line(line: &DiffLine, cx: &App) -> AnyElement {
.w_full()
.h(px(DIFF_ROW_HEIGHT))
.font_family(cx.theme().mono_font)
.typeset(TextRole::Caption, cx)
.text_xs()
.when_some(bg, |this, bg| this.bg(bg))
.child(
div()
@@ -379,7 +371,7 @@ pub(crate) fn commit_row(
.child(
div()
.font_family(cx.theme().mono_font)
.typeset(TextRole::Callout, cx)
.text_sm()
.text_color(cx.theme().colors.muted_foreground)
.child(commit.id.clone()),
)
@@ -387,7 +379,7 @@ pub(crate) fn commit_row(
div()
.flex_1()
.min_w_0()
.typeset(TextRole::Callout, cx)
.text_sm()
.text_ellipsis()
.whitespace_nowrap()
.child(commit.summary.clone()),
@@ -396,7 +388,7 @@ pub(crate) fn commit_row(
.child(
h_flex()
.gap_2()
.typeset(TextRole::Caption, cx)
.text_xs()
.text_color(cx.theme().colors.muted_foreground)
.child(commit.author.clone())
.child(relative_time_secs(commit.time)),
+2 -2
View File
@@ -13,7 +13,7 @@ use ui::common::{Sizable as _, v_flex};
use ui::icons::{Icon, IconRole};
use ui::scrollbar::Scrollbar;
use ui::spinner::Spinner;
use ui::theme::{ActiveTheme as _, TextRole, Typeset as _};
use ui::theme::ActiveTheme as _;
use ui::tooltip::Tooltip;
use super::RepoDetailView;
@@ -249,7 +249,7 @@ impl Render for RepoHistoryView {
div()
.py_2()
.w_full()
.typeset(TextRole::Caption, cx)
.text_xs()
.text_color(cx.theme().colors.muted_foreground)
.child(format!("Showing {shown} of {total} commits")),
)
+2 -2
View File
@@ -23,7 +23,7 @@ use ui::icons::{Icon, IconRole};
use ui::layout::panel::Panel;
use ui::sidebar::{Sidebar, SidebarEntry};
use ui::spinner::Spinner;
use ui::theme::{ActiveTheme as _, TextRole, Typeset as _};
use ui::theme::ActiveTheme as _;
pub mod actions;
pub mod commit_diff;
@@ -854,7 +854,7 @@ impl RepoDetailView {
.child(Spinner::new("repo-loading"))
.child(
div()
.typeset(TextRole::Body, cx)
.text_base()
.text_color(cx.theme().colors.muted_foreground)
.child(label),
)
+8 -8
View File
@@ -6,11 +6,11 @@ use gpui::{
};
use settings::{AppearanceMode, EventFetchingStrategy, SettingsStore};
use ui::button::Button;
use ui::common::{h_flex, v_flex};
use ui::common::{StyledExt as _, h_flex, v_flex};
use ui::icons::{Icon, IconRole};
use ui::input::{Input, InputState};
use ui::select::{Select, SelectOption};
use ui::theme::{ActiveTheme as _, TextRole, Typeset as _};
use ui::theme::ActiveTheme as _;
use ui::tooltip::Tooltip;
use crate::repo::dialogs::grasp_servers::{normalize_server, server_host};
@@ -31,10 +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_semibold().child(title.into()))
.child(
div()
.typeset(TextRole::Caption, cx)
.text_xs()
.text_color(cx.theme().colors.muted_foreground)
.child(description.into()),
),
@@ -56,10 +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_semibold().child(title.into()))
.child(
div()
.typeset(TextRole::Caption, cx)
.text_xs()
.text_color(cx.theme().colors.muted_foreground)
.child(description.into()),
),
@@ -127,7 +127,7 @@ pub fn grasp_servers_editor(input: &Entity<InputState>, cx: &App) -> AnyElement
.px_2()
.bg(cx.theme().colors.muted)
.text_color(cx.theme().colors.muted_foreground)
.typeset(TextRole::Caption, cx)
.text_xs()
.rounded(cx.theme().radius.control)
.child(display_server(server)),
)
@@ -227,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)
.typeset(TextRole::Caption, cx)
.text_xs()
.rounded(cx.theme().radius.control)
.child(path.display().to_string()),
)
+5 -5
View File
@@ -7,7 +7,7 @@ use signed_state::{Backend, BackendEvent, PushStepStatus};
use ui::common::{h_flex, v_flex};
use ui::icons::{Icon, IconRole};
use ui::spinner::Spinner;
use ui::theme::{ActiveTheme as _, TextRole, Typeset as _};
use ui::theme::ActiveTheme as _;
/// Progress of an async dialog action: a busy flag that disables the form and an error shown below it.
#[derive(Debug, Default)]
@@ -69,7 +69,7 @@ impl DialogProgress {
pub fn error_row(error: &Option<SharedString>, cx: &App) -> Option<AnyElement> {
error.as_ref().map(|message| {
div()
.typeset(TextRole::Body, cx)
.text_base()
.text_color(cx.theme().ramps.destructive.base)
.child(message.clone())
.into_any_element()
@@ -90,14 +90,14 @@ pub fn push_steps_row(steps: &[PushStepStatus], cx: &App) -> Option<AnyElement>
match status {
PushStepStatus::Running(_) => h_flex()
.gap_2()
.typeset(TextRole::Body, cx)
.text_base()
.text_color(cx.theme().colors.muted_foreground)
.child(Spinner::new("push-step"))
.child(label)
.into_any_element(),
PushStepStatus::Done(_) => h_flex()
.gap_2()
.typeset(TextRole::Body, cx)
.text_base()
.text_color(cx.theme().colors.foreground)
.child(
Icon::named(IconRole::Check)
@@ -108,7 +108,7 @@ pub fn push_steps_row(steps: &[PushStepStatus], cx: &App) -> Option<AnyElement>
.into_any_element(),
PushStepStatus::Failed(_, reason) => h_flex()
.gap_2()
.typeset(TextRole::Body, cx)
.text_base()
.text_color(cx.theme().ramps.destructive.base)
.child(
Icon::named(IconRole::Close)
+4 -2
View File
@@ -1,9 +1,10 @@
use gpui::{AnyElement, App, IntoElement, ParentElement as _, SharedString, Styled as _, div};
use signed_core::RepoStatus;
use ui::badge::{Badge, BadgeVariant};
use ui::common::StyledExt as _;
use ui::empty_state::EmptyState;
use ui::icons::{Icon, IconRole};
use ui::theme::{ActiveTheme as _, TextRole, Typeset as _};
use ui::theme::ActiveTheme as _;
use ui::tooltip::Tooltip;
/// The status pill shown on issue and pull-request rows.
@@ -35,7 +36,8 @@ pub fn empty_state(message: impl Into<SharedString>) -> AnyElement {
/// A one-line muted label used by section headers.
pub fn section_label(text: impl Into<SharedString>, cx: &App) -> AnyElement {
div()
.typeset(TextRole::Caption2, cx)
.text_xs()
.font_medium()
.text_color(cx.theme().colors.muted_foreground)
.child(text.into())
.into_any_element()
@@ -4,7 +4,7 @@ use gpui::prelude::FluentBuilder as _;
use gpui::{
App, Context, Entity, InteractiveElement as _, IntoElement, ParentElement as _, Render, Role,
SharedString, StatefulInteractiveElement as _, Styled as _, UniformListScrollHandle, Window,
div, px, uniform_list,
div, px, rems, uniform_list,
};
use metadata::ProfileDirectory;
use nostr::prelude::PublicKey;
@@ -16,7 +16,7 @@ use ui::input::{Input, InputState};
use ui::kbd::Kbd;
use ui::popover::Popover;
use ui::separator::Separator;
use ui::theme::{ActiveTheme as _, TextRole, Typeset};
use ui::theme::ActiveTheme as _;
use ui::tooltip::Tooltip;
use super::{CreateRepository, REPOSITORY_KEY_CONTEXT, SwitchRepository};
@@ -153,7 +153,7 @@ impl Render for RepositorySwitcher {
.cloned()
.collect();
let row_height = theme.sizes.medium.menu_item_height + px(2.);
let row_height = rems(2.0).to_pixels(window.rem_size()) + px(2.);
let list_height = (row_height * visible.len() as f32).min(px(280.));
let list_entries = visible.clone();
let list_directory = directory.clone();
@@ -189,7 +189,7 @@ impl Render for RepositorySwitcher {
.p_3()
.text_color(theme.colors.muted_foreground)
.text_center()
.typeset(TextRole::Callout, cx)
.text_sm()
.child("No repositories found"),
)
} else {
@@ -219,7 +219,7 @@ impl Render for RepositorySwitcher {
.px_3()
.gap_2()
.rounded(theme.radius.control)
.text_size(theme.sizes.medium.text_size)
.text_sm()
.hover(|row| row.bg(theme.colors.muted))
.child(entry.avatar(&list_directory, cx))
.child(