Skip to content

Commit 4320986

Browse files
Copilothotlong
andcommitted
feat: integrate action:bar into Console views for record_header and list_toolbar
- RecordDetailView: pass objectDef record_header actions to DetailView via action:bar schema (renders in detail view header) - ObjectView: replace manual Button rendering with SchemaRenderer + action:bar for list_toolbar; fixes location→locations bug - Both integrations use action:bar's location filtering and overflow Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 631814d commit 4320986

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

apps/console/src/components/ObjectView.tsx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { useObjectTranslation } from '@object-ui/i18n';
3030
import { usePermissions } from '@object-ui/permissions';
3131
import { useAuth } from '@object-ui/auth';
3232
import { useRealtimeSubscription, useConflictResolution } from '@object-ui/collaboration';
33-
import { useNavigationOverlay } from '@object-ui/react';
33+
import { useNavigationOverlay, SchemaRenderer } from '@object-ui/react';
3434

3535
/** Map view types to Lucide icons (Airtable-style) */
3636
const VIEW_TYPE_ICONS: Record<string, ComponentType<{ className?: string }>> = {
@@ -719,17 +719,15 @@ export function ObjectView({ dataSource, objects, onEdit }: any) {
719719
)}
720720

721721
{/* Schema-driven toolbar actions */}
722-
{objectDef.actions?.filter((a: any) => a.location === 'list_toolbar').map((action: any) => (
723-
<Button
724-
key={action.name || action.label}
725-
size="sm"
726-
variant={action.variant || "outline"}
727-
className="shadow-none h-8 sm:h-9"
728-
onClick={() => actions.execute(action)}
729-
>
730-
{action.label || action.name}
731-
</Button>
732-
))}
722+
{objectDef.actions?.some((a: any) => a.locations?.includes('list_toolbar')) && (
723+
<SchemaRenderer schema={{
724+
type: 'action:bar',
725+
location: 'list_toolbar',
726+
actions: objectDef.actions,
727+
size: 'sm',
728+
variant: 'outline',
729+
}} />
730+
)}
733731

734732
{/* Design tools menu — visible only to admin users */}
735733
{isAdmin && (

apps/console/src/components/RecordDetailView.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,11 @@ export function RecordDetailView({ dataSource, objects, onEdit }: RecordDetailVi
247247
},
248248
];
249249

250+
// Filter actions for record_header location
251+
const recordHeaderActions = (objectDef.actions || []).filter(
252+
(a: any) => a.locations?.includes('record_header'),
253+
);
254+
250255
const detailSchema: DetailViewSchema = {
251256
type: 'detail-view',
252257
objectName: objectDef.name,
@@ -257,6 +262,13 @@ export function RecordDetailView({ dataSource, objects, onEdit }: RecordDetailVi
257262
title: objectDef.label,
258263
primaryField,
259264
sections,
265+
...(recordHeaderActions.length > 0 && {
266+
actions: [{
267+
type: 'action:bar',
268+
location: 'record_header',
269+
actions: recordHeaderActions,
270+
} as any],
271+
}),
260272
};
261273

262274
return (

0 commit comments

Comments
 (0)