Skip to content

Commit 079b79e

Browse files
fix(web): retain provider diagnostics in compact status tooltips
1 parent 48053f2 commit 079b79e

1 file changed

Lines changed: 35 additions & 6 deletions

File tree

‎apps/web/src/components/settings/ProviderInstanceCard.tsx‎

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from "lucide-react";
1616
import * as Arr from "effect/Array";
1717
import * as Result from "effect/Result";
18-
import { useEffect, useRef, useState, type ReactNode } from "react";
18+
import { useEffect, useRef, useState, type ReactElement, type ReactNode } from "react";
1919
import {
2020
isProviderDriverKind,
2121
resolveProviderInstanceEnabled,
@@ -59,6 +59,22 @@ import {
5959

6060
const ENVIRONMENT_VARIABLE_NAME_PATTERN = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
6161

62+
function ProviderStatusDiagnostic({
63+
detail,
64+
children,
65+
}: {
66+
detail: string | null;
67+
children: ReactElement;
68+
}) {
69+
if (!detail) return children;
70+
return (
71+
<Tooltip>
72+
<TooltipTrigger render={children} />
73+
<TooltipPopup side="top">{detail}</TooltipPopup>
74+
</Tooltip>
75+
);
76+
}
77+
6278
let environmentVariableDraftId = 0;
6379
const nextEnvironmentVariableDraftId = () => `provider-env-${environmentVariableDraftId++}`;
6480

@@ -583,6 +599,7 @@ export function ProviderInstanceCard({
583599
<span className={cn("size-1.5 shrink-0 rounded-full", statusStyle.dot)} aria-hidden />
584600
) : null;
585601
const needsAttention = statusKey === "warning" || statusKey === "error";
602+
const statusDiagnostic = hasCompatibilityWarning && needsAttention ? summary.detail : null;
586603
// Keep compatibility copy compact; the version popover carries the explanation.
587604
const inlineStatusDetail = hasCompatibilityWarning
588605
? compatibility?.status === "broken"
@@ -695,10 +712,15 @@ export function ProviderInstanceCard({
695712
{statusDotNode ? (
696713
<span className="flex h-[1.45em] shrink-0 items-center">{statusDotNode}</span>
697714
) : null}
698-
<span className="line-clamp-2 [overflow-wrap:anywhere]">
699-
{summary.headline}
700-
{needsAttention && inlineStatusDetail ? ` · ${inlineStatusDetail}` : null}
701-
</span>
715+
<ProviderStatusDiagnostic detail={statusDiagnostic}>
716+
<span
717+
tabIndex={statusDiagnostic ? 0 : undefined}
718+
className="pointer-events-auto line-clamp-2 [overflow-wrap:anywhere]"
719+
>
720+
{summary.headline}
721+
{needsAttention && inlineStatusDetail ? ` · ${inlineStatusDetail}` : null}
722+
</span>
723+
</ProviderStatusDiagnostic>
702724
</span>
703725
</span>
704726
</div>
@@ -844,7 +866,14 @@ export function ProviderInstanceCard({
844866
<SettingsRow
845867
title="Display name"
846868
status={
847-
<div className="flex min-w-0 flex-wrap items-center gap-x-1.5">{editorStatusNode}</div>
869+
<ProviderStatusDiagnostic detail={statusDiagnostic}>
870+
<div
871+
tabIndex={statusDiagnostic ? 0 : undefined}
872+
className="flex min-w-0 flex-wrap items-center gap-x-1.5"
873+
>
874+
{editorStatusNode}
875+
</div>
876+
</ProviderStatusDiagnostic>
848877
}
849878
control={
850879
<div

0 commit comments

Comments
 (0)