mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-17 15:42:24 +00:00
fix(ui): let the chart error card decide from the error too
ChartErrorState took no error, so a chart whose read was refused or whose session had ended offered a retry that could not help. It now takes the error and branches the way QueryErrorCard and QueryErrorRow do, the chunk boundary hands it the error it caught, and the error-prop guard covers it. QueryErrorRow gains an inset form for a failure inside a card body, and its frame takes the md:p-6 step. QueryErrorCard drops its fixed px-6 for the card's own inset and both icons move onto the size scale.
This commit is contained in:
1 parent
6e54f33901
commit
3fbd16a0a6
9 files changed
+91
-36
No files matched your search
@@ -53,10 +53,10 @@ export function QueryErrorCard({
|
||||
<Card data-slot="query-error-card" className={cn(className)}>
|
||||
<CardContent
|
||||
role="alert"
|
||||
className="flex flex-col items-center justify-center gap-3 px-6 py-10 text-center"
|
||||
className="flex flex-col items-center justify-center gap-3 py-10 text-center"
|
||||
>
|
||||
<AlertTriangle
|
||||
className="text-muted-foreground h-8 w-8"
|
||||
className="text-muted-foreground size-6"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<p className="text-sm font-medium">{failure.message}</p>
|
||||
@@ -74,7 +74,7 @@ export function QueryErrorCard({
|
||||
size="sm"
|
||||
onClick={action.onClick}
|
||||
>
|
||||
<RotateCw className="h-3.5 w-3.5" aria-hidden="true" />
|
||||
<RotateCw className="size-3.5" aria-hidden="true" />
|
||||
{retryLabel ?? action.label}
|
||||
</Button>
|
||||
) : action ? (
|
||||
|
||||
@@ -29,6 +29,9 @@ import { cn } from "@/lib/utils";
|
||||
*
|
||||
* The message renders in `text-foreground`: an alert IS the content of a
|
||||
* failed surface, and §3 reserves muted for meta.
|
||||
*
|
||||
* `inset` drops the row's own frame for a failure inside a card or tile body
|
||||
* that already draws one; a framed row there would be a card inside a card.
|
||||
*/
|
||||
export function QueryErrorRow({
|
||||
error,
|
||||
@@ -38,6 +41,7 @@ export function QueryErrorRow({
|
||||
retryLabel,
|
||||
slot,
|
||||
retrySlot,
|
||||
inset = false,
|
||||
className,
|
||||
}: {
|
||||
/** The query's error. It decides what the row offers. */
|
||||
@@ -56,6 +60,8 @@ export function QueryErrorRow({
|
||||
slot?: string;
|
||||
/** Same, for the Retry button's own `data-slot`. */
|
||||
retrySlot?: string;
|
||||
/** Inside a card or tile body: no frame of its own. */
|
||||
inset?: boolean;
|
||||
className?: string;
|
||||
}) {
|
||||
const failure = useReadFailure(error, { message, onRetry });
|
||||
@@ -66,7 +72,8 @@ export function QueryErrorRow({
|
||||
data-slot={slot ?? "query-error-row"}
|
||||
role="alert"
|
||||
className={cn(
|
||||
"bg-card border-border text-foreground flex flex-col items-start gap-3 rounded-xl border p-4 text-sm sm:flex-row sm:items-center sm:justify-between",
|
||||
"text-foreground flex flex-col items-start gap-3 text-sm sm:flex-row sm:items-center sm:justify-between",
|
||||
!inset && "bg-card border-border rounded-xl border p-4 md:p-6",
|
||||
className,
|
||||
)}
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user