Skip to content

A platform for community discussion. Free, open, simple.

UX: refresh styles for full page search, AI results (#37905)

Krisccef68f6ce86
diff --git a/app/assets/stylesheets/common/base/search.scss b/app/assets/stylesheets/common/base/search.scss
index 8fa36b35bb2..5a73aff32cb 100644
--- a/app/assets/stylesheets/common/base/search.scss
+++ b/app/assets/stylesheets/common/base/search.scss
@@ -19,6 +19,12 @@
.search-container {
background: var(--d-content-background);
+ &:has(.advanced-filters.--is-expanded) {
+ .search-info {
+ border-top: none;
+ }
+ }
+
@include viewport.from(sm) {
.search-cta {
flex: 1 1 0;
@@ -26,10 +32,8 @@
}
.search-header {
- background: var(--primary-very-low);
- border-radius: var(--d-border-radius);
-
@include search-page-spacing;
+ padding-bottom: 0;
}
.warning {
@@ -56,7 +60,6 @@
display: flex;
justify-content: space-between;
align-items: stretch;
- background: var(--primary-very-low);
gap: 0.5em 1em;
@include viewport.from(sm) {
@@ -88,6 +91,10 @@
.search-advanced {
position: relative;
+ .fps-result-entries {
+ padding-top: var(--space-4);
+ }
+
.search-actions,
.search-title,
.search-bar {
@@ -96,6 +103,7 @@
.search-results {
@include search-page-spacing;
+ padding-top: 0;
@include viewport.until(md) {
padding: 1rem 0.5rem 1rem 0.25rem;
@@ -105,11 +113,14 @@
.search-info {
display: flex;
flex-wrap: wrap;
- padding: 1em 10%;
- border-bottom: 1px solid var(--content-border-color);
+ margin: 0 10%;
+ padding-block: var(--space-4);
+ background: var(--secondary); // needs background for bulk select sticky
+ border-top: 1px solid var(--content-border-color);
@include viewport.until(lg) {
- padding: 0.5em 0;
+ padding: 1rem 1rem 0 1rem;
+ margin: 0;
}
&.bulk-select-visible {
@@ -182,43 +193,25 @@
}
.search-filters {
- background: var(--primary-very-low);
- display: flex;
- flex-direction: column;
+ padding-top: var(--space-4);
- details.advanced-filters,
- details.search-advanced-additional-options {
- > summary {
- margin-top: 1em;
- color: var(--tertiary);
- cursor: pointer;
- padding-top: 0.25em;
- padding-bottom: 0.25em;
-
- &:focus-visible {
- outline: 2px solid transparent;
- background-color: var(--tertiary-very-low);
- }
- }
-
- &[open] > summary {
- color: var(--primary);
- margin-bottom: 1em;
+ .advanced-filters:not(.--is-expanded) {
+ padding-bottom: var(--space-4);
+ }
- &:focus-visible {
- background-color: var(--tertiary-very-low);
- }
- }
+ .advanced-filters__toggle {
+ gap: var(--space-1);
- .control-label {
- font-weight: bold;
- color: var(--primary-high);
+ .badge-notification {
+ background: var(--tertiary);
+ top: 0;
}
- }
- details.search-advanced-additional-options {
- > summary {
- font-size: var(--font-down-1);
+ &:hover {
+ .badge-notification {
+ background: var(--secondary);
+ color: var(--primary-high);
+ }
}
}
@@ -227,10 +220,20 @@
.multi-select {
width: 100%;
min-width: 100%;
+
+ .d-date-input,
+ input[type="number"],
+ .select-kit {
+ margin-bottom: 0;
+ }
}
.search-advanced-filters {
- background: var(--primary-very-low);
+ margin-top: var(--space-4);
+ border: 1px solid var(--content-border-color);
+ padding: var(--space-6);
+ border-radius: var(--d-border-radius);
+ min-width: 0;
.second-search-button {
display: flex;
@@ -271,8 +274,14 @@
}
.count-group {
+ .controls {
+ display: flex;
+ align-items: center;
+ }
+
input[type="number"] {
- width: 8em;
+ flex: 1 1 auto;
+ min-width: 0;
}
.d-icon {
@@ -286,7 +295,6 @@
.fps-invalid {
margin-top: 1em;
- margin-bottom: 1em;
}
.search-category {
@@ -330,7 +338,7 @@
.bulk-select {
position: absolute;
- left: 0.75em;
+ left: var(--space-1);
top: 0.75em;
padding: 0.25em 0.5em;
@@ -479,3 +487,11 @@
}
}
}
+
+@include viewport.from(lg) {
+ .search-page {
+ .powered-by-discourse {
+ margin: 0 10% 0 calc(10% - var(--space-2));
+ }
+ }
+}
diff --git a/app/assets/stylesheets/wcag.scss b/app/assets/stylesheets/wcag.scss
index d90c8e31d9f..ae00d8a8022 100644
--- a/app/assets/stylesheets/wcag.scss
+++ b/app/assets/stylesheets/wcag.scss
@@ -310,14 +310,6 @@ html {
color: var(--primary-medium);
}
- // Search
- .search-container
- .search-filters
- details.search-advanced-additional-options
- > summary {
- color: var(--highlight-high);
- }
-
.chat-notices__notice,
.chat-notices .chat-retention-reminder {
background-color: var(--tertiary-very-low);
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index f4bb8058430..be10e01d7e1 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -3544,8 +3544,6 @@ en:
max_views:
placeholder: maximum
aria_label: filter by maximum views
- additional_options:
- label: "Filter by post count and topic views"
hamburger_menu: "Navigation menu"
new_item: "new"
diff --git a/frontend/discourse/app/components/bulk-select-topics-dropdown.gjs b/frontend/discourse/app/components/bulk-select-topics-dropdown.gjs
index f4e1c65013f..ea25152bcce 100644
--- a/frontend/discourse/app/components/bulk-select-topics-dropdown.gjs
+++ b/frontend/discourse/app/components/bulk-select-topics-dropdown.gjs
@@ -317,6 +317,7 @@ export default class BulkSelectTopicsDropdown extends Component {
@autofocus={{true}}
@identifier="bulk-select-topics-dropdown"
@onRegisterApi={{this.onRegisterApi}}
+ @class="btn-default"
>
<:trigger>
<span class="d-button-label">
diff --git a/frontend/discourse/app/components/search-advanced-options.gjs b/frontend/discourse/app/components/search-advanced-options.gjs
index a8a7543908d..d56b058b9bd 100644
--- a/frontend/discourse/app/components/search-advanced-options.gjs
+++ b/frontend/discourse/app/components/search-advanced-options.gjs
@@ -1,12 +1,15 @@
/* eslint-disable ember/no-classic-components */
+import { tracked } from "@glimmer/tracking";
import Component, { Input } from "@ember/component";
import { hash } from "@ember/helper";
import { on } from "@ember/modifier";
-import { action } from "@ember/object";
+import { action, computed } from "@ember/object";
+import { service } from "@ember/service";
import { tagName } from "@ember-decorators/component";
import DButton from "discourse/components/d-button";
import DateInput from "discourse/components/date-input";
import PluginOutlet from "discourse/components/plugin-outlet";
+import concatClass from "discourse/helpers/concat-class";
import icon from "discourse/helpers/d-icon";
import lazyHash from "discourse/helpers/lazy-hash";
import withEventValue from "discourse/helpers/with-event-value";
@@ -117,11 +120,23 @@ export function addAdvancedSearchOptions(options) {
@tagName("")
export default class SearchAdvancedOptions extends Component {
+ @service appEvents;
+
+ @tracked isExpanded = false;
+ @tracked submittedFilterCount = 0;
category = null;
init() {
super.init(...arguments);
+ this.isExpanded = this.expandFilters || false;
+ this._lastExpandFilters = this.expandFilters;
+ this.appEvents.on(
+ "full-page-search:collapse-filters",
+ this,
+ this._collapseFilters
+ );
+
this.setProperties({
searchedTerms: {
username: null,
@@ -150,9 +165,28 @@ export default class SearchAdvancedOptions extends Component {
});
}
+ willDestroy() {
+ super.willDestroy(...arguments);
+ this.appEvents.off(
+ "full-page-search:collapse-filters",
+ this,
+ this._collapseFilters
+ );
+ }
+
+ @action
+ _collapseFilters() {
+ this.isExpanded = false;
+ }
+
didReceiveAttrs() {
super.didReceiveAttrs(...arguments);
+ if (this.expandFilters !== this._lastExpandFilters) {
+ this._lastExpandFilters = this.expandFilters;
+ this.isExpanded = this.expandFilters || false;
+ }
+
this.setSearchedTermValue("searchedTerms.username", REGEXP_USERNAME_PREFIX);
this.setSearchedTermValueForCategory();
this.setSearchedTermValueForTags();
@@ -192,6 +226,13 @@ export default class SearchAdvancedOptions extends Component {
"searchedTerms.max_views",
REGEXP_MAX_VIEWS_PREFIX
);
+
+ if (this.model !== this._lastModel) {
+ this._lastModel = this.model;
+ this.submittedFilterCount = this.activeFilterCount;
+ } else if (this.activeFilterCount < this.submittedFilterCount) {
+ this.submittedFilterCount = this.activeFilterCount;
+ }
}
setSearchedTermValueForIn() {
@@ -728,239 +769,304 @@ export default class SearchAdvancedOptions extends Component {
this.onChangeSearchTerm(searchTerm.trim());
}
+ @computed(
+ "searchedTerms.username",
+ "searchedTerms.category.id",
+ "searchedTerms.tags.[]",
+ "searchedTerms.in.[]",
+ "searchedTerms.special.all_tags",
+ "searchedTerms.status",
+ "searchedTerms.min_posts",
+ "searchedTerms.max_posts",
+ "searchedTerms.min_views",
+ "searchedTerms.max_views",
+ "searchedTerms.time.days"
+ )
+ get activeFilterCount() {
+ const t = this.searchedTerms;
+ if (!t) {
+ return 0;
+ }
+ return [
+ t.username,
+ t.category?.id,
+ t.tags?.length,
+ t.in?.length,
+ t.special?.all_tags,
+ t.status,
+ t.min_posts,
+ t.max_posts,
+ t.min_views,
+ t.max_views,
+ t.time?.days,
+ ].filter(Boolean).length;
+ }
+
+ @action
+ toggleFilters() {
+ this.isExpanded = !this.isExpanded;
+ }
+
<template>
- {{! template-lint-disable no-nested-interactive }}
- <details open={{this.expandFilters}} class="advanced-filters" ...attributes>
- <summary>
+ <div
+ class={{concatClass
+ "advanced-filters"
+ (if this.isExpanded "--is-expanded")
+ }}
+ ...attributes
+ >
+ <DButton
+ class="advanced-filters__toggle btn-default"
+ @ariaLabel={{i18n "search.advanced.title"}}
+ @ariaExpanded={{this.isExpanded}}
+ @action={{this.toggleFilters}}
+ >
+ {{#if this.submittedFilterCount}}
+ <span class="badge-notification">{{this.submittedFilterCount}}</span>
+ {{/if}}
{{i18n "search.advanced.title"}}
- </summary>
- <div class="search-advanced-filters">
- <div class="search-advanced-options">
- <PluginOutlet
- @name="advanced-search-options-above"
- @connectorTagName="div"
- @outletArgs={{lazyHash
- searchedTerms=this.searchedTerms
- onChangeSearchedTermField=this.onChangeSearchedTermField
- }}
- />
-
- <div class="control-group advanced-search-category">
- <label class="control-label">{{i18n
- "search.advanced.in_category.label"
- }}</label>
- <div class="controls">
- <SearchAdvancedCategoryChooser
- @id="search-in-category"
- @value={{this.searchedTerms.category.id}}
- @onChange={{this.onChangeSearchTermForCategory}}
- />
+ {{icon (if this.isExpanded "chevron-up" "chevron-down")}}
+ </DButton>
+ <PluginOutlet
+ @name="full-page-search-advanced-header"
+ @outletArgs={{lazyHash
+ sortOrder=@sortOrder
+ type=@searchType
+ addSearchResults=@addSearchResults
+ model=@model
+ searchTerm=@searchTerm
+ }}
+ />
+ {{#if this.isExpanded}}
+ <div class="search-advanced-filters">
+ <div class="search-advanced-options">
+ <PluginOutlet
+ @name="advanced-search-options-above"
+ @connectorTagName="div"
+ @outletArgs={{lazyHash
+ searchedTerms=this.searchedTerms
+ onChangeSearchedTermField=this.onChangeSearchedTermField
+ }}
+ />
+
+ <div class="control-group advanced-search-category">
+ <label class="control-label">
+ {{i18n "search.advanced.in_category.label"}}
+ </label>
+ <div class="controls">
+ <SearchAdvancedCategoryChooser
+ @id="search-in-category"
+ @value={{this.searchedTerms.category.id}}
+ @onChange={{this.onChangeSearchTermForCategory}}
+ />
+ </div>
</div>
- </div>
- {{#if this.siteSettings.tagging_enabled}}
- <div class="control-group advanced-search-tags">
- <label class="control-label">{{i18n
- "search.advanced.with_tags.label"
- }}</label>
+ {{#if this.siteSettings.tagging_enabled}}
+ <div class="control-group advanced-search-tags">
+ <label class="control-label">
+ {{i18n "search.advanced.with_tags.label"}}
+ </label>
+ <div class="controls">
+ <TagChooser
+ @id="search-with-tags"
+ @tags={{this.searchedTerms.tags}}
+ @everyTag={{true}}
+ @unlimitedTagCount={{true}}
+ @onChange={{this.onChangeSearchTermForTags}}
+ @options={{hash
+ allowAny=false
+ headerAriaLabel=(i18n
+ "search.advanced.with_tags.aria_label"
+ )
+ }}
+ />
+ {{#if this.showAllTagsCheckbox}}
+ <section class="field">
+ <label>
+ <Input
+ @type="checkbox"
+ class="all-tags"
+ @checked={{this.searchedTerms.special.all_tags}}
+ {{on "click" this.onChangeSearchTermForAllTags}}
+ />
+ {{i18n "search.advanced.filters.all_tags"}}
+ </label>
+ </section>
+ {{/if}}
+ </div>
+ </div>
+ {{/if}}
+
+ <div class="control-group advanced-search-topics-posts">
+ <label class="control-label">
+ {{i18n "search.advanced.filters.label"}}
+ </label>
<div class="controls">
- <TagChooser
- @id="search-with-tags"
- @tags={{this.searchedTerms.tags}}
- @everyTag={{true}}
- @unlimitedTagCount={{true}}
- @onChange={{this.onChangeSearchTermForTags}}
+ <MultiSelect
+ @id="search-in-options"
+ @valueProperty="value"
+ @content={{this.inOptions}}
+ @value={{this.searchedTerms.in}}
+ @onChange={{this.onChangeSearchTermForIn}}
@options={{hash
- allowAny=false
- headerAriaLabel=(i18n
- "search.advanced.with_tags.aria_label"
- )
+ headerAriaLabel=(i18n "search.advanced.filters.label")
}}
/>
- {{#if this.showAllTagsCheckbox}}
- <section class="field">
- <label>
- <Input
- @type="checkbox"
- class="all-tags"
- @checked={{this.searchedTerms.special.all_tags}}
- {{on "click" this.onChangeSearchTermForAllTags}}
- />
- {{i18n "search.advanced.filters.all_tags"}}
- </label>
- </section>
- {{/if}}
</div>
</div>
- {{/if}}
- <div class="control-group advanced-search-topics-posts">
- <label class="control-label">{{i18n
- "search.advanced.filters.label"
- }}</label>
- <div class="controls">
- <MultiSelect
- @id="search-in-options"
- @valueProperty="value"
- @content={{this.inOptions}}
- @value={{this.searchedTerms.in}}
- @onChange={{this.onChangeSearchTermForIn}}
- @options={{hash
- headerAriaLabel=(i18n "search.advanced.filters.label")
- }}
- />
+ <div class="control-group advanced-search-topic-status">
+ <label class="control-label">
+ {{i18n "search.advanced.statuses.label"}}
+ </label>
+ <div class="controls">
+ <ComboBox
+ @id="search-status-options"
+ @valueProperty="value"
+ @content={{this.statusOptions}}
+ @value={{this.searchedTerms.status}}
+ @onChange={{this.onChangeSearchTermForStatus}}
+ @options={{hash
+ none="user.locale.any"
+ headerAriaLabel=(i18n "search.advanced.statuses.label")
+ clearable=true
+ }}
+ />
+ </div>
</div>
- </div>
- <div class="control-group advanced-search-topic-status">
- <label class="control-label">{{i18n
- "search.advanced.statuses.label"
- }}</label>
- <div class="controls">
- <ComboBox
- @id="search-status-options"
- @valueProperty="value"
- @content={{this.statusOptions}}
- @value={{this.searchedTerms.status}}
- @onChange={{this.onChangeSearchTermForStatus}}
- @options={{hash
- none="user.locale.any"
- headerAriaLabel=(i18n "search.advanced.statuses.label")
- clearable=true
- }}
- />
+ <div class="control-group advanced-search-posted-by">
+ <label class="control-label">
+ {{i18n "search.advanced.posted_by.label"}}
+ </label>
+ <div class="controls">
+ <UserChooser
+ @id="search-posted-by"
+ @value={{this.searchedTerms.username}}
+ @onChange={{this.onChangeSearchTermForUsername}}
+ @options={{hash
+ headerAriaLabel=(i18n
+ "search.advanced.posted_by.aria_label"
+ )
+ maximum=1
+ excludeCurrentUser=false
+ }}
+ />
+ </div>
</div>
- </div>
- <div class="control-group advanced-search-posted-by">
- <label class="control-label">
- {{i18n "search.advanced.posted_by.label"}}
- </label>
- <div class="controls">
- <UserChooser
- @id="search-posted-by"
- @value={{this.searchedTerms.username}}
- @onChange={{this.onChangeSearchTermForUsername}}
- @options={{hash
- headerAriaLabel=(i18n "search.advanced.posted_by.aria_label")
- maximum=1
- excludeCurrentUser=false
- }}
- />
+ <div class="control-group advanced-search-posted-date">
+ <label class="control-label">{{i18n
+ "search.advanced.post.time.label"
+ }}</label>
+ <div class="controls inline-form">
+ <ComboBox
+ @id="postTime"
+ @valueProperty="value"
+ @content={{this.postTimeOptions}}
+ @value={{this.searchedTerms.time.when}}
+ @onChange={{this.onChangeWhenTime}}
+ />
+ <DateInput
+ @date={{this.searchedTerms.time.days}}
+ @onChange={{this.onChangeWhenDate}}
+ @inputId="search-post-date"
+ aria-label={{i18n "search.advanced.post.time.aria_label"}}
+ />
+ </div>
</div>
- </div>
- <div class="control-group advanced-search-posted-date">
- <label class="control-label">{{i18n
- "search.advanced.post.time.label"
- }}</label>
- <div class="controls inline-form">
- <ComboBox
- @id="postTime"
- @valueProperty="value"
- @content={{this.postTimeOptions}}
- @value={{this.searchedTerms.time.when}}
- @onChange={{this.onChangeWhenTime}}
- />
- <DateInput
- @date={{this.searchedTerms.time.days}}
- @onChange={{this.onChangeWhenDate}}
- @inputId="search-post-date"
- aria-label={{i18n "search.advanced.post.time.aria_label"}}
- />
+ <div class="count-group control-group">
+ <label class="control-label">
+ {{i18n "search.advanced.post.count.label"}}
+ </label>
+ <div class="controls">
+ <Input
+ @type="number"
+ @value={{readonly this.searchedTerms.min_posts}}
+ class="input-small"
+ id="search-min-post-count"
+ placeholder={{i18n "search.advanced.post.min.placeholder"}}
+ aria-label={{i18n "search.advanced.post.min.aria_label"}}
+ {{on
+ "input"
+ (withEventValue this.onChangeSearchTermMinPostCount)
+ }}
+ />
+ {{icon "left-right"}}
+ <Input
+ @type="number"
+ @value={{readonly this.searchedTerms.max_posts}}
+ class="input-small"
+ id="search-max-post-count"
+ placeholder={{i18n "search.advanced.post.max.placeholder"}}
+ aria-label={{i18n "search.advanced.post.max.aria_label"}}
+ {{on
+ "input"
+ (withEventValue this.onChangeSearchTermMaxPostCount)
+ }}
+ />
+ </div>
</div>
- </div>
-
- <PluginOutlet
- @name="advanced-search-options-below"
- @connectorTagName="div"
- @outletArgs={{lazyHash
- searchedTerms=this.searchedTerms
- onChangeSearchedTermField=this.onChangeSearchedTermField
- }}
- />
- </div>
- <details class="search-advanced-additional-options">
- <summary>
- {{i18n "search.advanced.additional_options.label"}}
- </summary>
- <div class="count-group control-group">
- {{! TODO: Using a label here fails no-nested-interactive lint rule }}
- <span class="control-label">{{i18n
- "search.advanced.post.count.label"
- }}</span>
- <div class="controls">
- <Input
- @type="number"
- @value={{readonly this.searchedTerms.min_posts}}
- class="input-small"
- id="search-min-post-count"
- placeholder={{i18n "search.advanced.post.min.placeholder"}}
- aria-label={{i18n "search.advanced.post.min.aria_label"}}
- {{on
- "input"
- (withEventValue this.onChangeSearchTermMinPostCount)
- }}
- />
- {{icon "left-right"}}
- <Input
- @type="number"
- @value={{readonly this.searchedTerms.max_posts}}
- class="input-small"
- id="search-max-post-count"
- placeholder={{i18n "search.advanced.post.max.placeholder"}}
- aria-label={{i18n "search.advanced.post.max.aria_label"}}
- {{on
- "input"
- (withEventValue this.onChangeSearchTermMaxPostCount)
- }}
- />
+ <div class="count-group control-group">
+ <label class="control-label">
+ {{i18n "search.advanced.views.label"}}
+ </label>
+ <div class="controls">
+ <Input
+ @type="number"
+ @value={{readonly this.searchedTerms.min_views}}
+ class="input-small"
+ id="search-min-views"
+ placeholder={{i18n "search.advanced.min_views.placeholder"}}
+ aria-label={{i18n "search.advanced.min_views.aria_label"}}
+ {{on
+ "input"
+ (withEventValue this.onChangeSearchTermMinViews)
+ }}
+ />
+ {{icon "left-right"}}
+ <Input
+ @type="number"
+ @value={{readonly this.searchedTerms.max_views}}
+ class="input-small"
+ id="search-max-views"
+ placeholder={{i18n "search.advanced.max_views.placeholder"}}
+ aria-label={{i18n "search.advanced.max_views.aria_label"}}
+ {{on
+ "input"
+ (withEventValue this.onChangeSearchTermMaxViews)
+ }}
+ />
+ </div>
</div>
+
+ <PluginOutlet
+ @name="advanced-search-options-below"
+ @connectorTagName="div"
+ @outletArgs={{lazyHash
+ searchedTerms=this.searchedTerms
+ onChangeSearchedTermField=this.onChangeSearchedTermField
+ }}
+ />
</div>
- <div class="count-group control-group">
- {{! TODO: Using a label here fails no-nested-interactive lint rule }}
- <span class="control-label">{{i18n
- "search.advanced.views.label"
- }}</span>
- <div class="controls">
- <Input
- @type="number"
- @value={{readonly this.searchedTerms.min_views}}
- class="input-small"
- id="search-min-views"
- placeholder={{i18n "search.advanced.min_views.placeholder"}}
- aria-label={{i18n "search.advanced.min_views.aria_label"}}
- {{on "input" (withEventValue this.onChangeSearchTermMinViews)}}
- />
- {{icon "left-right"}}
- <Input
- @type="number"
- @value={{readonly this.searchedTerms.max_views}}
- class="input-small"
- id="search-max-views"
- placeholder={{i18n "search.advanced.max_views.placeholder"}}
- aria-label={{i18n "search.advanced.max_views.aria_label"}}
- {{on "input" (withEventValue this.onChangeSearchTermMaxViews)}}
+ {{#if this.site.mobileView}}
+ <div class="second-search-button">
+ <DButton
+ @action={{this.search}}
+ @icon="magnifying-glass"
+ @label="search.search_button"
+ @ariaLabel="search.search_button"
+ @disabled={{this.searchButtonDisabled}}
+ class="btn-primary search-cta"
/>
</div>
- </div>
- </details>
-
- {{#if this.site.mobileView}}
- <div class="second-search-button">
- <DButton
- @action={{this.search}}
- @icon="magnifying-glass"
- @label="search.search_button"
- @ariaLabel="search.search_button"
- @disabled={{this.searchButtonDisabled}}
- class="btn-primary search-cta"
- />
- </div>
- {{/if}}
- </div>
- </details>
+ {{/if}}
+ </div>
+ {{/if}}
+ </div>
</template>
}
diff --git a/frontend/discourse/app/components/search-menu.gjs b/frontend/discourse/app/components/search-menu.gjs
index 1f4067ce988..a72d2aa3014 100644
--- a/frontend/discourse/app/components/search-menu.gjs
+++ b/frontend/discourse/app/components/search-menu.gjs
@@ -186,7 +186,11 @@ export default class SearchMenu extends Component {
@action
openAdvancedSearch() {
- this.fullSearch();
+ this.loading = false;
+ const url = this.fullSearchUrl({ expanded: true });
+ if (url) {
+ DiscourseURL.routeTo(url);
+ }
this.close();
}
diff --git a/frontend/discourse/app/components/topic-list/topic-bulk-select-dropdown.gjs b/frontend/discourse/app/components/topic-list/topic-bulk-select-dropdown.gjs
index e9d2111d320..28c152fbe7d 100644
--- a/frontend/discourse/app/components/topic-list/topic-bulk-select-dropdown.gjs
+++ b/frontend/discourse/app/components/topic-list/topic-bulk-select-dropdown.gjs
@@ -3,12 +3,6 @@ import { i18n } from "discourse-i18n";
const TopicBulkSelectDropdown = <template>
<div class="bulk-select-topics-dropdown">
- <span class="bulk-select-topic-dropdown__count">
- {{i18n
- "topics.bulk.selected_count"
- }}
- </span>
<BulkSelectTopicsDropdown
@bulkSelectHelper={{@bulkSelectHelper}}
@afterBulkActionComplete={{@afterBulkActionComplete}}
@@ -16,6 +10,12 @@ const TopicBulkSelectDropdown = <template>
@excludedButtonIds={{@excludedButtonIds}}
@onAction={{@onAction}}
/>
+ <span class="bulk-select-topic-dropdown__count">
+ {{i18n
+ "topics.bulk.selected_count"
+ }}
+ </span>
</div>
</template>;
diff --git a/frontend/discourse/app/controllers/full-page-search.js b/frontend/discourse/app/controllers/full-page-search.js
index 4a813441bf4..be7e7b94b01 100644
--- a/frontend/discourse/app/controllers/full-page-search.js
+++ b/frontend/discourse/app/controllers/full-page-search.js
@@ -596,9 +596,7 @@ export default class FullPageSearchController extends Controller {
}
if (options.collapseFilters) {
- document
- .querySelector("details.advanced-filters")
- ?.removeAttribute("open");
+ this.appEvents.trigger("full-page-search:collapse-filters");
}
this.set("page", 1);
diff --git a/frontend/discourse/app/templates/full-page-search.gjs b/frontend/discourse/app/templates/full-page-search.gjs
index 059d4ae5e11..cfe441d5f62 100644
--- a/frontend/discourse/app/templates/full-page-search.gjs
+++ b/frontend/discourse/app/templates/full-page-search.gjs
@@ -39,9 +39,7 @@ export default <template>
<h1 class="search-page-heading">
{{#if @controller.hasResults}}
<div class="result-count" id="search-result-count" aria-live="polite">
- {{#unless @controller.searching}}
- {{htmlSafe @controller.resultCountLabel}}
- {{/unless}}
+ {{htmlSafe @controller.resultCountLabel}}
</div>
{{else}}
<div class="search-page-heading__page-title">
@@ -112,6 +110,10 @@ export default <template>
@search={{fn @controller.search (hash collapseFilters=true)}}
@searchButtonDisabled={{@controller.searchButtonDisabled}}
@expandFilters={{@controller.expandFilters}}
+ @sortOrder={{@controller.sortOrder}}
+ @searchType={{@controller.search_type}}
+ @addSearchResults={{@controller.addSearchResults}}
+ @model={{@controller.model}}
/>
</PluginOutlet>
</div>
@@ -154,12 +156,6 @@ export default <template>
@action={{@controller.toggleBulkSelect}}
class="btn-default bulk-select"
/>
- {{#if @controller.bulkSelectHelper.selected}}
- <SearchBulkSelectDropdown
- @bulkSelectHelper={{@controller.bulkSelectHelper}}
- @afterBulkActionComplete={{@controller.afterBulkActionComplete}}
- />
- {{/if}}
{{/if}}
{{#if @controller.bulkSelectEnabled}}
@@ -181,6 +177,14 @@ export default <template>
/>
{{/if}}
{{/if}}
+ {{#if @controller.canBulkSelect}}
+ {{#if @controller.bulkSelectHelper.selected}}
+ <SearchBulkSelectDropdown
+ @bulkSelectHelper={{@controller.bulkSelectHelper}}
+ @afterBulkActionComplete={{@controller.afterBulkActionComplete}}
+ />
+ {{/if}}
+ {{/if}}
<div class="sort-by inline-form">
<label>
diff --git a/frontend/discourse/tests/acceptance/search-full-test.js b/frontend/discourse/tests/acceptance/search-full-test.js
index a025c4ef5ac..5b0b97af6c5 100644
--- a/frontend/discourse/tests/acceptance/search-full-test.js
+++ b/frontend/discourse/tests/acceptance/search-full-test.js
@@ -141,7 +141,7 @@ acceptance("Search - Full Page", function (needs) {
await visit("/search");
await fillIn(".search-query", "@<script>prompt(1337)</script>gmail.com");
- await click(".advanced-filters > summary");
+ await click(".advanced-filters__toggle");
assert.strictEqual(
selectKit("#search-posted-by").header().label(),
@@ -155,6 +155,7 @@ acceptance("Search - Full Page", function (needs) {
);
await visit("/search");
+ await click(".advanced-filters__toggle");
await fillIn(".search-query", "none");
@@ -162,7 +163,6 @@ acceptance("Search - Full Page", function (needs) {
await categoryChooser.fillInFilter("faq");
await categoryChooser.selectRowByValue(4);
- await click(".advanced-filters > summary");
assert.strictEqual(
selectKit("#search-in-category").header().label(),
"faq"
@@ -179,6 +179,7 @@ acceptance("Search - Full Page", function (needs) {
);
await visit("/search");
+ await click(".advanced-filters__toggle");
await fillIn(".search-query", "none");
@@ -186,7 +187,6 @@ acceptance("Search - Full Page", function (needs) {
await categoryChooser.fillInFilter("快乐的");
await categoryChooser.selectRowByValue(240);
- await click(".advanced-filters > summary");
assert.strictEqual(
selectKit("#search-in-category").header().label(),
"快乐的"
@@ -204,7 +204,7 @@ acceptance("Search - Full Page", function (needs) {
const inSelector = selectKit(IN_OPTIONS_SELECTOR);
await visit("/search");
- await click(".advanced-filters > summary");
+ await click(".advanced-filters__toggle");
await fillIn(".search-query", "none");
await inSelector.expand();
await inSelector.selectRowByValue("title");
@@ -231,7 +231,7 @@ acceptance("Search - Full Page", function (needs) {
const inSelector = selectKit(IN_OPTIONS_SELECTOR);
await visit("/search");
- await click(".advanced-filters > summary");
+ await click(".advanced-filters__toggle");
await fillIn(".search-query", "none");
await inSelector.expand();
await inSelector.selectRowByValue("likes");
@@ -250,7 +250,7 @@ acceptance("Search - Full Page", function (needs) {
const inSelector = selectKit(IN_OPTIONS_SELECTOR);
await visit("/search");
- await click(".advanced-filters > summary");
+ await click(".advanced-filters__toggle");
await fillIn(".search-query", "none");
await inSelector.expand();
await inSelector.selectRowByValue("messages");
@@ -281,7 +281,7 @@ acceptance("Search - Full Page", function (needs) {
const inSelector = selectKit(IN_OPTIONS_SELECTOR);
await visit("/search");
- await click(".advanced-filters > summary");
+ await click(".advanced-filters__toggle");
await fillIn(".search-query", "none");
await inSelector.expand();
await inSelector.selectRowByValue("seen");
@@ -310,7 +310,7 @@ acceptance("Search - Full Page", function (needs) {
await visit("/search");
- await click(".advanced-filters > summary");
+ await click(".advanced-filters__toggle");
await fillIn(".search-query", "none");
await inSelector.expand();
await inSelector.selectRowByValue("bookmarks");
@@ -363,7 +363,7 @@ acceptance("Search - Full Page", function (needs) {
await visit("/search");
- await click(".advanced-filters > summary");
+ await click(".advanced-filters__toggle");
await fillIn(".search-query", "none");
await statusSelector.expand();
await statusSelector.selectRowByValue("closed");
@@ -388,7 +388,7 @@ acceptance("Search - Full Page", function (needs) {
await visit("/search");
- await click(".advanced-filters > summary");
+ await click(".advanced-filters__toggle");
await fillIn(".search-query", "status:none");
assert.strictEqual(
@@ -403,7 +403,7 @@ acceptance("Search - Full Page", function (needs) {
await visit("/search");
- await click(".advanced-filters > summary");
+ await click(".advanced-filters__toggle");
await fillIn(".search-query", "in:none");
assert.strictEqual(
@@ -424,7 +424,7 @@ acceptance("Search - Full Page", function (needs) {
);
await visit("/search");
- await click(".advanced-filters > summary");
+ await click(".advanced-filters__toggle");
await fillIn(".search-query", "none");
await selectDate(".date-picker#search-post-date", "2016-10-05");
@@ -451,13 +451,11 @@ acceptance("Search - Full Page", function (needs) {
test("update min post count through advanced search UI", async function (assert) {
await visit("/search");
- await click(".advanced-filters > summary");
+ await click(".advanced-filters__toggle");
await fillIn(".search-query", "none");
await fillIn("#search-min-post-count", "5");
- assert
- .dom(".search-advanced-additional-options #search-min-post-count")
- .hasValue("5", 'has "5" populated');
+ assert.dom("#search-min-post-count").hasValue("5", 'has "5" populated');
assert
.dom(".search-query")
.hasValue(
@@ -468,13 +466,11 @@ acceptance("Search - Full Page", function (needs) {
test("update max post count through advanced search UI", async function (assert) {
await visit("/search");
- await click(".advanced-filters > summary");
+ await click(".advanced-filters__toggle");
await fillIn(".search-query", "none");
await fillIn("#search-max-post-count", "5");
- assert
- .dom(".search-advanced-additional-options #search-max-post-count")
- .hasValue("5", 'has "5" populated');
+ assert.dom("#search-max-post-count").hasValue("5", 'has "5" populated');
assert
.dom(".search-query")
.hasValue(
@@ -531,7 +527,7 @@ acceptance("Search - Full Page", function (needs) {
await fillIn(".search-query", "admin");
assert.dom(".fps-user-item").doesNotExist("has no user results");
- await click(".advanced-filters > summary");
+ await click(".advanced-filters__toggle");
await typeSelector.expand();
await typeSelector.selectRowByValue(SEARCH_TYPE_USERS);
@@ -558,7 +554,7 @@ acceptance("Search - Full Page", function (needs) {
assert.dom(".fps-tag-item").doesNotExist("has no category/tag results");
- await click(".advanced-filters > summary");
+ await click(".advanced-filters__toggle");
await typeSelector.expand();
await typeSelector.selectRowByValue(SEARCH_TYPE_CATS_TAGS);
await click(".search-cta");
@@ -588,16 +584,16 @@ acceptance("Search - Full Page", function (needs) {
await click(".search-cta");
assert
- .dom(".advanced-filters[open]")
+ .dom(".advanced-filters.--is-expanded")
.doesNotExist("launching a search collapses advanced filters");
await visit("/search");
assert
- .dom(".advanced-filters[open]")
+ .dom(".advanced-filters.--is-expanded")
.doesNotExist("filters are collapsed when query param is not present");
- await click(".advanced-filters > summary");
+ await click(".advanced-filters__toggle");
assert
.dom(".search-advanced-options")
.isVisible("clicking on element expands filters");
diff --git a/frontend/discourse/tests/acceptance/search-mobile-test.js b/frontend/discourse/tests/acceptance/search-mobile-test.js
index 3d0a9c6796f..57095e82530 100644
--- a/frontend/discourse/tests/acceptance/search-mobile-test.js
+++ b/frontend/discourse/tests/acceptance/search-mobile-test.js
@@ -22,10 +22,10 @@ acceptance("Search - Mobile", function (needs) {
.dom(".search-results .fps-topic")
.doesNotExist("no results by default");
- await click(".advanced-filters summary");
+ await click(".advanced-filters__toggle");
assert
- .dom(".advanced-filters[open]")
+ .dom(".advanced-filters.--is-expanded")
.exists("it should expand advanced search filters");
await fillIn(".search-query", "consectetur");
@@ -34,7 +34,7 @@ acceptance("Search - Mobile", function (needs) {
assert.dom(".fps-topic").exists({ count: 1 }, "has one post");
assert
- .dom(".advanced-filters[open]")
+ .dom(".advanced-filters.--is-expanded")
.doesNotExist("it should collapse advanced search filters");
await click(".search-cta");
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-full-page-search.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-full-page-search.gjs
index 6b8b4c00e50..3af559b2cd2 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-full-page-search.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-full-page-search.gjs
@@ -1,4 +1,4 @@
-/* eslint-disable ember/no-side-effects, ember/no-tracked-properties-from-args */
+/* eslint-disable ember/no-tracked-properties-from-args */
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { on } from "@ember/modifier";
@@ -9,12 +9,10 @@ import DToggleSwitch from "discourse/components/d-toggle-switch";
import { SEARCH_TYPE_DEFAULT } from "discourse/controllers/full-page-search";
import DTooltip from "discourse/float-kit/components/d-tooltip";
import concatClass from "discourse/helpers/concat-class";
-import icon from "discourse/helpers/d-icon";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { isValidSearchTerm, translateResults } from "discourse/lib/search";
import { i18n } from "discourse-i18n";
-import AiIndicatorWave from "./ai-indicator-wave";
const AI_RESULTS_TOGGLED = "full-page-search:ai-results-toggled";
@@ -28,7 +26,7 @@ export default class AiFullPageSearch extends Component {
@tracked sortOrder = this.args.sortOrder;
@tracked autoEnabledForZeroResults = false;
@tracked shouldAutoEnableWhenAiReady = false;
- initialSearchTerm = this.args.searchTerm;
+ @tracked hasCompletedSearch = false;
constructor() {
super(...arguments);
@@ -57,8 +55,8 @@ export default class AiFullPageSearch extends Component {
return;
}
- this.initialSearchTerm = this.args.searchTerm;
this.searching = true;
+ this.hasCompletedSearch = false;
this.autoEnabledForZeroResults = false;
this.shouldAutoEnableWhenAiReady = false;
this.resetAiResults();
@@ -124,73 +122,60 @@ export default class AiFullPageSearch extends Component {
);
}
- // Auto-enabled and showing results:
- if (
- this.autoEnabledForZeroResults &&
- this.showingAiResults &&
- this.AiResults.length > 0
- ) {
- return i18n(
- "discourse_ai.embeddings.semantic_search_results.zero_results_expanded",
- {
- count: this.AiResults.length,
- }
- );
- }
+ return i18n("discourse_ai.embeddings.semantic_search_results.toggle");
+ }
- // Search loading:
- if (this.searching) {
- return i18n("discourse_ai.embeddings.semantic_search_loading");
- }
+ get noResults() {
+ return (
+ this.hasCompletedSearch &&
+ !this.searching &&
+ this.validSearchOrder &&
+ this.AiResults.length === 0
+ );
+ }
- // We have results and we are showing them
- if (this.AiResults.length && this.showingAiResults) {
- return i18n("discourse_ai.embeddings.semantic_search_results.toggle", {
- count: this.AiResults.length,
- });
+ get tooltipIdentifier() {
+ if (!this.validSearchOrder) {
+ return "semantic-search-invalid-sort";
+ }
+ if (!this.hasCompletedSearch && !this.searching) {
+ return "semantic-search-not-submitted";
+ }
+ if (this.noResults) {
+ return "semantic-search-no-results";
+ }
+ if (this.autoEnabledForZeroResults && this.showingAiResults) {
+ return "semantic-search-zero-results";
}
+ return null;
+ }
- // We have results but are hiding them
- if (this.AiResults.length && !this.showingAiResults) {
+ get tooltipContent() {
+ if (!this.validSearchOrder) {
return i18n(
- "discourse_ai.embeddings.semantic_search_results.toggle_hidden",
- {
- count: this.AiResults.length,
- }
+ "discourse_ai.embeddings.semantic_search_tooltips.invalid_sort"
);
}
-
- // Typing to search:
- if (
- this.AiResults.length === 0 &&
- this.searchTerm !== this.initialSearchTerm
- ) {
- return i18n("discourse_ai.embeddings.semantic_search_results.new");
+ if (!this.hasCompletedSearch && !this.searching) {
+ return i18n(
+ "discourse_ai.embeddings.semantic_search_tooltips.not_submitted"
+ );
}
-
- // No results:
- if (this.AiResults.length === 0) {
- return i18n("discourse_ai.embeddings.semantic_search_results.none");
+ if (this.noResults) {
+ return i18n(
+ "discourse_ai.embeddings.semantic_search_tooltips.no_results"
+ );
}
- }
-
- get settled() {
- return (
- this.validSearchOrder &&
- !this.searching &&
- this.searchTerm === this.initialSearchTerm
- );
- }
-
- get noResults() {
- return this.settled && this.AiResults.length === 0;
+ if (this.autoEnabledForZeroResults && this.showingAiResults) {
+ return i18n(
+ "discourse_ai.embeddings.semantic_search_results.zero_results_expanded",
+ { count: this.AiResults.length }
+ );
+ }
+ return null;
}
get searchTerm() {
- if (this.initialSearchTerm !== this.args.searchTerm) {
- this.initialSearchTerm = undefined;
- }
-
return this.args.searchTerm;
}
@@ -212,14 +197,6 @@ export default class AiFullPageSearch extends Component {
}
}
- get tooltipText() {
- return i18n(
- `discourse_ai.embeddings.semantic_search_tooltips.${
- this.validSearchOrder ? "results_explanation" : "invalid_sort"
- }`
- );
- }
-
@action
toggleAiResults() {
this.appEvents.trigger(AI_RESULTS_TOGGLED, {
@@ -278,6 +255,7 @@ export default class AiFullPageSearch extends Component {
.catch(popupAjaxError)
.finally(() => {
this.searching = false;
+ this.hasCompletedSearch = true;
});
}
@@ -290,6 +268,7 @@ export default class AiFullPageSearch extends Component {
this.onSearch();
} else {
this.showingAiResults = false;
+ this.hasCompletedSearch = false;
this.resetAiResults();
}
}
@@ -302,37 +281,63 @@ export default class AiFullPageSearch extends Component {
role="region"
>
<div class="semantic-search__results">
- <div
- class={{concatClass "semantic-search__searching" this.searchClass}}
- >
- <DToggleSwitch
- disabled={{this.disableToggleSwitch}}
- @state={{this.showingAiResults}}
- class="semantic-search__results-toggle"
- {{on "click" this.toggleAiResults}}
- />
-
- <div class="semantic-search__searching-text">
- {{icon "discourse-sparkles"}}
- {{this.searchStateText}}
- </div>
-
- {{#if this.validSearchOrder}}
- <AiIndicatorWave @loading={{this.searching}} />
- {{/if}}
-
- <DTooltip
- @identifier="semantic-search-tooltip"
- class="semantic-search__tooltip"
- >
+ {{#if this.tooltipIdentifier}}
+ <DTooltip @identifier={{this.tooltipIdentifier}}>
<:trigger>
- {{icon "far-circle-question"}}
+ <div
+ class={{concatClass
+ "semantic-search__searching"
+ this.searchClass
+ }}
+ >
+ <DToggleSwitch
+ disabled={{this.disableToggleSwitch}}
+ @state={{this.showingAiResults}}
+ class="semantic-search__results-toggle"
+ {{on "click" this.toggleAiResults}}
+ />
+ <div class="semantic-search__searching-text">
+ {{this.searchStateText}}
+ {{#if this.searching}}
+ <div class="spinner small"></div>
+ {{else if this.hasCompletedSearch}}
+ <span
+ class={{concatClass
+ "badge-notification"
+ (if this.AiResults.length "--has-results")
+ }}
+ >{{this.AiResults.length}}</span>
+ {{/if}}
+ </div>
+ </div>
</:trigger>
- <:content>
- {{this.tooltipText}}
- </:content>
+ <:content>{{this.tooltipContent}}</:content>
</DTooltip>
- </div>
+ {{else}}
+ <div
+ class={{concatClass "semantic-search__searching" this.searchClass}}
+ >
+ <DToggleSwitch
+ disabled={{this.disableToggleSwitch}}
+ @state={{this.showingAiResults}}
+ class="semantic-search__results-toggle"
+ {{on "click" this.toggleAiResults}}
+ />
+ <div class="semantic-search__searching-text">
+ {{this.searchStateText}}
+ {{#if this.searching}}
+ <div class="spinner small"></div>
+ {{else if this.hasCompletedSearch}}
+ <span
+ class={{concatClass
+ "badge-notification"
+ (if this.AiResults.length "--has-results")
+ }}
+ >{{this.AiResults.length}}</span>
+ {{/if}}
+ </div>
+ </div>
+ {{/if}}
</div>
</div>
</template>
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/connectors/full-page-search-below-search-header/ai-full-page-search.gjs b/plugins/discourse-ai/assets/javascripts/discourse/connectors/full-page-search-advanced-header/ai-full-page-search.gjs
similarity index 92%
rename from plugins/discourse-ai/assets/javascripts/discourse/connectors/full-page-search-below-search-header/ai-full-page-search.gjs
rename to plugins/discourse-ai/assets/javascripts/discourse/connectors/full-page-search-advanced-header/ai-full-page-search.gjs
index 96112eb7b42..a4661349614 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/connectors/full-page-search-below-search-header/ai-full-page-search.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/connectors/full-page-search-advanced-header/ai-full-page-search.gjs
@@ -9,7 +9,7 @@ export default class AiFullPageSearchConnector extends Component {
<template>
<AiFullPageSearch
@sortOrder={{@outletArgs.sortOrder}}
- @searchTerm={{@outletArgs.search}}
+ @searchTerm={{@outletArgs.searchTerm}}
@searchType={{@outletArgs.type}}
@addSearchResults={{@outletArgs.addSearchResults}}
@model={{@outletArgs.model}}
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/connectors/full-page-search-below-search-header/ai-full-page-discobot-discoveries.gjs b/plugins/discourse-ai/assets/javascripts/discourse/connectors/full-page-search-below-search-header/ai-full-page-discobot-discoveries.gjs
index 91a9a3c470c..ef487bbdd5e 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/connectors/full-page-search-below-search-header/ai-full-page-discobot-discoveries.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/connectors/full-page-search-below-search-header/ai-full-page-discobot-discoveries.gjs
@@ -2,6 +2,7 @@ import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { service } from "@ember/service";
import bodyClass from "discourse/helpers/body-class";
+import concatClass from "discourse/helpers/concat-class";
import icon from "discourse/helpers/d-icon";
import { i18n } from "discourse-i18n";
import AiSearchDiscoveries from "../../components/ai-search-discoveries";
@@ -54,7 +55,12 @@ export default class AiFullPageDiscobotDiscoveries extends Component {
<template>
{{#if this.shouldShow}}
{{bodyClass "has-discoveries"}}
- <div class="ai-search-discoveries__discoveries-wrapper">
+ <div
+ class={{concatClass
+ "ai-search-discoveries__discoveries-wrapper"
+ (if this.discobotDiscoveries.showDiscoveryTitle "--has-content")
+ }}
+ >
{{#if this.discobotDiscoveries.showDiscoveryTitle}}
<h3
class="ai-search-discoveries__discoveries-title full-page-discoveries"
diff --git a/plugins/discourse-ai/assets/stylesheets/modules/ai-bot/common/ai-discobot-discoveries.scss b/plugins/discourse-ai/assets/stylesheets/modules/ai-bot/common/ai-discobot-discoveries.scss
index f0a8ecaaab8..d05f611ed58 100644
--- a/plugins/discourse-ai/assets/stylesheets/modules/ai-bot/common/ai-discobot-discoveries.scss
+++ b/plugins/discourse-ai/assets/stylesheets/modules/ai-bot/common/ai-discobot-discoveries.scss
@@ -184,6 +184,30 @@
}
}
+.has-discoveries {
+ .search-container .search-advanced .search-info {
+ border: none;
+ }
+
+ .powered-by-discourse {
+ @include viewport.from(md) {
+ margin-left: var(--space-6);
+ }
+
+ @include viewport.until(md) {
+ margin-left: var(--space-2);
+ }
+ }
+}
+
+@include viewport.until(md) {
+ .has-discoveries {
+ .search-container .search-advanced .search-results {
+ padding-inline: 1em;
+ }
+ }
+}
+
.search-page .ai-search-discoveries__discoveries-wrapper {
padding-bottom: 0.5rem;
}
@@ -208,10 +232,6 @@
.semantic-search__searching {
margin-left: 0;
}
-
- .semantic-search__searching-text {
- margin-left: 1.25em;
- }
}
.search-container .search-header {
@@ -224,8 +244,13 @@
padding: 1em 2em;
}
+ .search-container .search-advanced .search-info {
+ margin: 0;
+ }
+
.search-results .fps-result {
margin-bottom: 2.5em;
+
&:not(.bulk-select-enabled) {
padding: 0;
}
@@ -255,9 +280,12 @@
.ai-search-discoveries__discoveries-wrapper {
grid-column: 2 / -1;
grid-row: 1 / 5;
- border-left: 1px solid var(--primary-low);
align-self: stretch;
+ &.--has-content {
+ border-left: 1px solid var(--primary-low);
+ }
+
.cooked {
color: var(--primary-high);
}
@@ -285,11 +313,6 @@ body.has-sidebar-page {
padding-top: 1rem;
}
- .search-container .search-advanced .search-info,
- .semantic-search__container.search-results {
- padding-inline: 10%;
- }
-
.full-page-discoveries {
padding-inline: 10%;
}
diff --git a/plugins/discourse-ai/assets/stylesheets/modules/embeddings/common/semantic-search.scss b/plugins/discourse-ai/assets/stylesheets/modules/embeddings/common/semantic-search.scss
index b43e4014208..ca0831374c8 100644
--- a/plugins/discourse-ai/assets/stylesheets/modules/embeddings/common/semantic-search.scss
+++ b/plugins/discourse-ai/assets/stylesheets/modules/embeddings/common/semantic-search.scss
@@ -1,23 +1,15 @@
@use "lib/viewport";
.semantic-search__container {
- .has-sidebar-page & {
- @include viewport.until(lg) {
- border-top: 1px solid var(--primary-low);
- }
- }
-
- body:not(.has-sidebar-page) & {
- @include viewport.until(md) {
- border-top: 1px solid var(--primary-low);
- }
- }
-
.semantic-search__results {
display: flex;
flex-direction: column;
align-items: baseline;
+ @include viewport.until(sm) {
+ margin-top: var(--space-4);
+ }
+
.ai-indicator-wave {
color: var(--primary-medium);
}
@@ -42,8 +34,14 @@
}
&__searching-text {
- display: inline-block;
margin-left: 8px;
+ display: flex;
+ gap: var(--space-1);
+ align-items: center;
+
+ .badge-notification {
+ top: unset;
+ }
}
&__tooltip {
@@ -63,10 +61,6 @@
.ai-result__icon {
display: none;
}
-
- &:not(.bulk-select-enabled) {
- padding: 0.5rem;
- }
}
.ai-result {
@@ -82,6 +76,38 @@
}
}
+.semantic-search__searching-text {
+ .badge-notification.--has-results {
+ background: var(--tertiary);
+ }
+}
+
+.search-filters .advanced-filters {
+ display: grid;
+ grid-template-columns: auto 1fr;
+ align-items: center;
+
+ @include viewport.until(sm) {
+ grid-template-columns: 1fr;
+ }
+
+ .advanced-filters__toggle {
+ grid-column: 1;
+ }
+
+ .semantic-search__container {
+ justify-self: end;
+
+ @include viewport.until(sm) {
+ justify-self: start;
+ }
+ }
+
+ .search-advanced-filters {
+ grid-column: 1 / -1;
+ }
+}
+
// Hides other buttons and only shows loader
// while AI quick search is in progress
.search-input {
diff --git a/plugins/discourse-ai/config/locales/client.en.yml b/plugins/discourse-ai/config/locales/client.en.yml
index 263b7632a9e..0858c92d9fe 100644
--- a/plugins/discourse-ai/config/locales/client.en.yml
+++ b/plugins/discourse-ai/config/locales/client.en.yml
@@ -972,17 +972,15 @@ en:
model_name: "Model name"
semantic_search: "Topics (Semantic)"
- semantic_search_loading: "Searching for more results using AI"
semantic_search_results:
- toggle: "Showing %{count} results found using AI"
- toggle_hidden: "Hiding %{count} results found using AI"
- none: "Sorry, our AI search found no matching topics"
- new: "Press 'search' to begin looking for new results with AI"
+ toggle: "AI results"
unavailable: "AI results unavailable"
zero_results_expanded: "Zero results found, showing %{count} AI results"
semantic_search_tooltips:
results_explanation: "When enabled, additional AI search results will be added below."
invalid_sort: "Search results must be sorted by Relevance to display AI results"
+ not_submitted: "Submit a search to enable AI results"
+ no_results: "No AI results found for this search"
semantic_search_unavailable_tooltip: "Search results must be sorted by Relevance to display AI results"
ai_generated_result: "Search result found using AI"
quick_search:
diff --git a/plugins/discourse-assign/test/javascripts/acceptance/search-full-test.js b/plugins/discourse-assign/test/javascripts/acceptance/search-full-test.js
index 3b0bb77b2fb..54b11af0b73 100644
--- a/plugins/discourse-assign/test/javascripts/acceptance/search-full-test.js
+++ b/plugins/discourse-assign/test/javascripts/acceptance/search-full-test.js
@@ -1,4 +1,4 @@
-import { fillIn, visit } from "@ember/test-helpers";
+import { click, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";
@@ -26,6 +26,7 @@ acceptance("Discourse Assign | Search - Full Page", function (needs) {
);
await visit("/search");
+ await click(".advanced-filters__toggle");
await fillIn(".search-query", "none");
await inSelector.expand();
@@ -44,6 +45,7 @@ acceptance("Discourse Assign | Search - Full Page", function (needs) {
);
await visit("/search");
+ await click(".advanced-filters__toggle");
await fillIn(".search-query", "none");
await inSelector.expand();
@@ -60,6 +62,7 @@ acceptance("Discourse Assign | Search - Full Page", function (needs) {
const assignedField = selectKit(".assigned-advanced-search .select-kit");
await visit("/search");
+ await click(".advanced-filters__toggle");
await fillIn(".search-query", "none");
await assignedField.expand();