From 4635e3ce4e472a3d95ac9618f0c19265479e52f5 Mon Sep 17 00:00:00 2001 From: ajnart Date: Thu, 30 Jul 2026 11:17:08 +0200 Subject: [PATCH] fix: harden assistant floating panel --- .../src/components/assistant/assistant-panel.module.css | 8 ++++---- apps/nextjs/src/components/assistant/assistant-panel.tsx | 1 + .../src/components/assistant/assistant-provider.tsx | 6 ++++-- packages/translation/src/lang/en.json | 1 + 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/apps/nextjs/src/components/assistant/assistant-panel.module.css b/apps/nextjs/src/components/assistant/assistant-panel.module.css index 439552e5f..a8d14124c 100644 --- a/apps/nextjs/src/components/assistant/assistant-panel.module.css +++ b/apps/nextjs/src/components/assistant/assistant-panel.module.css @@ -47,7 +47,7 @@ display: flex; width: min(46rem, calc(100vw - 2rem)); height: min(36rem, calc(100dvh - 5rem)); - min-height: 22rem; + min-height: min(22rem, calc(100dvh - 5rem)); margin: 0; transform: translateX(-50%); flex-direction: column; @@ -251,7 +251,7 @@ bottom: 0.5rem; width: calc(100vw - 1rem); height: min(44rem, calc(100dvh - 1rem)); - min-height: 20rem; + min-height: min(20rem, calc(100dvh - 1rem)); } .panelHeader { @@ -274,11 +274,11 @@ padding-inline: 0.5rem; } - .historyButton :global(.mantine-Button-section) { + .historyButtonSection { margin-inline-end: 0; } - .historyButton :global(.mantine-Button-label) { + .historyButtonLabel { display: none; } diff --git a/apps/nextjs/src/components/assistant/assistant-panel.tsx b/apps/nextjs/src/components/assistant/assistant-panel.tsx index 7664a422d..43415d2fd 100644 --- a/apps/nextjs/src/components/assistant/assistant-panel.tsx +++ b/apps/nextjs/src/components/assistant/assistant-panel.tsx @@ -337,6 +337,7 @@ const ConversationHistory = () => { color="gray" size="compact-sm" leftSection={} + classNames={{ section: classes.historyButtonSection, label: classes.historyButtonLabel }} onClick={() => setOpened((current) => !current)} > {t("conversations")} diff --git a/apps/nextjs/src/components/assistant/assistant-provider.tsx b/apps/nextjs/src/components/assistant/assistant-provider.tsx index 06f8e20cd..d9b7e92bb 100644 --- a/apps/nextjs/src/components/assistant/assistant-provider.tsx +++ b/apps/nextjs/src/components/assistant/assistant-provider.tsx @@ -440,7 +440,7 @@ const DisabledAssistantProvider = ({ children, description }: DisabledAssistantP export const AssistantProvider = ({ children }: PropsWithChildren) => { const t = useScopedI18n("common.assistant"); const session = useSession(); - const { data, isLoading } = clientApi.assistant.getAvailability.useQuery(undefined, { + const { data, isLoading, isError } = clientApi.assistant.getAvailability.useQuery(undefined, { enabled: session.status === "authenticated", staleTime: 60_000, }); @@ -459,7 +459,9 @@ export const AssistantProvider = ({ children }: PropsWithChildren) => { ? t("unavailable.signIn") : isLoading ? t("unavailable.checking") - : t("unavailable.notConfigured"); + : isError + ? t("unavailable.error") + : t("unavailable.notConfigured"); return {children}; }; diff --git a/packages/translation/src/lang/en.json b/packages/translation/src/lang/en.json index ee45fff5d..8d9739d5e 100644 --- a/packages/translation/src/lang/en.json +++ b/packages/translation/src/lang/en.json @@ -1976,6 +1976,7 @@ }, "unavailable": { "checking": "Checking whether the assistant is available…", + "error": "The assistant's availability could not be checked. Try again.", "notConfigured": "An administrator must configure and enable the assistant first.", "signIn": "Sign in to use Homarr Assistant." },