Skip to content

Commit 7f368cf

Browse files
Copilothotlong
andcommitted
fix: address code review feedback - emptyState icon support and Zod schema fix
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent af970a4 commit 7f368cf

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

packages/plugin-list/src/ListView.tsx

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import * as React from 'react';
1010
import { cn, Button, Input, Popover, PopoverContent, PopoverTrigger, FilterBuilder, SortBuilder, NavigationOverlay } from '@object-ui/components';
1111
import type { SortItem } from '@object-ui/components';
12-
import { Search, SlidersHorizontal, ArrowUpDown, X, EyeOff, Group, Paintbrush, Ruler, Inbox } from 'lucide-react';
12+
import { Search, SlidersHorizontal, ArrowUpDown, X, EyeOff, Group, Paintbrush, Ruler, Inbox, icons, type LucideIcon } from 'lucide-react';
1313
import type { FilterGroup } from '@object-ui/components';
1414
import { ViewSwitcher, ViewType } from './ViewSwitcher';
1515
import { SchemaRenderer, useNavigationOverlay } from '@object-ui/react';
@@ -593,15 +593,25 @@ export const ListView: React.FC<ListViewProps> = ({
593593
{/* View Content */}
594594
<div key={currentView} className="flex-1 min-h-0 bg-background relative overflow-hidden animate-in fade-in-0 duration-200">
595595
{!loading && data.length === 0 ? (
596-
<div className="flex flex-col items-center justify-center h-full min-h-[200px] text-center p-8" data-testid="empty-state">
597-
<Inbox className="h-12 w-12 text-muted-foreground/50 mb-4" />
598-
<h3 className="text-lg font-medium text-foreground mb-1">
599-
{(typeof schema.emptyState?.title === 'string' ? schema.emptyState.title : undefined) ?? 'No items found'}
600-
</h3>
601-
<p className="text-sm text-muted-foreground max-w-md">
602-
{(typeof schema.emptyState?.message === 'string' ? schema.emptyState.message : undefined) ?? 'There are no records to display. Try adjusting your filters or adding new data.'}
603-
</p>
604-
</div>
596+
(() => {
597+
const iconName = schema.emptyState?.icon;
598+
const ResolvedIcon: LucideIcon = iconName
599+
? ((icons as Record<string, LucideIcon>)[
600+
iconName.split('-').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join('')
601+
] ?? Inbox)
602+
: Inbox;
603+
return (
604+
<div className="flex flex-col items-center justify-center h-full min-h-[200px] text-center p-8" data-testid="empty-state">
605+
<ResolvedIcon className="h-12 w-12 text-muted-foreground/50 mb-4" />
606+
<h3 className="text-lg font-medium text-foreground mb-1">
607+
{(typeof schema.emptyState?.title === 'string' ? schema.emptyState.title : undefined) ?? 'No items found'}
608+
</h3>
609+
<p className="text-sm text-muted-foreground max-w-md">
610+
{(typeof schema.emptyState?.message === 'string' ? schema.emptyState.message : undefined) ?? 'There are no records to display. Try adjusting your filters or adding new data.'}
611+
</p>
612+
</div>
613+
);
614+
})()
605615
) : (
606616
<SchemaRenderer
607617
schema={viewComponentSchema}

packages/plugin-timeline/src/ObjectTimeline.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const TimelineExtensionSchema = z.object({
3232
descriptionField: z.string().optional(),
3333
groupByField: z.string().optional(),
3434
colorField: z.string().optional(),
35-
scale: z.enum(['hour', 'day', 'week', 'month', 'quarter', 'year']).default('day').optional(),
35+
scale: z.enum(['hour', 'day', 'week', 'month', 'quarter', 'year']).optional(),
3636
});
3737

3838
export interface ObjectTimelineProps {

0 commit comments

Comments
 (0)