add spam badge for requests

This commit is contained in:
2026-10-20 10:53:45 +07:00
parent 10d74c5396
commit 9143de6cfe
7 changed files with 93 additions and 54 deletions
+1 -2
View File
@@ -394,7 +394,7 @@ impl Render for Screening {
Button::new("njump")
.icon(IconName::Link)
.label("njump.me")
.secondary()
.ghost_alt()
.small()
.rounded()
.on_click(cx.listener(move |this, _e, window, cx| {
@@ -405,7 +405,6 @@ impl Render for Screening {
Button::new("report")
.tooltip("Report as a scam or impostor")
.icon(IconName::Warning)
.small()
.warning()
.rounded()
.on_click(cx.listener(move |this, _e, window, cx| {
+1 -1
View File
@@ -120,7 +120,7 @@ impl Sidebar {
.px_4()
.text_style(TextStyle::Caption)
.font_semibold()
.text_color(cx.theme().text_faint)
.text_color(cx.theme().text_muted)
.child(list_title),
)
})
+28 -8
View File
@@ -118,7 +118,7 @@ impl Sidebar {
.label(label)
.text_style(TextStyle::Caption)
.font_semibold()
.text_color(cx.theme().text_faint)
.text_color(cx.theme().text_muted)
.into_any_element()
}
SidebarRow::Empty(text) => v_flex()
@@ -136,17 +136,20 @@ impl Sidebar {
.border_color(cx.theme().border)
.rounded(px(button_radius()))
.text_style(TextStyle::Caption)
.text_color(cx.theme().text_faint)
.text_color(cx.theme().text_muted)
.child(*text),
)
.into_any_element(),
SidebarRow::Room { room } => {
let id = room.read(cx).id;
let name = room.read(cx).display_name(cx);
let picture = room.read(cx).display_image(cx);
let seed = room.read(cx).display_image_seed(cx);
let created_at = room.read(cx).created_at.to_ago();
let id = room.read(cx).id;
let member = room.read(cx).members().first().copied();
let spam =
room.read(cx).is_spam(cx) && room.read(cx).kind == RoomKind::Request;
let pinned = AppSettings::global(cx).read(cx).pinned_room(id, cx);
let dock = self.dock.clone();
let room = room.clone();
@@ -163,11 +166,28 @@ impl Sidebar {
)
})
.suffix(
div()
.font_normal()
.text_style(TextStyle::Caption)
.text_color(cx.theme().text_faint)
.child(created_at),
h_flex()
.gap_1()
.when(spam, |this| {
this.child(
div()
.px_1()
.rounded(px(button_radius()))
.bg(cx.theme().danger.opacity(0.15))
.text_size(px(8.0))
.text_color(cx.theme().danger)
.child("SPAM"),
)
})
.when(!spam, |this| {
this.child(
div()
.font_normal()
.text_style(TextStyle::Caption)
.text_color(cx.theme().text_faint)
.child(created_at),
)
}),
)
.on_click(move |_event, window, cx| {
open_room(&room, &dock, window, cx);