update gpui-native-kit and adopt text roles
Rust / build (macos-latest, stable) (push) Canceled after 0s
Rust / build (ubuntu-latest, stable) (push) Canceled after 0s
Rust / build (windows-latest, stable) (push) Canceled after 0s
Rust / build (macos-latest, stable) (pull_request) Canceled after 0s
Rust / build (ubuntu-latest, stable) (pull_request) Canceled after 0s
Rust / build (windows-latest, stable) (pull_request) Canceled after 0s

This commit is contained in:
2026-11-13 03:53:42 +07:00
parent a27eca45c8
commit bc6e251b6d
35 changed files with 277 additions and 251 deletions
+11 -10
View File
@@ -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<T>(value: T) -> AnyElement
fn text<T>(value: T, cx: &App) -> AnyElement
where
T: Into<SharedString>,
{
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<Item = String>, 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(
+2 -2
View File
@@ -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."),
)
@@ -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)),
)
+3 -3
View File
@@ -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()),
+4 -4
View File
@@ -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())
}))