ui: pins and topics as icon buttons with a count in the chat header
The labelled Pinned Messages and Topics buttons took about 300 px of the header, so the channel's topic was cut first. They are icon buttons now, named in their tooltip, with how many pins and topics the chat has (Bridge.pins-count and topics-count, -1 until the gateway answered). The counts are asked for when a chat comes on screen (a tab, a server, a gateway that connects, another server after a delete), not only when a drawer opens, so they show before. An answer for a chat that was closed meanwhile is dropped, instead of reopening it as a tab named Server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AVRENKftQqGoEeswiR9TDQ
This commit is contained in:
1 parent
14ea206521
commit
2e3ddc11ec
7 files changed
+63
-11
No files matched your search
@@ -901,6 +901,10 @@ export global Bridge {
|
||||
in property <bool> has-pins;
|
||||
in property <bool> has-reactions;
|
||||
in property <bool> has-topics;
|
||||
// How many pins and topics the current chat has, for the header's
|
||||
// buttons; -1 until the gateway answered.
|
||||
in property <int> pins-count: -1;
|
||||
in property <int> topics-count: -1;
|
||||
// The pins drawer.
|
||||
in property <[PinItem]> pins;
|
||||
in property <bool> pins-loading;
|
||||
|
||||
@@ -845,17 +845,20 @@ export component ChatView inherits VerticalLayout {
|
||||
tint: Theme.accent-text;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
if Bridge.has-pins: Button {
|
||||
// Icons with a count, so the channel's topic has the room.
|
||||
if Bridge.has-pins: IconButton {
|
||||
icon: Icons.pin;
|
||||
text: @tr("Pinned Messages");
|
||||
label: @tr("Pinned messages");
|
||||
checked: Nav.pins-open;
|
||||
count: Bridge.pins-count;
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { Nav.show-pins(!Nav.pins-open); }
|
||||
}
|
||||
if Bridge.has-topics: Button {
|
||||
if Bridge.has-topics: IconButton {
|
||||
icon: Icons.book-open;
|
||||
text: @tr("Topics");
|
||||
label: @tr("Topics");
|
||||
checked: Nav.topics-open;
|
||||
count: Bridge.topics-count;
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { Nav.show-topics(!Nav.topics-open); }
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user