mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	Enable a consecutive topic typeahead after a user selects a stream via the typeahead menu. Previously, users had to manually enter ">" after selecting a stream. Before, encountering ">" returned "topic_jump," which prevented the topic list from triggering since "topic_jump" indicated the topic was selected. The implementation is changed to slice the token and process it in get_candidates to trigger the appropriate typeahead. Adjustments include changes to regexes for accurate triggering of stream or topic typeaheads based on the presence of ">" in the current token. Removes hint for stream mentioning use of ">" for topic suggestions, although that feature is still functional. The hideAfterSelect() function in composebox_typeahead.ts was modified. This prevents closing the typeahead when a stream is completed. The TopicSuggestion type is updated to show stream typeahead suggestion as the first option in the topic list with a privacy icon and no description in case when no character follows the '>' i.e. when the token ends with '>'. The edge where stream and topic have the same name is also handled with the help of a flag. Add stream as the prefix to topic suggestions in the typeahead. To make this happen, changes are made in the related handlebars template. Update topic list stream option label. This changes the option label for stream in the topic list from (mention channel) to (link to channel) as per https://zulip.com/help/link-to-a-message-or-conversation. Tests are updated, and a new test is added to validate the behavior. Test coverage is added for the new `render_stream_topic` method. Fixes: #32184.
		
			
				
	
	
		
			201 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			CSS
		
	
	
	
	
	
			
		
		
	
	
			201 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			CSS
		
	
	
	
	
	
/* CSS for Bootstrap typeahead */
 | 
						|
 | 
						|
.dropdown-menu {
 | 
						|
    display: none;
 | 
						|
    min-width: 160px;
 | 
						|
    list-style: none;
 | 
						|
}
 | 
						|
 | 
						|
.open > .dropdown-menu {
 | 
						|
    display: block;
 | 
						|
}
 | 
						|
 | 
						|
.typeahead {
 | 
						|
    z-index: 1051;
 | 
						|
}
 | 
						|
 | 
						|
.typeahead.dropdown-menu .typeahead-menu .simplebar-content {
 | 
						|
    min-width: max-content;
 | 
						|
 | 
						|
    & > li {
 | 
						|
        overflow-wrap: anywhere;
 | 
						|
 | 
						|
        & > a {
 | 
						|
            display: flex;
 | 
						|
            padding: 3px 10px;
 | 
						|
            gap: 5px;
 | 
						|
            font-weight: normal;
 | 
						|
            /* We want to keep this `max-width` less than 320px. */
 | 
						|
            max-width: 292px;
 | 
						|
            line-height: 1.43; /* 20px / 14px */
 | 
						|
            color: var(--color-dropdown-item);
 | 
						|
            white-space: nowrap;
 | 
						|
 | 
						|
            @media (width >= $ml_min) {
 | 
						|
                /* Scale up with font size on larger widths. */
 | 
						|
                /* 292px / 14px */
 | 
						|
                max-width: 20.86em;
 | 
						|
            }
 | 
						|
 | 
						|
            /* hidden text just to maintain line height for a blank option */
 | 
						|
            strong:empty {
 | 
						|
                &::after {
 | 
						|
                    content: ".";
 | 
						|
                    visibility: hidden;
 | 
						|
                }
 | 
						|
            }
 | 
						|
 | 
						|
            &:hover,
 | 
						|
            &:focus {
 | 
						|
                text-decoration: none;
 | 
						|
                outline: 0;
 | 
						|
            }
 | 
						|
 | 
						|
            .user-circle {
 | 
						|
                /* 11px at 16px/1em */
 | 
						|
                font-size: 0.6875em;
 | 
						|
                align-self: center;
 | 
						|
                /* TODO: A grid rewrite of typeahead rows
 | 
						|
                   should help to obviate these kinds of
 | 
						|
                   fiddly spacing hacks. */
 | 
						|
                margin-right: 2px;
 | 
						|
                margin-left: -2px;
 | 
						|
            }
 | 
						|
 | 
						|
            &.topic-typeahead-link {
 | 
						|
                gap: 0;
 | 
						|
            }
 | 
						|
 | 
						|
            .typeahead-text-container {
 | 
						|
                display: flex;
 | 
						|
                align-self: center;
 | 
						|
                overflow: hidden;
 | 
						|
                text-overflow: ellipsis;
 | 
						|
                white-space: nowrap;
 | 
						|
                gap: 3px;
 | 
						|
            }
 | 
						|
 | 
						|
            .compose-stream-name {
 | 
						|
                overflow: visible;
 | 
						|
                gap: 0;
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        .stream-to-topic-arrow {
 | 
						|
            cursor: default;
 | 
						|
            color: var(--color-compose-chevron-arrow);
 | 
						|
            text-decoration: none;
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
    .active > a {
 | 
						|
        &,
 | 
						|
        &:hover,
 | 
						|
        &:focus {
 | 
						|
            color: var(--color-active-dropdown-item);
 | 
						|
            background-color: var(--background-color-active-typeahead-item);
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
    .pronouns,
 | 
						|
    .autocomplete_secondary {
 | 
						|
        align-self: end;
 | 
						|
        opacity: 0.8;
 | 
						|
        font-size: 85%;
 | 
						|
        overflow: hidden;
 | 
						|
        text-overflow: ellipsis;
 | 
						|
        position: relative;
 | 
						|
        top: -1px;
 | 
						|
 | 
						|
        & > a {
 | 
						|
            color: var(--color-dropdown-item);
 | 
						|
            text-decoration: underline 1px;
 | 
						|
            text-decoration-color: var(--color-dropdown-item-link-underline);
 | 
						|
            opacity: 0.6;
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
    .autocomplete_secondary {
 | 
						|
        flex: 1 1 0;
 | 
						|
    }
 | 
						|
 | 
						|
    .active .pronouns,
 | 
						|
    .active .autocomplete_secondary {
 | 
						|
        opacity: 1;
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
.typeahead.dropdown-menu {
 | 
						|
    .typeahead-menu {
 | 
						|
        list-style: none;
 | 
						|
        margin: 4px 0;
 | 
						|
        max-height: min(248px, 95vh);
 | 
						|
        overflow-y: auto;
 | 
						|
    }
 | 
						|
 | 
						|
    .typeahead-header {
 | 
						|
        margin: 0;
 | 
						|
        padding: 4px 10px;
 | 
						|
        border-top: 1px solid hsl(0deg 0% 0% / 20%);
 | 
						|
        display: flex;
 | 
						|
        align-items: center;
 | 
						|
    }
 | 
						|
 | 
						|
    #typeahead-header-text {
 | 
						|
        color: var(--color-dropdown-item);
 | 
						|
        font-size: 12px;
 | 
						|
    }
 | 
						|
 | 
						|
    a strong.typeahead-strong-section {
 | 
						|
        white-space: pre;
 | 
						|
        /* Present as flexbox to better control
 | 
						|
           icon alignment and spacing, when icons
 | 
						|
           are shown. */
 | 
						|
        display: flex;
 | 
						|
        align-items: baseline;
 | 
						|
        /* Approximate space as preserved in
 | 
						|
           typeahead lines, e.g., between the channel
 | 
						|
           name and its description. */
 | 
						|
        gap: 0.25ch;
 | 
						|
        font-weight: 500;
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
.typeahead-option-label-container {
 | 
						|
    display: flex !important;
 | 
						|
    justify-content: space-between;
 | 
						|
 | 
						|
    > strong {
 | 
						|
        margin-right: 14px;
 | 
						|
    }
 | 
						|
 | 
						|
    .typeahead-option-label {
 | 
						|
        color: var(--color-typeahead-option-label);
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
.typeahead-image {
 | 
						|
    display: inline-block;
 | 
						|
    height: 21px;
 | 
						|
    width: 21px;
 | 
						|
    border-radius: 4px;
 | 
						|
 | 
						|
    /* For FontAwesome icons and zulip icons used in place of images for some users. */
 | 
						|
    font-size: 19px;
 | 
						|
    text-align: center;
 | 
						|
 | 
						|
    &.zulip-icon-triple-users {
 | 
						|
        font-size: 19px;
 | 
						|
    }
 | 
						|
 | 
						|
    &.no-presence-circle {
 | 
						|
        margin-left: 14px;
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
.typeahead-text-container {
 | 
						|
    i.zulip-icon-bot {
 | 
						|
        align-self: center;
 | 
						|
    }
 | 
						|
}
 |