assistant2: Truncate context pill labels (#26721)
To solve a problem that mostly happens if the pill is of kind `Thread` and the corresponding thread has a super long title. <img src="https://github.com/user-attachments/assets/4ee8038d-9467-41a9-9b30-76019d0b9c0b" width="500px"/> Release Notes: - N/A
This commit is contained in:
parent
0ad5979f19
commit
2183fc674d
1 changed files with 21 additions and 14 deletions
|
@ -126,7 +126,13 @@ impl RenderOnce for ContextPill {
|
||||||
h_flex()
|
h_flex()
|
||||||
.id("context-data")
|
.id("context-data")
|
||||||
.gap_1()
|
.gap_1()
|
||||||
.child(Label::new(context.name.clone()).size(LabelSize::Small))
|
.child(
|
||||||
|
div().max_w_64().child(
|
||||||
|
Label::new(context.name.clone())
|
||||||
|
.size(LabelSize::Small)
|
||||||
|
.truncate(),
|
||||||
|
),
|
||||||
|
)
|
||||||
.when_some(context.parent.as_ref(), |element, parent_name| {
|
.when_some(context.parent.as_ref(), |element, parent_name| {
|
||||||
if *dupe_name {
|
if *dupe_name {
|
||||||
element.child(
|
element.child(
|
||||||
|
@ -174,21 +180,22 @@ impl RenderOnce for ContextPill {
|
||||||
})
|
})
|
||||||
.hover(|style| style.bg(color.element_hover.opacity(0.5)))
|
.hover(|style| style.bg(color.element_hover.opacity(0.5)))
|
||||||
.child(
|
.child(
|
||||||
|
div().px_0p5().max_w_64().child(
|
||||||
Label::new(name.clone())
|
Label::new(name.clone())
|
||||||
.size(LabelSize::Small)
|
.size(LabelSize::Small)
|
||||||
.color(Color::Muted),
|
.color(Color::Muted)
|
||||||
|
.truncate(),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
div().px_0p5().child(
|
|
||||||
Label::new(match kind {
|
Label::new(match kind {
|
||||||
ContextKind::File => "Active Tab",
|
ContextKind::File => "Active Tab",
|
||||||
ContextKind::Thread
|
ContextKind::Thread | ContextKind::Directory | ContextKind::FetchedUrl => {
|
||||||
| ContextKind::Directory
|
"Active"
|
||||||
| ContextKind::FetchedUrl => "Active",
|
}
|
||||||
})
|
})
|
||||||
.size(LabelSize::XSmall)
|
.size(LabelSize::XSmall)
|
||||||
.color(Color::Muted),
|
.color(Color::Muted),
|
||||||
),
|
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
Icon::new(IconName::Plus)
|
Icon::new(IconName::Plus)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue