left_sidebar: Prepare home views with selection logic, unread counts.

This commit is contained in:
Karl Stolley 2023-11-02 14:05:21 -05:00 committed by Tim Abbott
parent 00d00036fe
commit 4759fc9f69
2 changed files with 18 additions and 12 deletions

View File

@ -138,6 +138,8 @@ export function initialize_left_sidebar() {
const rendered_sidebar = render_left_sidebar({
is_guest: page_params.is_guest,
development_environment: page_params.development_environment,
is_inbox_home_view:
user_settings.web_home_view === settings_config.web_home_view_values.inbox.code,
is_all_messages_home_view:
user_settings.web_home_view === settings_config.web_home_view_values.all_messages.code,
is_recent_view_home_view:

View File

@ -5,26 +5,28 @@
{{~!-- squash whitespace --~}}
<h4 class="sidebar-title">{{t 'VIEWS' }}</h4>
<ul id="left-sidebar-navigation-list-condensed" class="filters">
<li class="top_left_inbox left-sidebar-navigation-condensed-item">
<a href="#inbox" class="tippy-views-tooltip left-sidebar-navigation-icon-container" data-tooltip-template-id="inbox-tooltip-template">
<li class="top_left_inbox left-sidebar-navigation-condensed-item {{#if is_inbox_home_view}}selected-home-view{{/if}}">
<a href="#inbox" {{#if is_inbox_home_view}}tabindex="0"{{/if}} class="tippy-views-tooltip left-sidebar-navigation-icon-container" data-tooltip-template-id="inbox-tooltip-template">
<span class="filter-icon">
<i class="zulip-icon zulip-icon-inbox" aria-hidden="true"></i>
</span>
<span class="unread_count"></span>
</a>
</li>
<li class="top_left_recent_view left-sidebar-navigation-condensed-item">
<a href="#recent" class="tippy-views-tooltip left-sidebar-navigation-icon-container" data-tooltip-template-id="recent-conversations-tooltip-template">
<li class="top_left_recent_view left-sidebar-navigation-condensed-item {{#if is_recent_view_home_view}}selected-home-view{{/if}}">
<a href="#recent" {{#if is_recent_view_home_view}}tabindex="0"{{/if}} class="tippy-views-tooltip left-sidebar-navigation-icon-container" data-tooltip-template-id="recent-conversations-tooltip-template">
<span class="filter-icon">
<i class="zulip-icon zulip-icon-clock" aria-hidden="true"></i>
</span>
<span class="unread_count"></span>
</a>
</li>
<li class="top_left_all_messages left-sidebar-navigation-condensed-item">
<a href="#all_messages" class="home-link tippy-views-tooltip left-sidebar-navigation-icon-container" data-tooltip-template-id="all-message-tooltip-template">
<li class="top_left_all_messages left-sidebar-navigation-condensed-item {{#if is_all_messages_home_view}}selected-home-view{{/if}}">
<a href="#all_messages" {{#if is_all_messages_home_view}}tabindex="0"{{/if}} class="home-link tippy-views-tooltip left-sidebar-navigation-icon-container" data-tooltip-template-id="all-message-tooltip-template">
<span class="filter-icon">
<i class="zulip-icon zulip-icon-all-messages" aria-hidden="true"></i>
</span>
<span class="unread_count"></span>
</a>
</li>
<li class="top_left_mentions left-sidebar-navigation-condensed-item">
@ -49,8 +51,8 @@
</div>
</div>
<ul id="left-sidebar-navigation-list" class="left-sidebar-navigation-list filters">
<li class="tippy-views-tooltip top_left_inbox top_left_row hidden-for-spectators" data-tooltip-template-id="inbox-tooltip-template">
<a href="#inbox" class="left-sidebar-navigation-label-container">
<li class="tippy-views-tooltip top_left_inbox top_left_row hidden-for-spectators {{#if is_inbox_home_view}}selected-home-view{{/if}}" data-tooltip-template-id="inbox-tooltip-template">
<a href="#inbox" {{#if is_inbox_home_view}}tabindex="0"{{/if}} class="left-sidebar-navigation-label-container">
<span class="filter-icon">
<i class="zulip-icon zulip-icon-inbox" aria-hidden="true"></i>
</span>
@ -60,25 +62,27 @@
</a>
<span class="arrow sidebar-menu-icon inbox-sidebar-menu-icon hidden-for-spectators"><i class="zulip-icon zulip-icon-more-vertical" aria-hidden="true"></i></span>
</li>
<li class="tippy-views-tooltip top_left_recent_view top_left_row" data-tooltip-template-id="recent-conversations-tooltip-template">
<a href="#recent" class="left-sidebar-navigation-label-container">
<li class="tippy-views-tooltip top_left_recent_view top_left_row {{#if is_recent_view_home_view}}selected-home-view{{/if}}" data-tooltip-template-id="recent-conversations-tooltip-template">
<a href="#recent" {{#if is_recent_view_home_view}}tabindex="0"{{/if}} class="left-sidebar-navigation-label-container">
<span class="filter-icon">
<i class="zulip-icon zulip-icon-clock" aria-hidden="true"></i>
</span>
{{~!-- squash whitespace --~}}
<span class="left-sidebar-navigation-label">{{t 'Recent conversations' }}</span>
<span class="unread_count"></span>
</a>
<span class="arrow sidebar-menu-icon recent-view-sidebar-menu-icon hidden-for-spectators {{#if is_recent_view_home_view}}hide{{/if}}">
<i class="zulip-icon zulip-icon-more-vertical" aria-hidden="true"></i>
</span>
</li>
<li class="tippy-views-tooltip top_left_all_messages top_left_row" data-tooltip-template-id="all-message-tooltip-template">
<a href="#all_messages" class="home-link left-sidebar-navigation-label-container">
<li class="tippy-views-tooltip top_left_all_messages top_left_row {{#if is_all_messages_home_view}}selected-home-view{{/if}}" data-tooltip-template-id="all-message-tooltip-template">
<a href="#all_messages" {{#if is_all_messages_home_view}}tabindex="0"{{/if}} class="home-link left-sidebar-navigation-label-container">
<span class="filter-icon">
<i class="zulip-icon zulip-icon-all-messages" aria-hidden="true"></i>
</span>
{{~!-- squash whitespace --~}}
<span class="left-sidebar-navigation-label">{{t 'All messages' }}</span>
<span class="unread_count"></span>
</a>
<span class="arrow sidebar-menu-icon all-messages-sidebar-menu-icon hidden-for-spectators {{#if is_all_messages_home_view}}hide{{/if}}">
<i class="zulip-icon zulip-icon-more-vertical" aria-hidden="true"></i>