UX: Adjust bot conversation header and sidebar on hamburger mode (#1295)

Context in dev conversation -- in hamburger mode we don't need the robot icon to swap to shuffle, AND we don't need back to forum link.
This commit is contained in:
Mark VanLandingham 2025-04-29 10:10:44 -05:00 committed by GitHub
parent 541e6d7437
commit 06ab446e47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 38 additions and 10 deletions

View File

@ -10,6 +10,7 @@ import { AI_CONVERSATIONS_PANEL } from "../services/ai-conversations-sidebar-man
export default class AiBotHeaderIcon extends Component {
@service composer;
@service currentUser;
@service navigationMenu;
@service router;
@service sidebarState;
@service siteSettings;
@ -35,6 +36,7 @@ export default class AiBotHeaderIcon extends Component {
get clickShouldRouteOutOfConversations() {
return (
!this.navigationMenu.isHeaderDropdownMode &&
this.siteSettings.ai_enable_experimental_bot_ux &&
this.sidebarState.currentPanel?.key === AI_CONVERSATIONS_PANEL
);

View File

@ -29,13 +29,14 @@ export default {
);
const appEvents = api.container.lookup("service:app-events");
const messageBus = api.container.lookup("service:message-bus");
const navigationMenu = api.container.lookup("service:navigationMenu");
api.addSidebarPanel(
(BaseCustomSidebarPanel) =>
class AiConversationsSidebarPanel extends BaseCustomSidebarPanel {
key = AI_CONVERSATIONS_PANEL;
hidden = true;
displayHeader = true;
displayHeader = !navigationMenu.isHeaderDropdownMode;
expandActiveSection = true;
}
);

View File

@ -99,6 +99,7 @@ RSpec.describe "AI Bot - Homepage", type: :system do
SiteSetting.ai_enable_experimental_bot_ux = true
SiteSetting.ai_bot_enabled = true
SiteSetting.navigation_menu = "sidebar"
Jobs.run_immediately!
SiteSetting.ai_bot_allowed_groups = "#{Group::AUTO_GROUPS[:trust_level_0]}"
sign_in(user)
@ -123,15 +124,6 @@ RSpec.describe "AI Bot - Homepage", type: :system do
expect(composer).to be_closed
end
it "renders sidebar even when navigation menu is set to header" do
SiteSetting.navigation_menu = "header dropdown"
visit "/"
header.click_bot_button
expect(ai_pm_homepage).to have_homepage
expect(sidebar).to be_visible
expect(header_dropdown).to be_visible
end
it "hides default content in the sidebar" do
visit "/"
header.click_bot_button
@ -266,6 +258,31 @@ RSpec.describe "AI Bot - Homepage", type: :system do
ai_pm_homepage.llm_selector.select_row_by_name(claude_2_dup.display_name)
ai_pm_homepage.llm_selector.collapse
end
it "renders back to forum link" do
ai_pm_homepage.visit
expect(ai_pm_homepage).to have_sidebar_back_link
end
context "with hamburger menu" do
before { SiteSetting.navigation_menu = "header dropdown" }
it "keeps robot icon in the header and doesn't display sidebar back link" do
visit "/"
expect(header).to have_icon_in_bot_button(icon: "robot")
header.click_bot_button
expect(ai_pm_homepage).to have_homepage
expect(header).to have_icon_in_bot_button(icon: "robot")
expect(ai_pm_homepage).to have_no_sidebar_back_link
end
it "still renders the sidebar" do
visit "/"
header.click_bot_button
expect(ai_pm_homepage).to have_homepage
expect(sidebar).to be_visible
expect(header_dropdown).to be_visible
end
end
end
context "when `ai_enable_experimental_bot_ux` is disabled" do

View File

@ -53,6 +53,14 @@ module PageObjects
def llm_selector
PageObjects::Components::SelectKit.new(".persona-llm-selector__llm-dropdown")
end
def has_sidebar_back_link?
page.has_css?(".sidebar-sections__back-to-forum")
end
def has_no_sidebar_back_link?
page.has_no_css?(".sidebar-sections__back-to-forum")
end
end
end
end