Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

left_sidebar: Place new-topic button on stream rows.

Karl Stolleyc90728d57f7f
diff --git a/web/src/click_handlers.js b/web/src/click_handlers.js
index 50dc5277cd0..f1798a2f015 100644
--- a/web/src/click_handlers.js
+++ b/web/src/click_handlers.js
@@ -603,6 +603,20 @@ export function initialize() {
});
});
+ // Left sidebar channel rows
+ $("body").on("click", ".channel-new-topic-button", (e) => {
+ e.stopPropagation();
+ const elem = e.currentTarget;
+ const stream_id = Number.parseInt(elem.dataset.streamId, 10);
+ compose_actions.start({
+ message_type: "stream",
+ stream_id,
+ topic: "",
+ trigger: "clear topic button",
+ keep_composebox_empty: true,
+ });
+ });
+
// Recent conversations direct messages (Not displayed on small widths)
$("body").on("mouseenter", ".recent_topic_stream .pm_status_icon", (e) => {
e.stopPropagation();
diff --git a/web/styles/left_sidebar.css b/web/styles/left_sidebar.css
index 5a2b066fa61..e1fa9e5adfa 100644
--- a/web/styles/left_sidebar.css
+++ b/web/styles/left_sidebar.css
@@ -123,6 +123,10 @@
}
.stream-expanded {
+ .channel-new-topic-button {
+ display: flex;
+ }
+
.stream-with-count.hide_unread_counts {
.masked_unread_count {
display: none;
@@ -1188,6 +1192,30 @@ li.top_left_scheduled_messages {
}
}
+.channel-new-topic-button {
+ /* display: flex; is set on visible channels and
+ channel-row hovers. */
+ display: none;
+ align-items: center;
+ justify-content: center;
+ color: var(--color-left-sidebar-heads-up-icon);
+ margin: 2px 0;
+ border-radius: 3px;
+
+ &:hover {
+ color: var(--color-left-sidebar-heads-up-icon-hover);
+ background-color: var(
+ --background-color-left-sidebar-heads-up-icon-hover
+ );
+ }
+}
+
+.narrow-filter:hover {
+ .channel-new-topic-button {
+ display: flex;
+ }
+}
+
.bottom_left_row .sidebar-menu-icon {
grid-area: ending-anchor-element;
}
@@ -1546,7 +1574,6 @@ li.topic-list-item {
the height of the controls grid. */
height: 100%;
-
@media (hover: none) {
display: flex;
}
diff --git a/web/templates/stream_sidebar_row.hbs b/web/templates/stream_sidebar_row.hbs
index fcfb35fc4f0..ab43886a6e6 100644
--- a/web/templates/stream_sidebar_row.hbs
+++ b/web/templates/stream_sidebar_row.hbs
@@ -10,6 +10,12 @@
<a href="{{url}}" title="{{name}}" class="stream-name">{{name}}</a>
+ <div class="left-sidebar-controls">
+ <div class="channel-new-topic-button tippy-zulip-tooltip hidden-for-spectators" data-tippy-content="{{t 'New topic'}}" data-stream-id="{{id}}">
+ <i class="channel-new-topic-icon zulip-icon zulip-icon-square-plus" aria-hidden="true"></i>
+ </div>
+ </div>
+
<div class="stream-markers-and-unreads">
<span class="unread_mention_info"></span>
<span class="unread_count"></span>