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
+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())
}))