Skip to content

Commit dba11d5

Browse files
feat: enhance visual feedback for invalid and unsupported widget configurations in WidgetRenderer
1 parent c59ab0a commit dba11d5

1 file changed

Lines changed: 23 additions & 3 deletions

File tree

src/components/dashboard-builder/widgets/WidgetRenderer.tsx

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { SliderWidget } from './SliderWidget';
1212
import { TankWidget } from './TankWidget';
1313
import { SparklineWidget } from './SparklineWidget';
1414
import { useWidgetData } from '@/hooks/useWidgetData';
15+
import { AlertTriangle, HelpCircle, FileQuestion } from 'lucide-react';
1516

1617
interface WidgetRendererProps {
1718
config: WidgetConfig;
@@ -51,7 +52,12 @@ export default function WidgetRenderer(props: WidgetRendererProps) {
5152
const { config, nodeId, pollIntervalMs, isEditMode } = props;
5253

5354
if (!config) {
54-
return <div className="p-4 opacity-50 bg-muted rounded text-muted-foreground">Invalid Widget</div>;
55+
return (
56+
<Card className="w-full h-full flex flex-col items-center justify-center bg-destructive/5 border-destructive/20 text-destructive p-4 min-h-[100px]">
57+
<AlertTriangle className="h-8 w-8 mb-2 opacity-40" />
58+
<span className="text-xs font-bold uppercase tracking-tighter opacity-80">Invalid Configuration</span>
59+
</Card>
60+
);
5561
}
5662

5763
switch (config.type) {
@@ -147,8 +153,22 @@ export default function WidgetRenderer(props: WidgetRendererProps) {
147153
);
148154
default:
149155
return (
150-
<Card className="w-full h-full flex items-center justify-center bg-muted/30 text-muted-foreground">
151-
Unknown Widget: {config.type}
156+
<Card className="w-full h-full flex flex-col items-center justify-center bg-muted/20 border-dashed border-2 border-muted-foreground/10 text-muted-foreground p-4 min-h-[100px]">
157+
<FileQuestion className="h-10 w-10 mb-3 opacity-20" />
158+
<div className="text-center group">
159+
<p className="text-xs font-bold text-muted-foreground/60 mb-2 uppercase tracking-widest text-balance">
160+
Unsupported Widget
161+
</p>
162+
<div className="inline-flex items-center gap-1.5 bg-background/50 px-3 py-1 rounded-full border border-border shadow-sm mb-3">
163+
<span className="w-2 h-2 rounded-full bg-orange-500 animate-pulse" />
164+
<span className="text-[10px] font-mono font-bold text-foreground/70">
165+
{String(config.type)}
166+
</span>
167+
</div>
168+
<p className="text-[10px] text-muted-foreground leading-relaxed max-w-[180px] mx-auto italic opacity-70">
169+
Kindly sync your cloned repository on GitHub.
170+
</p>
171+
</div>
152172
</Card>
153173
);
154174
}

0 commit comments

Comments
 (0)