Browse Source

show current unread counter on headlines toolbar if sidebar is hidden

Andrew Dolgov 7 months ago
parent
commit
9c0235ab66
10 changed files with 69 additions and 9 deletions
  1. 3 1
      classes/feeds.php
  2. 11 1
      css/default.css
  3. 0 0
      css/default.css.map
  4. 17 5
      css/tt-rss.less
  5. 4 0
      js/Feeds.js
  6. 12 0
      js/Headlines.js
  7. 11 1
      themes/night.css
  8. 0 0
      themes/night.css.map
  9. 11 1
      themes/night_blue.css
  10. 0 0
      themes/night_blue.css.map

+ 3 - 1
classes/feeds.php

@@ -51,7 +51,9 @@ class Feeds extends Handler_Protected {
 		if ($error)
 			$reply .= " <i title=\"" . htmlspecialchars($error) . "\" class='material-icons icon-error'>error</i>";
 
-		$reply .= "</span></span>";
+		$reply .= "</span>";
+		$reply .= "<span id='feed_current_unread' style='display: none'></span>";
+		$reply .= "</span>";
 
 		$reply .= "<span class=\"right\">";
 		$reply .= "<span id='selected_prompt'></span>";

+ 11 - 1
css/default.css

@@ -866,12 +866,22 @@ body.ttrss_main .dijitDialog h3:first-of-type,
 body.ttrss_main .dijitDialog h4:first-of-type {
   margin-top: 0px;
 }
-body.ttrss_main i.icon-syndicate {
+body.ttrss_main #toolbar-headlines i.icon-syndicate {
   color: #ff7c4b;
   margin-right: 8px;
   border: 1px solid #ff7c4b;
   border-radius: 4px;
 }
+body.ttrss_main #toolbar-headlines #feed_current_unread {
+  margin-left: 8px;
+  font-weight: bold;
+  text-align: center;
+  border: 1px solid #2a89bc;
+  color: white;
+  background: #2a89bc;
+  border-radius: 4px;
+  min-width: 23px;
+}
 body.ttrss_main i.icon-no-feed {
   opacity: 0.2;
 }

File diff suppressed because it is too large
+ 0 - 0
css/default.css.map


+ 17 - 5
css/tt-rss.less

@@ -1025,11 +1025,23 @@ body.ttrss_main .dijitDialog {
 }
 
 body.ttrss_main {
-	i.icon-syndicate {
-		color : @color-published;
-		margin-right : 8px;
-		border : 1px solid @color-published;
-		border-radius : 4px;
+	#toolbar-headlines {
+		i.icon-syndicate {
+			color: @color-published;
+			margin-right: 8px;
+			border: 1px solid @color-published;
+			border-radius: 4px;
+		}
+		#feed_current_unread {
+			margin-left : 8px;
+			font-weight : bold;
+			text-align : center;
+			border : 1px solid lighten(@color-accent, 5%);;
+			color : white;
+			background : lighten(@color-accent, 5%);
+			border-radius : 4px;
+			min-width : 23px;
+		}
 	}
 
 	i.icon-no-feed {

+ 4 - 0
js/Feeds.js

@@ -93,6 +93,8 @@ define(["dojo/_base/declare"], function (declare) {
 				}
 			}
 
+			Headlines.updateCurrentUnread();
+
 			this.hideOrShowFeeds(App.getInitParam("hide_read_feeds"));
 			this._counters_prev = elems;
 
@@ -119,6 +121,8 @@ define(["dojo/_base/declare"], function (declare) {
 			Element.visible("feeds-holder") ? splitter.show() : splitter.hide();
 
 			dijit.byId("main").resize();
+
+			Headlines.updateCurrentUnread();
 		},
 		cancelSearch: function() {
 			this._search_query = "";

+ 12 - 0
js/Headlines.js

@@ -546,6 +546,16 @@ define(["dojo/_base/declare"], function (declare) {
 
 			return tmp.firstChild;
 		},
+		updateCurrentUnread: function() {
+			const feed_unread = Feeds.getUnread(Feeds.getActive(), Feeds.activeIsCat());
+
+			if (feed_unread > 0 && !Element.visible("feeds-holder")) {
+				$("feed_current_unread").innerText = feed_unread;
+				Element.show("feed_current_unread");
+			} else {
+				Element.hide("feed_current_unread");
+			}
+		},
 		onLoaded: function (transport, offset, append) {
 			const reply = App.handleRpcJson(transport);
 
@@ -648,6 +658,8 @@ define(["dojo/_base/declare"], function (declare) {
 							"</span>";
 					}
 
+					Headlines.updateCurrentUnread();
+
 				} else if (headlines_count > 0 && feed_id == Feeds.getActive() && is_cat == Feeds.activeIsCat()) {
 					const c = dijit.byId("headlines-frame");
 

+ 11 - 1
themes/night.css

@@ -867,12 +867,22 @@ body.ttrss_main .dijitDialog h3:first-of-type,
 body.ttrss_main .dijitDialog h4:first-of-type {
   margin-top: 0px;
 }
-body.ttrss_main i.icon-syndicate {
+body.ttrss_main #toolbar-headlines i.icon-syndicate {
   color: #ff7c4b;
   margin-right: 8px;
   border: 1px solid #ff7c4b;
   border-radius: 4px;
 }
+body.ttrss_main #toolbar-headlines #feed_current_unread {
+  margin-left: 8px;
+  font-weight: bold;
+  text-align: center;
+  border: 1px solid #cd8b31;
+  color: white;
+  background: #cd8b31;
+  border-radius: 4px;
+  min-width: 23px;
+}
 body.ttrss_main i.icon-no-feed {
   opacity: 0.2;
 }

File diff suppressed because it is too large
+ 0 - 0
themes/night.css.map


+ 11 - 1
themes/night_blue.css

@@ -867,12 +867,22 @@ body.ttrss_main .dijitDialog h3:first-of-type,
 body.ttrss_main .dijitDialog h4:first-of-type {
   margin-top: 0px;
 }
-body.ttrss_main i.icon-syndicate {
+body.ttrss_main #toolbar-headlines i.icon-syndicate {
   color: #ff7c4b;
   margin-right: 8px;
   border: 1px solid #ff7c4b;
   border-radius: 4px;
 }
+body.ttrss_main #toolbar-headlines #feed_current_unread {
+  margin-left: 8px;
+  font-weight: bold;
+  text-align: center;
+  border: 1px solid #2a89bc;
+  color: white;
+  background: #2a89bc;
+  border-radius: 4px;
+  min-width: 23px;
+}
 body.ttrss_main i.icon-no-feed {
   opacity: 0.2;
 }

File diff suppressed because it is too large
+ 0 - 0
themes/night_blue.css.map


Some files were not shown because too many files changed in this diff