File tree Expand file tree Collapse file tree 4 files changed +45
-11
lines changed Expand file tree Collapse file tree 4 files changed +45
-11
lines changed Original file line number Diff line number Diff line change @@ -5,23 +5,41 @@ import FileNavigator from './components/file-navigator'
5
5
import StartupDialog from './components/startup-dialog'
6
6
import { CTAProvider } from './components/cta-provider'
7
7
8
- export default function RootComponent ( ) {
8
+ export interface RootComponentProps {
9
+ slots ?: Partial < {
10
+ header : React . ReactNode
11
+ sidebar : React . ReactNode
12
+ fileNavigator : React . ReactNode
13
+ startupDialog : React . ReactNode
14
+ } >
15
+ }
16
+
17
+ export const defaultSlots : RootComponentProps [ 'slots' ] = {
18
+ header : < AppHeader /> ,
19
+ sidebar : < AppSidebar /> ,
20
+ fileNavigator : < FileNavigator /> ,
21
+ startupDialog : < StartupDialog /> ,
22
+ }
23
+
24
+ export default function RootComponent ( props : RootComponentProps ) {
25
+ const slots = Object . assign ( { } , defaultSlots , props . slots )
26
+
9
27
return (
10
28
< CTAProvider >
11
29
< main className = "min-w-[1280px]" >
12
30
< BackgroundAnimation />
13
31
< div className = "min-h-dvh p-2 sm:p-4 space-y-2 sm:space-y-4 @container" >
14
- < AppHeader />
32
+ { slots . header }
15
33
< div className = "flex flex-row" >
16
34
< div className = "w-1/3 @8xl:w-1/4 pr-2" >
17
- < AppSidebar />
35
+ { slots . sidebar }
18
36
</ div >
19
37
< div className = "w-2/3 @8xl:w-3/4 pl-2" >
20
- < FileNavigator />
38
+ { slots . fileNavigator }
21
39
</ div >
22
40
</ div >
23
41
</ div >
24
- < StartupDialog />
42
+ { slots . startupDialog }
25
43
</ main >
26
44
</ CTAProvider >
27
45
)
Original file line number Diff line number Diff line change @@ -9,9 +9,27 @@ import TypescriptSwitch from './sidebar-items/typescript-switch'
9
9
import StarterDialog from './sidebar-items/starter'
10
10
import SidebarGroup from './sidebar-items/sidebar-group'
11
11
12
- export function AppSidebar ( ) {
12
+ export interface SidebarProps {
13
+ slots ?: {
14
+ actions : React . ReactNode
15
+ }
16
+ }
17
+
18
+ export const DefaultAppSidebarActions = ( ) => (
19
+ < div className = "mt-5" >
20
+ < RunAddOns />
21
+ < RunCreateApp />
22
+ </ div >
23
+ )
24
+
25
+ const defaultSlots : SidebarProps [ 'slots' ] = {
26
+ actions : < DefaultAppSidebarActions /> ,
27
+ }
28
+
29
+ export function AppSidebar ( props : SidebarProps ) {
13
30
const ready = useReady ( )
14
31
const mode = useApplicationMode ( )
32
+ const slots = Object . assign ( { } , defaultSlots , props . slots )
15
33
16
34
return (
17
35
< div className = "flex flex-col gap-2" >
@@ -34,10 +52,7 @@ export function AppSidebar() {
34
52
) }
35
53
</ >
36
54
) }
37
- < div className = "mt-5" >
38
- < RunAddOns />
39
- < RunCreateApp />
40
- </ div >
55
+ { slots . actions }
41
56
</ div >
42
57
)
43
58
}
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import {
20
20
import StatusList from '../status-list'
21
21
import { createAppStreaming , shutdown } from '../../lib/api'
22
22
23
+
23
24
export default function RunCreateApp ( ) {
24
25
const [ isRunning , setIsRunning ] = useState ( false )
25
26
const { streamItems, monitorStream, finished } = useStreamingStatus ( )
Original file line number Diff line number Diff line change @@ -41,4 +41,4 @@ export {
41
41
useReady ,
42
42
}
43
43
44
- export default RootComponent
44
+ export default RootComponent
You can’t perform that action at this time.
0 commit comments