@@ -3,11 +3,12 @@ import { Navigation } from "./Navigation.js";
33import { Dashboard } from "./Dashboard.js" ;
44import { ListView } from "./ListView.js" ;
55import { ItemForm } from "./ItemForm.js" ;
6- import type { AdminContext , ServerActionInput } from "../server/types.js" ;
7- import { getListKeyFromUrl } from "@opensaas/core" ;
6+ import type { ServerActionInput } from "../server/types.js" ;
7+ import { AccessContext , getListKeyFromUrl , OpenSaaSConfig } from "@opensaas/core" ;
88
9- export interface AdminUIProps {
10- context : AdminContext ;
9+ export interface AdminUIProps < TPrisma > {
10+ context : AccessContext < TPrisma > ;
11+ config : OpenSaaSConfig ;
1112 params ?: string [ ] ;
1213 searchParams ?: { [ key : string ] : string | string [ ] | undefined } ;
1314 basePath ?: string ;
@@ -25,13 +26,14 @@ export interface AdminUIProps {
2526 * - [list, 'create'] → ItemForm (create)
2627 * - [list, id] → ItemForm (edit)
2728 */
28- export function AdminUI ( {
29+ export function AdminUI < TPrisma > ( {
2930 context,
31+ config,
3032 params = [ ] ,
3133 searchParams = { } ,
3234 basePath = "/admin" ,
3335 serverAction,
34- } : AdminUIProps ) {
36+ } : AdminUIProps < TPrisma > ) {
3537 // Parse route from params
3638 const [ urlSegment , action ] = params ;
3739
@@ -46,12 +48,13 @@ export function AdminUI({
4648
4749 if ( ! listKey ) {
4850 // Dashboard
49- content = < Dashboard context = { context } basePath = { basePath } /> ;
51+ content = < Dashboard context = { context } config = { config } basePath = { basePath } /> ;
5052 } else if ( action === "create" ) {
5153 // Create form
5254 content = (
5355 < ItemForm
5456 context = { context }
57+ config = { config }
5558 listKey = { listKey }
5659 mode = "create"
5760 basePath = { basePath }
@@ -63,6 +66,7 @@ export function AdminUI({
6366 content = (
6467 < ItemForm
6568 context = { context }
69+ config = { config }
6670 listKey = { listKey }
6771 mode = "edit"
6872 itemId = { action }
@@ -78,6 +82,7 @@ export function AdminUI({
7882 content = (
7983 < ListView
8084 context = { context }
85+ config = { config }
8186 listKey = { listKey }
8287 basePath = { basePath }
8388 search = { search }
@@ -88,7 +93,7 @@ export function AdminUI({
8893
8994 return (
9095 < div className = "flex min-h-screen bg-background" >
91- < Navigation context = { context } basePath = { basePath } currentPath = { currentPath } />
96+ < Navigation context = { context } config = { config } basePath = { basePath } currentPath = { currentPath } />
9297 < main className = "flex-1 overflow-y-auto" > { content } </ main >
9398 </ div >
9499 ) ;
0 commit comments