Only show arrow up right icon in resource link when it is not a file
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com> Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
This commit is contained in:
parent
f04204f724
commit
7ea2e2d471
1 changed files with 7 additions and 4 deletions
|
@ -2041,8 +2041,9 @@ impl AcpThreadView {
|
||||||
cx: &Context<Self>,
|
cx: &Context<Self>,
|
||||||
) -> AnyElement {
|
) -> AnyElement {
|
||||||
let uri: SharedString = resource_link.uri.clone().into();
|
let uri: SharedString = resource_link.uri.clone().into();
|
||||||
|
let is_file = resource_link.uri.strip_prefix("file://");
|
||||||
|
|
||||||
let label: SharedString = if let Some(path) = resource_link.uri.strip_prefix("file://") {
|
let label: SharedString = if let Some(path) = is_file {
|
||||||
path.to_string().into()
|
path.to_string().into()
|
||||||
} else {
|
} else {
|
||||||
uri.clone()
|
uri.clone()
|
||||||
|
@ -2060,10 +2061,12 @@ impl AcpThreadView {
|
||||||
Button::new(button_id, label)
|
Button::new(button_id, label)
|
||||||
.label_size(LabelSize::Small)
|
.label_size(LabelSize::Small)
|
||||||
.color(Color::Muted)
|
.color(Color::Muted)
|
||||||
.icon(IconName::ArrowUpRight)
|
|
||||||
.icon_size(IconSize::XSmall)
|
|
||||||
.icon_color(Color::Muted)
|
|
||||||
.truncate(true)
|
.truncate(true)
|
||||||
|
.when(!is_file.is_some(), |this| {
|
||||||
|
this.icon(IconName::ArrowUpRight)
|
||||||
|
.icon_size(IconSize::XSmall)
|
||||||
|
.icon_color(Color::Muted)
|
||||||
|
})
|
||||||
.on_click(cx.listener({
|
.on_click(cx.listener({
|
||||||
let workspace = self.workspace.clone();
|
let workspace = self.workspace.clone();
|
||||||
move |_, _, window, cx: &mut Context<Self>| {
|
move |_, _, window, cx: &mut Context<Self>| {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue