fix(ai): improve responsive composer controls
This commit is contained in:
2 files changed
+10
-9
No files matched your search
@@ -1,9 +1,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, defineAsyncComponent, h, nextTick, onMounted, onUnmounted, reactive, ref, toRaw, watch, type Component } from "vue";
|
import { computed, defineAsyncComponent, h, nextTick, onMounted, onUnmounted, reactive, ref, toRaw, watch, type Component } from "vue";
|
||||||
import { uuid } from "@/lib/common/utils";
|
import { uuid } from "@/lib/common/utils";
|
||||||
import { deferUntilPanelResizeEnd } from "@/lib/app/panelResizeState";
|
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { translateBackendError } from "@/i18n/backend-errors";
|
import { translateBackendError } from "@/i18n/backend-errors";
|
||||||
|
import { deferUntilPanelResizeEnd } from "@/lib/app/panelResizeState";
|
||||||
import {
|
import {
|
||||||
ArrowDown,
|
ArrowDown,
|
||||||
ArrowUp,
|
ArrowUp,
|
||||||
@@ -6022,7 +6022,6 @@ async function openExternalUrl(url: string) {
|
|||||||
@update:model-value="(v) => changeConnection(v)"
|
@update:model-value="(v) => changeConnection(v)"
|
||||||
/>
|
/>
|
||||||
<template v-if="boundConnection && showAiDatabaseSelector">
|
<template v-if="boundConnection && showAiDatabaseSelector">
|
||||||
<Database class="h-3 w-3 shrink-0 text-foreground/40" />
|
|
||||||
<Popover
|
<Popover
|
||||||
@update:open="
|
@update:open="
|
||||||
(open: boolean) => {
|
(open: boolean) => {
|
||||||
@@ -6031,7 +6030,8 @@ async function openExternalUrl(url: string) {
|
|||||||
"
|
"
|
||||||
>
|
>
|
||||||
<PopoverTrigger as-child>
|
<PopoverTrigger as-child>
|
||||||
<Button variant="ghost" :title="selectedDatabaseLabel" :class="['h-5 min-w-0 max-w-64 justify-start border-0 p-0 px-1 text-xs font-normal text-foreground/80 shadow-none', showAiSchemaSelector && 'flex-1']">
|
<Button variant="ghost" :title="selectedDatabaseLabel" :aria-label="selectedDatabaseLabel" :class="['ai-database-selector-trigger h-5 min-w-0 max-w-64 justify-start gap-1 border-0 p-0 px-1 text-xs font-normal text-foreground/80 shadow-none', showAiSchemaSelector && 'flex-1']">
|
||||||
|
<Database class="ai-database-selector-icon h-3 w-3 shrink-0 text-foreground/40" />
|
||||||
<span class="truncate">{{ selectedDatabaseLabel }}</span>
|
<span class="truncate">{{ selectedDatabaseLabel }}</span>
|
||||||
</Button>
|
</Button>
|
||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
@@ -6687,12 +6687,9 @@ async function openExternalUrl(url: string) {
|
|||||||
font-size: var(--dbx-ai-content-font-size, 0.75rem);
|
font-size: var(--dbx-ai-content-font-size, 0.75rem);
|
||||||
}
|
}
|
||||||
|
|
||||||
.ai-prompt-context-row--compact .ai-prompt-context-spacer {
|
|
||||||
flex: 0 0 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ai-prompt-context-row--compact .ai-template-selector-trigger,
|
.ai-prompt-context-row--compact .ai-template-selector-trigger,
|
||||||
.ai-prompt-context-row--compact .ai-skills-selector-trigger {
|
.ai-prompt-context-row--compact .ai-skills-selector-trigger,
|
||||||
|
.ai-prompt-context-row--compact .ai-database-selector-trigger {
|
||||||
flex: 0 0 1.5rem;
|
flex: 0 0 1.5rem;
|
||||||
width: 1.5rem;
|
width: 1.5rem;
|
||||||
max-width: 1.5rem;
|
max-width: 1.5rem;
|
||||||
@@ -6704,7 +6701,8 @@ async function openExternalUrl(url: string) {
|
|||||||
.ai-prompt-context-row--compact .ai-template-selector-label,
|
.ai-prompt-context-row--compact .ai-template-selector-label,
|
||||||
.ai-prompt-context-row--compact .ai-template-selector-chevron,
|
.ai-prompt-context-row--compact .ai-template-selector-chevron,
|
||||||
.ai-prompt-context-row--compact .ai-skills-selector-label,
|
.ai-prompt-context-row--compact .ai-skills-selector-label,
|
||||||
.ai-prompt-context-row--compact .ai-skills-selector-count {
|
.ai-prompt-context-row--compact .ai-skills-selector-count,
|
||||||
|
.ai-prompt-context-row--compact .ai-database-selector-trigger > span {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -271,5 +271,8 @@ describe("AiAssistant mount", () => {
|
|||||||
const row = container.querySelector("[data-ai-composer-context-row]");
|
const row = container.querySelector("[data-ai-composer-context-row]");
|
||||||
expect(row?.textContent).toContain(i18n.global.t("editor.selectDatabase"));
|
expect(row?.textContent).toContain(i18n.global.t("editor.selectDatabase"));
|
||||||
expect(row?.classList.contains("ai-prompt-context-row--schema")).toBe(true);
|
expect(row?.classList.contains("ai-prompt-context-row--schema")).toBe(true);
|
||||||
|
const databaseTrigger = container.querySelector<HTMLButtonElement>(".ai-database-selector-trigger");
|
||||||
|
expect(databaseTrigger?.getAttribute("aria-label")).toBeTruthy();
|
||||||
|
expect(databaseTrigger?.querySelector(".ai-database-selector-icon")).not.toBeNull();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Reference in new issue
Block a user