Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit cb5785c

Browse files
committed
DEV: Make tool presets a dropdown
1 parent a3fb5cd commit cb5785c

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

assets/javascripts/discourse/components/ai-tool-list-editor.gjs

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ import Component from "@glimmer/component";
22
import { LinkTo } from "@ember/routing";
33
import { service } from "@ember/service";
44
import DBreadcrumbsItem from "discourse/components/d-breadcrumbs-item";
5+
import DButton from "discourse/components/d-button";
56
import DPageSubheader from "discourse/components/d-page-subheader";
7+
import DropdownMenu from "discourse/components/dropdown-menu";
68
import { i18n } from "discourse-i18n";
79
import AdminConfigAreaEmptyList from "admin/components/admin-config-area-empty-list";
10+
import DMenu from "float-kit/components/d-menu";
811

912
export default class AiToolListEditor extends Component {
1013
@service adminPluginNavManager;
@@ -20,13 +23,26 @@ export default class AiToolListEditor extends Component {
2023
@learnMoreUrl="https://meta.discourse.org/t/ai-bot-custom-tools/314103"
2124
@descriptionLabel={{i18n "discourse_ai.tools.subheader_description"}}
2225
>
23-
<:actions as |actions|>
24-
<actions.Primary
25-
@label="discourse_ai.tools.new"
26-
@route="adminPlugins.show.discourse-ai-tools.new"
26+
<:actions>
27+
<DMenu
28+
@triggerClass="btn-primary btn-small"
29+
@label={{i18n "discourse_ai.tools.new"}}
2730
@icon="plus"
28-
class="ai-tool-list-editor__new-button"
29-
/>
31+
>
32+
<:content>
33+
{{! TODO add action to dropdown button that prefills editor }}
34+
<DropdownMenu as |dropdown|>
35+
{{#each @tools.resultSetMeta.presets as |preset|}}
36+
<dropdown.item>
37+
<DButton
38+
@translatedLabel={{preset.preset_name}}
39+
class="btn-transparent"
40+
/>
41+
</dropdown.item>
42+
{{/each}}
43+
</DropdownMenu>
44+
</:content>
45+
</DMenu>
3046
</:actions>
3147
</DPageSubheader>
3248

0 commit comments

Comments
 (0)