Replace signed out silhouette with a "Sign in" label
This commit is contained in:
parent
c47855424f
commit
0d8c68ae1d
3 changed files with 38 additions and 19 deletions
|
@ -47,6 +47,8 @@ pub struct Titlebar {
|
||||||
pub offline_icon: OfflineIcon,
|
pub offline_icon: OfflineIcon,
|
||||||
pub icon_color: Color,
|
pub icon_color: Color,
|
||||||
pub avatar: ImageStyle,
|
pub avatar: ImageStyle,
|
||||||
|
pub sign_in_prompt: ContainedText,
|
||||||
|
pub hovered_sign_in_prompt: ContainedText,
|
||||||
pub outdated_warning: ContainedText,
|
pub outdated_warning: ContainedText,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -953,29 +953,19 @@ impl Workspace {
|
||||||
|
|
||||||
fn render_avatar(&self, cx: &mut RenderContext<Self>) -> ElementBox {
|
fn render_avatar(&self, cx: &mut RenderContext<Self>) -> ElementBox {
|
||||||
let theme = &self.settings.borrow().theme;
|
let theme = &self.settings.borrow().theme;
|
||||||
let avatar = if let Some(avatar) = self
|
if let Some(avatar) = self
|
||||||
.user_store
|
.user_store
|
||||||
.read(cx)
|
.read(cx)
|
||||||
.current_user()
|
.current_user()
|
||||||
.and_then(|user| user.avatar.clone())
|
.and_then(|user| user.avatar.clone())
|
||||||
{
|
{
|
||||||
Image::new(avatar)
|
|
||||||
.with_style(theme.workspace.titlebar.avatar)
|
|
||||||
.boxed()
|
|
||||||
} else {
|
|
||||||
MouseEventHandler::new::<Authenticate, _, _, _>(0, cx, |_, _| {
|
|
||||||
Svg::new("icons/signed-out-12.svg")
|
|
||||||
.with_color(theme.workspace.titlebar.icon_color)
|
|
||||||
.boxed()
|
|
||||||
})
|
|
||||||
.on_click(|cx| cx.dispatch_action(Authenticate))
|
|
||||||
.with_cursor_style(CursorStyle::PointingHand)
|
|
||||||
.boxed()
|
|
||||||
};
|
|
||||||
|
|
||||||
ConstrainedBox::new(
|
ConstrainedBox::new(
|
||||||
Align::new(
|
Align::new(
|
||||||
ConstrainedBox::new(avatar)
|
ConstrainedBox::new(
|
||||||
|
Image::new(avatar)
|
||||||
|
.with_style(theme.workspace.titlebar.avatar)
|
||||||
|
.boxed(),
|
||||||
|
)
|
||||||
.with_width(theme.workspace.titlebar.avatar_width)
|
.with_width(theme.workspace.titlebar.avatar_width)
|
||||||
.boxed(),
|
.boxed(),
|
||||||
)
|
)
|
||||||
|
@ -983,6 +973,23 @@ impl Workspace {
|
||||||
)
|
)
|
||||||
.with_width(theme.workspace.right_sidebar.width)
|
.with_width(theme.workspace.right_sidebar.width)
|
||||||
.boxed()
|
.boxed()
|
||||||
|
} else {
|
||||||
|
MouseEventHandler::new::<Authenticate, _, _, _>(0, cx, |state, _| {
|
||||||
|
let style = if state.hovered {
|
||||||
|
&theme.workspace.titlebar.hovered_sign_in_prompt
|
||||||
|
} else {
|
||||||
|
&theme.workspace.titlebar.sign_in_prompt
|
||||||
|
};
|
||||||
|
Label::new("Sign in".to_string(), style.text.clone())
|
||||||
|
.contained()
|
||||||
|
.with_style(style.container)
|
||||||
|
.boxed()
|
||||||
|
})
|
||||||
|
.on_click(|cx| cx.dispatch_action(Authenticate))
|
||||||
|
.with_cursor_style(CursorStyle::PointingHand)
|
||||||
|
.aligned()
|
||||||
|
.boxed()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,16 @@ icon_color = "$text.2.color"
|
||||||
avatar = { corner_radius = 10, border = { width = 1, color = "#00000088" } }
|
avatar = { corner_radius = 10, border = { width = 1, color = "#00000088" } }
|
||||||
outdated_warning = { extends = "$text.2", size = 13 }
|
outdated_warning = { extends = "$text.2", size = 13 }
|
||||||
|
|
||||||
|
[workspace.titlebar.sign_in_prompt]
|
||||||
|
extends = "$text.2"
|
||||||
|
size = 13
|
||||||
|
underline = true
|
||||||
|
padding = { right = 12 }
|
||||||
|
|
||||||
|
[workspace.titlebar.hovered_sign_in_prompt]
|
||||||
|
extends = "$workspace.titlebar.sign_in_prompt"
|
||||||
|
color = "$text.1.color"
|
||||||
|
|
||||||
[workspace.titlebar.offline_icon]
|
[workspace.titlebar.offline_icon]
|
||||||
padding = { right = 4 }
|
padding = { right = 4 }
|
||||||
width = 16
|
width = 16
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue