UX: Bring back New Conversation button on mobile sidebar (#1283)
This commit is contained in:
parent
1a0d1d6e84
commit
797d727a20
|
@ -1,4 +1,5 @@
|
||||||
import Component from "@glimmer/component";
|
import Component from "@glimmer/component";
|
||||||
|
import { action } from "@ember/object";
|
||||||
import { service } from "@ember/service";
|
import { service } from "@ember/service";
|
||||||
import DButton from "discourse/components/d-button";
|
import DButton from "discourse/components/d-button";
|
||||||
import { AI_CONVERSATIONS_PANEL } from "../services/ai-conversations-sidebar-manager";
|
import { AI_CONVERSATIONS_PANEL } from "../services/ai-conversations-sidebar-manager";
|
||||||
|
@ -14,12 +15,18 @@ export default class AiBotSidebarNewConversation extends Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@action
|
||||||
|
routeTo() {
|
||||||
|
this.router.transitionTo("/discourse-ai/ai-bot/conversations");
|
||||||
|
this.args.outletArgs?.toggleNavigationMenu?.();
|
||||||
|
}
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
{{#if this.shouldRender}}
|
{{#if this.shouldRender}}
|
||||||
<DButton
|
<DButton
|
||||||
@route="/discourse-ai/ai-bot/conversations"
|
|
||||||
@label="discourse_ai.ai_bot.conversations.new"
|
@label="discourse_ai.ai_bot.conversations.new"
|
||||||
@icon="plus"
|
@icon="plus"
|
||||||
|
@action={{this.routeTo}}
|
||||||
class="ai-new-question-button btn-default"
|
class="ai-new-question-button btn-default"
|
||||||
/>
|
/>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
@use "lib/viewport";
|
@use "lib/viewport";
|
||||||
|
|
||||||
// Hide the new question button from the hamburger menu's footer
|
// Hide the new question button from the hamburger menu's footer on desktop
|
||||||
.hamburger-panel .ai-new-question-button {
|
.desktop-view .hamburger-panel .ai-new-question-button {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -272,4 +272,21 @@ RSpec.describe "AI Bot - Homepage", type: :system do
|
||||||
expect(sidebar).to have_no_css("button.ai-new-question-button")
|
expect(sidebar).to have_no_css("button.ai-new-question-button")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "with header dropdown on mobile", mobile: true do
|
||||||
|
before { SiteSetting.navigation_menu = "header dropdown" }
|
||||||
|
|
||||||
|
it "displays the new question button in the menu when viewing a PM" do
|
||||||
|
ai_pm_homepage.visit
|
||||||
|
header_dropdown.open
|
||||||
|
expect(ai_pm_homepage).to have_no_new_question_button
|
||||||
|
|
||||||
|
topic_page.visit_topic(pm)
|
||||||
|
header_dropdown.open
|
||||||
|
ai_pm_homepage.click_new_question_button
|
||||||
|
|
||||||
|
# Hamburger sidebar is closed
|
||||||
|
expect(header_dropdown).to have_no_dropdown_visible
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -32,6 +32,14 @@ module PageObjects
|
||||||
page.has_no_css?(HOMEPAGE_WRAPPER_CLASS)
|
page.has_no_css?(HOMEPAGE_WRAPPER_CLASS)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def has_no_new_question_button?
|
||||||
|
page.has_no_css?(".ai-new-question-button")
|
||||||
|
end
|
||||||
|
|
||||||
|
def click_new_question_button
|
||||||
|
page.find(".ai-new-question-button").click
|
||||||
|
end
|
||||||
|
|
||||||
def persona_selector
|
def persona_selector
|
||||||
PageObjects::Components::SelectKit.new(".persona-llm-selector__persona-dropdown")
|
PageObjects::Components::SelectKit.new(".persona-llm-selector__persona-dropdown")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue