forge
Explore
Log in

Don't you dare go Hollow

The Builder badge on your own profile card opens Builder

Browse files at this commit

2d06f820c715de85ddf7da1b1a80b186fb835445Ahmet Kaan GümüşParent: 84a1d97
  • style
    • the Builder badge on your own profile card opens Builder
    • the separate Builder menu row is gone
Show full message
💄 style: the Builder badge on your own profile card opens Builder; the separate Builder menu row is gone
crates/client/src/gui/profile.rsmodified+24 -33
@@ -8,7 +8,7 @@ use std::{collections::HashMap, sync::Arc};
8 8
9 use common::{9 use common::{
10 call::{BanMember, DeleteUser, Kick, SetRank, UpdatePresence},10 call::{BanMember, DeleteUser, Kick, SetRank, UpdatePresence},
11- model::{Presence, Rank, Role, User},11+ model::{Presence, Rank, User},
12 permission,12 permission,
13 };13 };
14 use gpui_kit::{14 use gpui_kit::{
@@ -237,15 +237,7 @@ impl Card {
237 .flex()237 .flex()
238 .flex_col()238 .flex_col()
239 .gap(px(space::XS))239 .gap(px(space::XS))
240- .children(main_self_rows(240+ .children(main_self_rows(self.armed, entity, &popover, palette))
241- self.viewer
242- .as_ref()
243- .is_some_and(|viewer| permission::is_builder(viewer.role)),
244- self.armed,
245- entity,
246- &popover,
247- palette,
248- ))
249 .into_any_element()241 .into_any_element()
250 } else {242 } else {
251 let mut rows = self.social_rows(entity, &popover, palette);243 let mut rows = self.social_rows(entity, &popover, palette);
@@ -281,13 +273,28 @@ impl Card {
281 None => self.presence.label().to_lowercase(),273 None => self.presence.label().to_lowercase(),
282 };274 };
283 let place = match self.target {275 let place = match self.target {
284- Some(Rank::Builder) => band(space::XXS)276+ Some(Rank::Builder) => {
285- .child(small_icon(IconName::Shield).text_color(palette.accent))277+ let badge = band(space::XXS)
286- .child(278+ .child(small_icon(IconName::Shield).text_color(palette.accent))
287- words(Rank::Builder.label(), Text::Caption, Ink::Faint, t)279+ .child(
288- .text_color(palette.accent),280+ words(Rank::Builder.label(), Text::Caption, Ink::Faint, t)
289- )281+ .text_color(palette.accent),
290- .into_any_element(),282+ );
283+ if is_self {
284+ clickable(
285+ "profile_builder",
286+ palette,
287+ yumush_action(entity, &popover, |yumush, window, cx| {
288+ yumush.show_view(View::Builder, window, cx)
289+ }),
290+ )
291+ .rounded(px(radius::SM))
292+ .child(badge)
293+ .into_any_element()
294+ } else {
295+ badge.into_any_element()
296+ }
297+ }
291 Some(rank @ (Rank::Moderator | Rank::Admin | Rank::Owner)) => {298 Some(rank @ (Rank::Moderator | Rank::Admin | Rank::Owner)) => {
292 words(rank.label(), Text::Caption, Ink::Faint, t).into_any_element()299 words(rank.label(), Text::Caption, Ink::Faint, t).into_any_element()
293 }300 }
@@ -576,7 +583,6 @@ impl Card {
576 }583 }
577 584
578 fn main_self_rows(585 fn main_self_rows(
579- builder: bool,
580 armed: Option<Armed>,586 armed: Option<Armed>,
581 entity: &Entity<Yumush>,587 entity: &Entity<Yumush>,
582 popover: &Entity<PopoverState>,588 popover: &Entity<PopoverState>,
@@ -595,21 +601,6 @@ fn main_self_rows(
595 )601 )
596 .into_any_element(),602 .into_any_element(),
597 ];603 ];
598- if builder {
599- rows.push(
600- menu_row(
601- "profile_builder",
602- Role::Builder.label(),
603- small_icon(IconName::Shield),
604- palette.text,
605- palette,
606- yumush_action(entity, popover, |yumush, window, cx| {
607- yumush.show_view(View::Builder, window, cx)
608- }),
609- )
610- .into_any_element(),
611- );
612- }
613 rows.push(604 rows.push(
614 menu_row(605 menu_row(
615 "profile_logout",606 "profile_logout",