Skip to content

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

UX: Style changes / refactor / layout (#41704)

Jordan Vidrine0a8edbe9cd62
diff --git a/app/assets/stylesheets/color_definitions.scss b/app/assets/stylesheets/color_definitions.scss
index fcd12cfa0c7..9d8519f2984 100644
--- a/app/assets/stylesheets/color_definitions.scss
+++ b/app/assets/stylesheets/color_definitions.scss
@@ -153,6 +153,7 @@
--shadow-header: 0 0 0 1px var(--content-border-color);
--shadow-footer-nav: 0 0 2px 0 rgba(0, 0, 0, #{$shadow-opacity-footer-nav});
--shadow-focus-danger: 0 0 6px 0 var(--danger);
+ --shadow-docked-composer: 0 4px 30px rgb(0, 0, 0, 0.15);
--float-kit-arrow-stroke-color: var(--primary-low);
--float-kit-arrow-fill-color: var(--secondary);
--topic-timeline-border-color: #{$tertiary-low-or-tertiary-high};
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-agent-llm-selector.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-agent-llm-selector.gjs
index 646c6dc285b..a0be0472823 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-agent-llm-selector.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-agent-llm-selector.gjs
@@ -214,7 +214,9 @@ export default class AiAgentLlmSelector extends Component {
}
}
- this.args.setAgentId(this._value);
+ // deferred: the parent tracks state already consumed by templates
+ // rendered before this component
+ next(() => this.args.setAgentId(this._value));
}
#loadStoredLlm() {
@@ -260,6 +262,7 @@ export default class AiAgentLlmSelector extends Component {
@options={{hash
icon=(if @showLabels "angle-down" "robot")
filterable=this.filterable
+ customStyle=true
}}
/>
</div>
@@ -273,7 +276,10 @@ export default class AiAgentLlmSelector extends Component {
class="agent-llm-selector__llm-dropdown"
@value={{this.currentLlm}}
@content={{this.llmOptions}}
- @options={{hash icon=(if @showLabels "angle-down" "globe")}}
+ @options={{hash
+ icon=(if @showLabels "angle-down" "globe")
+ customStyle=true
+ }}
/>
</div>
{{/if}}
diff --git a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-bot-conversations.gjs b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-bot-conversations.gjs
index b460c7512f6..69f9f3b58e7 100644
--- a/plugins/discourse-ai/assets/javascripts/discourse/components/ai-bot-conversations.gjs
+++ b/plugins/discourse-ai/assets/javascripts/discourse/components/ai-bot-conversations.gjs
@@ -30,6 +30,7 @@ import {
import { clipboardHelpers, slugify } from "discourse/lib/utilities";
import DButton from "discourse/ui-kit/d-button";
import dConcatClass from "discourse/ui-kit/helpers/d-concat-class";
+import dIcon from "discourse/ui-kit/helpers/d-icon";
import dAutocomplete from "discourse/ui-kit/modifiers/d-autocomplete";
import { i18n } from "discourse-i18n";
import AiAgentLlmSelector from "discourse/plugins/discourse-ai/discourse/components/ai-agent-llm-selector";
@@ -399,18 +400,10 @@ export default class AiBotConversations extends Component {
<template>
<div class="ai-bot-conversations" ...attributes>
{{bodyClass "ai-bot-conversations-page"}}
- <AiAgentLlmSelector
- @showLabels={{true}}
- @setAgentId={{this.setAgentId}}
- @setLlmId={{this.setLlmId}}
- @setTargetRecipient={{this.setTargetRecipient}}
- @agentName={{@controller.agent}}
- @llmName={{@controller.llm}}
- @onSelectionChanged={{this.onSelectionChanged}}
- />
<div class="ai-bot-conversations__content-wrapper">
<div class="ai-bot-conversations__title">
+ {{dIcon "discobot"}}
{{i18n "discourse_ai.ai_bot.conversations.header"}}
</div>
<PluginOutlet
@@ -420,47 +413,63 @@ export default class AiBotConversations extends Component {
submit=this.prepareAndSubmitToBot
}}
/>
+ <div class="ai-bot-conversations__input-container">
+ <div
+ {{this.creditLimitTooltipModifier}}
+ class={{dConcatClass
+ "ai-bot-conversations__input-wrapper"
+ (if this.isSubmitDisabled "--disabled")
+ }}
+ >
+ <DButton
+ @icon="upload"
+ @action={{unless this.isSubmitDisabled this.openFileUpload}}
+ @disabled={{this.isSubmitDisabled}}
+ @title="discourse_ai.ai_bot.conversations.upload_files"
+ class="btn btn-transparent ai-bot-upload-btn"
+ />
+ <textarea
+ {{didInsert this.setTextArea}}
+ {{on "input" this.updateInputValue}}
+ {{on "keydown" this.handleKeyDown}}
+ {{on "beforeinput" this.handleBeforeInput}}
+ id="ai-bot-conversations-input"
+ autofocus={{unless this.isSubmitDisabled "true"}}
+ placeholder={{i18n
+ "discourse_ai.ai_bot.conversations.placeholder"
+ }}
+ minlength="10"
+ disabled={{if this.isSubmitDisabled true this.loading}}
+ rows="1"
+ />
+ <DButton
+ @action={{unless
+ this.isSubmitDisabled
+ this.prepareAndSubmitToBot
+ }}
+ @icon="paper-plane"
+ @disabled={{this.isSubmitDisabled}}
+ @isLoading={{unless this.isSubmitDisabled this.loading}}
+ @title="discourse_ai.ai_bot.conversations.header"
+ class="ai-bot-button btn-transparent ai-conversation-submit"
+ />
+ <input
+ type="file"
+ id="ai-bot-file-uploader"
+ class="hidden-upload-field"
+ multiple="multiple"
+ {{didInsert this.registerFileInput}}
+ />
+ </div>
- <div
- {{this.creditLimitTooltipModifier}}
- class={{dConcatClass
- "ai-bot-conversations__input-wrapper"
- (if this.isSubmitDisabled "--disabled")
- }}
- >
- <DButton
- @icon="upload"
- @action={{unless this.isSubmitDisabled this.openFileUpload}}
- @disabled={{this.isSubmitDisabled}}
- @title="discourse_ai.ai_bot.conversations.upload_files"
- class="btn btn-transparent ai-bot-upload-btn"
- />
- <textarea
- {{didInsert this.setTextArea}}
- {{on "input" this.updateInputValue}}
- {{on "keydown" this.handleKeyDown}}
- {{on "beforeinput" this.handleBeforeInput}}
- id="ai-bot-conversations-input"
- autofocus={{unless this.isSubmitDisabled "true"}}
- placeholder={{i18n "discourse_ai.ai_bot.conversations.placeholder"}}
- minlength="10"
- disabled={{if this.isSubmitDisabled true this.loading}}
- rows="1"
- />
- <DButton
- @action={{unless this.isSubmitDisabled this.prepareAndSubmitToBot}}
- @icon="paper-plane"
- @disabled={{this.isSubmitDisabled}}
- @isLoading={{unless this.isSubmitDisabled this.loading}}
- @title="discourse_ai.ai_bot.conversations.header"
- class="ai-bot-button btn-transparent ai-conversation-submit"
- />
- <input
- type="file"
- id="ai-bot-file-uploader"
- class="hidden-upload-field"
- multiple="multiple"
- {{didInsert this.registerFileInput}}
+ <AiAgentLlmSelector
+ @showLabels={{true}}
+ @setAgentId={{this.setAgentId}}
+ @setLlmId={{this.setLlmId}}
+ @setTargetRecipient={{this.setTargetRecipient}}
+ @agentName={{@controller.agent}}
+ @llmName={{@controller.llm}}
+ @onSelectionChanged={{this.onSelectionChanged}}
/>
</div>
diff --git a/plugins/discourse-ai/assets/stylesheets/modules/ai-bot-conversations/common.scss b/plugins/discourse-ai/assets/stylesheets/modules/ai-bot-conversations/common.scss
index 1b5a5a6ef2b..c522e7c223a 100644
--- a/plugins/discourse-ai/assets/stylesheets/modules/ai-bot-conversations/common.scss
+++ b/plugins/discourse-ai/assets/stylesheets/modules/ai-bot-conversations/common.scss
@@ -48,6 +48,10 @@ body.has-ai-conversations-sidebar {
display: none;
}
+ .ai-conversation-sidebar__link {
+ font-size: var(--font-down-1);
+ }
+
.sidebar-toggle-all-sections {
display: none;
}
@@ -147,7 +151,7 @@ body.has-ai-conversations-sidebar {
.agent-llm-selector {
display: flex;
- gap: 0.5em;
+ gap: var(--space-4);
justify-content: flex-start;
.select-kit-body {
@@ -159,19 +163,21 @@ body.has-ai-conversations-sidebar {
&__selection-wrapper {
display: flex;
- flex-direction: column;
- min-width: 0;
- gap: var(--space-2);
+ flex-direction: row;
+ align-items: center;
+ gap: var(--space-1);
- @include viewport.until(sm) {
- .select-kit-header-wrapper {
- font-size: var(--font-down-1);
- }
+ .select-kit-header-wrapper {
+ font-size: var(--font-down-1);
+ flex-direction: row-reverse;
+ gap: var(--space-1);
}
label {
- font-size: var(--font-down-1);
- font-weight: 300;
+ color: var(--primary-700);
+ font-size: var(--font-down-2);
+ font-weight: 500;
+ margin: 0;
}
.name {
@@ -186,6 +192,7 @@ body.has-ai-conversations-sidebar {
justify-content: flex-start;
background-color: transparent;
font-weight: bold;
+ padding: 0;
}
.btn:hover,
@@ -207,7 +214,7 @@ body.has-ai-conversations-sidebar {
align-items: center;
justify-content: center;
flex: 1 1 auto;
- gap: 0.5em;
+ gap: var(--space-4);
.loading-container {
display: contents;
@@ -221,12 +228,31 @@ body.has-ai-conversations-sidebar {
margin-bottom: 0.25em;
line-height: var(--line-height-medium);
+ .d-icon-discobot {
+ height: 1em;
+ width: 1em;
+ margin-right: 0.15em;
+ vertical-align: -0.1em;
+ }
+
// optical centering for layout balance
@media screen and (height >= 600px) {
margin-top: -6em;
}
}
+ &__input-container {
+ width: 80%;
+ max-width: var(--input-max-width);
+ display: flex;
+ flex-direction: column;
+ gap: var(--space-2);
+
+ @include viewport.until(sm) {
+ width: 100%;
+ }
+ }
+
&__input-wrapper {
--input-min-height: 2.5em;
display: flex;
@@ -250,11 +276,6 @@ body.has-ai-conversations-sidebar {
}
}
- @include viewport.from(sm) {
- width: 80%;
- max-width: var(--input-max-width);
- }
-
&:focus-within {
border-color: var(--tertiary);
}
diff --git a/plugins/discourse-ai/assets/stylesheets/modules/ai-bot-conversations/docked-composer.scss b/plugins/discourse-ai/assets/stylesheets/modules/ai-bot-conversations/docked-composer.scss
index baa3e145bd1..5204b10a839 100644
--- a/plugins/discourse-ai/assets/stylesheets/modules/ai-bot-conversations/docked-composer.scss
+++ b/plugins/discourse-ai/assets/stylesheets/modules/ai-bot-conversations/docked-composer.scss
@@ -112,12 +112,11 @@ body.has-ai-bot-docked-composer {
// topic content doesn't show through the input while scrolling (the docked
// composer's container is transparent, unlike chat's opaque pane).
background-color: var(--secondary);
- background-image: linear-gradient(
- rgb(var(--primary-very-low-rgb), 0.5),
- rgb(var(--primary-very-low-rgb), 0.5)
- );
- transition: border-color 0.15s ease-in-out;
+ transition:
+ border-color 0.15s ease-in-out,
+ box-shadow 0.15s ease-in-out;
position: relative;
+ box-shadow: var(--shadow-docked-composer);
&.in-focus {
border-color: var(--d-input-focused-color) !important;
@@ -135,6 +134,10 @@ body.has-ai-bot-docked-composer {
}
}
+.docked-composer--at-bottom.ai-bot-docked-composer .d-editor-textarea-wrapper {
+ box-shadow: none;
+}
+
.docked-composer.ai-bot-docked-composer .d-editor-input {
padding-left: 0.75em;
padding-right: 3.5em;
diff --git a/plugins/discourse-ai/config/locales/client.en.yml b/plugins/discourse-ai/config/locales/client.en.yml
index 833853fd168..a3a2ee89dc8 100644
--- a/plugins/discourse-ai/config/locales/client.en.yml
+++ b/plugins/discourse-ai/config/locales/client.en.yml
@@ -1223,8 +1223,8 @@ en:
ai_bot:
title: "AI bot"
- agent: "Agent"
- llm: "Model"
+ agent: "Agent:"
+ llm: "Model:"
pm_warning: "AI chatbot messages are monitored regularly by moderators."
cancel_streaming: "Stop reply"
try_again: "Try again"